Skip to content

Conversation

erindru
Copy link
Collaborator

@erindru erindru commented Sep 1, 2025

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:

  1. Intervals are cleared from state for that model
  2. Intervals are cleared from state for all versions of that model present in dev environments

The purpose of that last step is to prevent stale / old data from getting promoted to prod if 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 StateSync methods are available and it currently iterates over all environments from StateSync.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 StateSync that 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 prod restatement "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.

@erindru erindru force-pushed the erin/state-sync-snapshots-by-name branch from b82036f to 42a113c Compare September 5, 2025 04:15
identifier=identifier,
version=version,
dev_version=dev_version,
fingerprint=SnapshotFingerprint.parse_raw(fingerprint),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants