Repository navigation
Fix StateVector clocks being read from the client id buffer - #128
Merged
SebastianStehle merged 2 commits intoOct 12, 2026
Merged
Conversation
SebastianStehle
approved these changes
Oct 9, 2026
Contributor
Author
|
The tests failing on this are really flaky, and the test failure doesn't have anything to do with the changes. #140 should fix it. |
StateVectorNative.Clocks() read from ClientIdsHandle instead of ClocksHandle, returning wrong clock values. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Covers a single client across two transactions and a document holding clocks from two distinct clients. Both fail without the Clocks() fix. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jcannon98188
force-pushed
the
fix/state-vector-clocks
branch
from
October 11, 2026 16:32
f922397 to
aec073a
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.
Summary
Fixes
StateVectorreturning the client ids as its clock values.Fixes #127
Problem
StateVectorNative.Clocks()read its values fromClientIdsHandleinstead ofClocksHandle, so everyStateVectorbuilt from native data reported each client's id (truncated touint) as its clock.client=1001 clock=6client=1001 clock=1001This affects
AfterTransactionEvent.BeforeStateandAfterState, and any other API that returns aStateVectorbuilt from native data.Changes
StateVectorNative.Clocks()reads fromClocksHandle. This is a one-line change.Tests
New
StateVectorTests, which fail without the fix and pass with it:ReportsClocksForSingleClient: one doc over two transactions. Expects{} -> {1001: 6}and then{1001: 6} -> {1001: 12}.ReportsDistinctClocksForMultipleClients: a doc merging an update from another client. Expects{2002: 6, 3003: 2}, which checks that each client gets its own clock.Client ids are set explicitly on every doc in the tests, so the results are deterministic.
Failure output without the fix:
Notes
yrs.dllbuilt from yrs 0.19.1. I did not run the rest of the unit suite on this branch.🤖 Generated with Claude Code