refactor(store): stage 4 - the session record is an explicit session schema (v2), configuration no longer persisted#1026
Open
acouvreur wants to merge 1 commit into
Open
refactor(store): stage 4 - the session record is an explicit session schema (v2), configuration no longer persisted#1026acouvreur wants to merge 1 commit into
acouvreur wants to merge 1 commit into
Conversation
…tion Stage 4 of the InstanceInfo split. The session record becomes an explicit schema (version 2) with its own fields instead of wrapping the whole domain struct: name, replicas, status, message, groups, provider details, the readiness semantics IsReady depends on (ready-after/ready-at/ ready-on-start), and the keep-warm window snapshot. Label configuration (enabled, anti-affinity, scale profiles, the typed config bag) is no longer persisted: it is parsed fresh from the provider at every boundary, and freezing it into sessions is how stale configuration used to leak into decisions and responses. Consequently warm-path session responses stop echoing those fields; they were configuration echoes, not session state, and the typed config field never shipped in a release. Everything the waiting page and plugins consume (status, replicas, names, provider details) is preserved, and readiness semantics on the warm path are unchanged. UnmarshalJSON upgrades both previous generations transparently: v1 envelopes (unreleased) and pre-versioning bare InstanceInfo documents, so live sessions in valkey and state.json snapshots survive the upgrade. The Store interface still speaks InstanceInfo; core and providers are untouched.
Test Results✅ All tests passed! | 798 tests in 140.276s
|
|
|
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.



Finding
Stage 4 of the
InstanceInfosplit (stages 1-3: #1023, #1024, #1025). Stage 3 introduced the versioned envelope but still persisted the whole domain struct inside it. This stage makes the record an explicit session schema - and uses the version machinery for exactly what it was built for: the schema change is av1 -> v2bump with transparent upgrade, not a silent break.The schema decision, field by field
The stored record is served back to callers on the warm path with zero provider calls (Sablier's warm-session performance model), so every field kept/dropped was decided against that constraint:
Kept (session state):
IsReady()on the warm path is decided from theseDropped (configuration, never read from the store):
enabledantiAffinityscaleConfigconfig(typed bag from #1023)Observable change (deliberate, discussed)
Warm-path session responses stop echoing the four configuration fields (all
omitempty- they are simply absent). They were configuration echoes riding along because the god struct was persisted, not session state; everything plugins and themes consume is preserved, and readiness semantics are unchanged (pinned by test). Landing this before the next release means theconfigfield never becomes public wire surface at all.Migration
UnmarshalJSONupgrades both previous generations transparently:v1envelopes ({"v":1,"instance":{...}}- existed only on main, never released),v0bareInstanceInfodocuments (all shipped releases),so live valkey sessions and
state.jsonsnapshots survive the upgrade. Unknown newer versions decode best-effort through the known fields. TheStoreinterface still speaksInstanceInfo- core and providers untouched.Tests
TestSessionRecordDropsConfiguration- config gone, readiness semantics intact (IsReady()still true on the warm-path view).TestSessionRecordUpgrades- v0 and v1 payloads upgrade with fields intact."v":2), valkey testcontainers migration suite (Get + Range), and thesabliercmdlegacy-fixture state-file tests - all passing; full core + store suites and lint green.Docs
No docs change: the four fields remain documented as optional response fields (they still appear on cold-path responses); the record itself is persistence-internal.