Repository navigation
Conversation
Adds the fix-ot-client-convergence bug change and a failing convergence spec (two OTClients + DocumentManager) reproducing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Unit Tests
Mutation Tests
|
Keeps CI green until the fix lands; task 1.1 flips them back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reversean
requested changes
Nov 3, 2026
|
|
||
| ## 2. Implementation | ||
|
|
||
| - [ ] 2.1 Thread `againstIsLater` through `Operation.transform`, `BatchedOperation.transform` and `OperationsTransformer`, and use it for the text-insert tie and the data last-writer-wins rule |
Contributor
There was a problem hiding this comment.
Include a regression test for concurrent inserts at different positions, and transform these inserts by position without merging their payloads. With a multi-character insert, #transformAgainstTextInsert can duplicate the other insert when its position falls inside the effective range, even after the planned client rebasing.
| ## 2. Implementation | ||
|
|
||
| - [ ] 2.1 Thread `againstIsLater` through `Operation.transform`, `BatchedOperation.transform` and `OperationsTransformer`, and use it for the text-insert tie and the data last-writer-wins rule | ||
| - [ ] 2.2 In `OTClient`: set the revision from the handshake, ack (`rev + 1`) and remote operations (`rev + 1`); stamp it on sent operations; track the in-flight operation; transform incoming operations through in-flight then queued operations and rebase them |
Contributor
There was a problem hiding this comment.
Handle Neutral as a no-op on the server while advancing the revision and acknowledging it, including when client rebasing neutralizes a queued operation. Revision stamping lets overlapping deletions produce Neutral, which currently throws and leaves the server rejecting all further operations for that document.
Address review on fix-ot-client-convergence: - An Insert transformed against a concurrent Insert that starts inside its effective range splices the other payload into its own, so the text lands twice. Transform Insert against Insert by start position only, and add regression specs for inserts at different positions. - DocumentManager throws on a Neutral operation after advancing the revision, which wedges every later operation on the document and leaves the sender unacknowledged. Treat Neutral as a no-op that is stored, advances the revision and is broadcast; OTClient counts the revision for Neutral remote operations and drops queued operations that rebasing neutralizes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TffpCm82NH5xXR1yeBew6Q
Keep this PR spec-only. Task 1.1 now adds convergence.spec.ts as part of the implementation instead of flipping tests that already exist, and the proposal no longer points at the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TffpCm82NH5xXR1yeBew6Q
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.
What
Planning only: the
fix-ot-client-convergenceOpenSpec bug change, plus a reproduction spec. This is the bottom of a stack; the data-node operations proposal sits on top of it.Why
When two clients edit concurrently, the clients and the server end up with three different documents. Four defects combine:
OTClientnever stamps a revision on the operations it sends. The server's conflict filter (op.rev >= undefined) then matches nothing, so the server never transforms any operation and applies them in arrival order.Fix (summary)
transform(against, againstIsLater = false)makes transform order explicit. Order can't be inferred from revisions, because remote ops reach the undo stacks rebuilt from model events and carry none.Notes for review
packages/ot-server/src/convergence.spec.tsis the reproduction. It runs twoOTClients against a realDocumentManager, and its three tests are markedit.failingso CI stays green until the fix lands; task 1.1 flips them back toit. A throwaway prototype of the fix made all three pass. Only one existing spec changes under it: the one pinning "the other op has no revision → Neutral".🤖 Generated with Claude Code