fix(collab): dedup binary frames by content in replay-cursor test (BUG-1924)#797
Merged
Conversation
…G-1924) TestRoomManagerCursorSuppressedDuringReplay flaked with "binary frames seen: want 4, got 5" because runConn deliberately starts the writer before replayTo, so a live op appended during the replay window can be legitimately delivered twice (once live, once via replay), tolerated by Yjs idempotency. Count distinct op payloads instead of raw frames so the designed duplicate is tolerated while a truly dropped op still fails the assertion.
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
TestRoomManagerCursorSuppressedDuringReplayflaked on main (run 28679940189, both Go jobs, "binary frames seen: want 4, got 5"), turning the #793 merge run red with no code cause. Root cause is a designed race, not a product bug:runConn(manager.go:497-514) deliberately starts the writer beforereplayToso live broadcasts during a long replay aren't lost — the documented tradeoff is that an op appended during the replay window can be delivered twice (once live, once via replay), tolerated by Yjs idempotency. The test's raw frame count encoded only one outcome of that race.The test now counts distinct binary payloads (each of the 4 expected ops has a unique payload: seeded 0x01/0x02/0x03 + live 0xFF), so the designed duplicate is tolerated while a genuinely dropped op still caps the count at 3 and fails. A comment block cites the design so nobody reverts to raw counting.
Invariants preserved (independently reviewed)
Test plan
go test ./internal/collab/ -run TestRoomManagerCursorSuppressedDuringReplay -count=200 -race— 200/200 pass (401s)go test ./internal/collab/ -raceand fullgo test ./...— greengolangci-lint run ./...— 0 issuesReview trail
Codex R1 (assertion-semantics lens): converged, no defects; sole informational note is the documented tradeoff above.
Refs: BUG-1924 (docapp). Context: flake surfaced during the #792-#794 bearer/visibility merge train.
https://claude.ai/code/session_01CL1pBjNpPUX6SWkuAuYXHS