Feat(state_sync): Add the ability to fetch all versions of a snapshot by name#5273
Merged
Feat(state_sync): Add the ability to fetch all versions of a snapshot by name#5273
Conversation
georgesittas
approved these changes
Sep 3, 2025
izeigerman
approved these changes
Sep 5, 2025
b82036f to
42a113c
Compare
izeigerman
reviewed
Sep 5, 2025
| identifier=identifier, | ||
| version=version, | ||
| dev_version=dev_version, | ||
| fingerprint=SnapshotFingerprint.parse_raw(fingerprint), |
Collaborator
There was a problem hiding this comment.
I think this can still be too much parsing. Can we parse it lazily instead? Similar to how we do this with snapshots in the Environment model.
Collaborator
Author
There was a problem hiding this comment.
I did wonder about that. I've updated it to be lazily parsed on first access, although it still needs to be provided in string form to construct the object to begin with
6040d43 to
48d45aa
Compare
48d45aa to
f234322
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first in a series of PR's looking at adjusting and clarifying how restatements work.
Currently, when a model is restated in
prod, the following occurs:The purpose of that last step is to prevent stale / old data from getting promoted to
prodif someone decides to deploy a dev environment containing a version of the model that got built before the prod restatement occurred.However, the current implementation has a gap. It only clears intervals for snapshots that are promoted in dev environments, because it's limited by what
StateSyncmethods are available and it currently iterates over all environments fromStateSync.get_environments_summary().What about snapshots that arent currently promoted in any environment? There is still a risk that someone makes a change in dev that matches one of these snapshots, and it becomes promoted in dev, and then gets deployed to prod.
So, this PR adds a method to
StateSyncthat allows fetching all versions of a snapshot (based on name) regardless of if it's currently being used in an environment or not.This will allow the
prodrestatement "clear intervals" code to properly clear all relevant intervals across all snapshots of the model, rather than skipping intervals for snapshots that don't currently belong to any environment like it does today.