fix: enforce shallow snapshot concurrency boundaries - #1090
Open
zxch3n wants to merge 4 commits into
Open
Conversation
Contributor
WASM Size Report
|
zxch3n
force-pushed
the
test/shallow-snapshot-concurrency
branch
from
September 4, 2026 04:17
5a3846b to
e905696
Compare
This was referenced Sep 4, 2026
Merged
zxch3n
force-pushed
the
test/shallow-snapshot-concurrency
branch
from
September 4, 2026 11:22
e905696 to
3a5f6bb
Compare
zxch3n
force-pushed
the
test/shallow-snapshot-concurrency
branch
from
September 4, 2026 12:17
3a5f6bb to
0303fa7
Compare
zxch3n
force-pushed
the
test/shallow-snapshot-concurrency
branch
from
September 4, 2026 16:38
0303fa7 to
2240dd2
Compare
zxch3n
force-pushed
the
test/shallow-snapshot-concurrency
branch
from
September 5, 2026 05:15
2240dd2 to
a0e3494
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.
Problem and behavior
A shallow replica must reject updates rooted before its retained history without corrupting the document or leaving those updates pending. An update exactly concurrent with the root frontier previously escaped the boundary check: its deps equal the root's own deps, so a version-vector shortcut classified it as acceptable even though the dependency ids were already trimmed. Import then panicked while resolving its Lamport timestamp.
Reject that boundary explicitly with
ImportUpdatesThatDependsOnOutdatedVersion. The rejected update never enters pending storage, and later valid post-root imports still work. The fix and the concurrency contract now land together, independently of #1091's export optimization.Stacked on #1087; #1091 follows this PR.
Contracts and tests
Seven public tests in
crates/loro/tests/shallow_snapshot_concurrency.rscover:DAG and internal import tests additionally assert the exact boundary and that rejected changes are dropped rather than queued. The public boundary regression also verifies subsequent valid imports after rejection. All fixtures use fixed peers and explicit changes, without timing dependencies.
docs/shallow-snapshot-concurrency.mddocuments these guarantees and their limits: shallow snapshots cannot preserve arbitrary offline forks that diverged before the root. A non-empty target consumes retained changes rather than adopting the snapshot's state sections.Validation
a0e34943; the corrected path returns the expected error and preserves the document.git diff --checkpassed.