fix(journaling): preserve snapshot reference scopes - #10800
Merged
ReubenBond merged 7 commits intoAug 24, 2026
Merged
ReubenBond merged 7 commits into
ReubenBond merged 7 commits into
Conversation
Reset the Orleans serializer reader session between independently encoded snapshot values while retaining each value's internal aliases and existing wire bytes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes OrleansBinary snapshot replay for journaling collections by ensuring the reader’s serializer reference/type tracking is reset after each independently-encoded snapshot value, preventing reference identifiers from one value from influencing subsequent values while keeping the wire bytes unchanged.
Changes:
- Reset the reader serializer session after decoding each snapshot element (and dictionary key/value) to match per-value encoding scopes.
- Update dictionary/list/queue/set snapshot replay paths to use the new “independent value” read helper.
- Add golden-payload regression tests which pin snapshot payload bytes and verify alias (intra-object reference) preservation during replay.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Journaling.Tests/OrleansBinaryCommandCodecTests.cs | Adds golden-payload tests for dictionary/list/queue/set snapshots and validates alias preservation during replay. |
| src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableSetCommandCodec.cs | Switches set snapshot replay to read each item with an independent serializer reference scope. |
| src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableQueueCommandCodec.cs | Switches queue snapshot replay to read each item with an independent serializer reference scope. |
| src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableListCommandCodec.cs | Switches list snapshot replay to read each item with an independent serializer reference scope. |
| src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryDurableDictionaryCommandCodec.cs | Switches dictionary snapshot replay to read each key and value with independent serializer reference scopes. |
| src/Orleans.Journaling/Formats/OrleansBinary/OrleansBinaryCommandCodecHelpers.cs | Introduces ReadIndependentValue which resets the reader session after decoding a value. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
Contributor
Code coverage77.48% line coverage - 97,316 / 125,601 lines Coverage details
|
Pair every encoded value with an explicit independent reader scope, including dictionary keys and values, and remove the shared-scope helper. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Keep per-value serializer-session isolation as the sole helper behavior and use concise WriteValue and ReadValue names. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Share serializer references between each dictionary key and value while resetting the session between commands and snapshot entries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Keep command zero as the single dictionary set format and rely on entry-level serializer scopes for both commands and snapshots. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
Approve the entry-scoped dictionary payloads used by the existing OrleansBinary Verify tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f32c3454-1184-4a8b-81c3-7a9f9b094617
This was referenced Aug 31, 2026
This was referenced Sep 7, 2026
Open
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.
OrleansBinary collection snapshots encode each list, queue, and set item with a fresh serializer session. Dictionary commands encode each key/value entry in one fresh session, preserving references within the entry while isolating separate commands and entries. Snapshot replay previously retained one reader reference scope across the entire snapshot, allowing reference identifiers from an earlier item or entry to affect a later one.
Reset the reader serializer session around each list, queue, and set item. For dictionaries, encode and decode each key/value pair within one entry-level session and reset between entries, matching direct
WriteSetbehavior. The sharedWriteValue/ReadValuehelpers retain concise names for single-value scopes, while the dictionary codec handles its two-field entry scope privately.Golden snapshot payload tests specify the collection format and verify aliases within values. Dictionary regressions verify references are preserved between each key and value while separate snapshot entries remain isolated. The change remains limited to OrleansBinary command encoding and decoding.