fix(collab): two files open in one browser no longer mix - #259
Merged
Merged
Conversation
y-websocket keys its cross-tab BroadcastChannel on serverUrl + "/" + roomname and nothing else — the query params are not in it. The client passed one fixed room name for every file with the path tucked into params, so every editor open in the same browser shared one channel and applied each other's Y.Doc updates. Two different files in two tabs mixed into each other. The channel is disabled: the hub holds the document and is the one source of truth, and a tab-to-tab side channel is a second path for the same bytes. The room name carries the path anyway, so if the channel is ever re-enabled it is keyed correctly. The comment that said the room name was decoration was mine. It was decoration to the server. It was the whole identity of the document to the browser. Gate: two tabs in ONE context (BroadcastChannel is per profile, so two contexts cannot reproduce it), two files, type in one, assert the other is untouched. Run both ways: against the previous bundle it fails with "text typed into alpha appeared in beta … two documents are sharing one channel"; with the fix it passes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ssowonny
force-pushed
the
fix/collab-broadcastchannel-crosstalk
branch
from
September 23, 2026 06:32
1189743 to
3bd3631
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.
TL;DR
y-websocketkeys its cross-tab BroadcastChannel onserverUrl + "/" + roomnameand nothing else. We passed"held"for every file, so every editor in one browser shared one channel and cross-applied Y.Doc updates.The comment that was wrong was mine
It said the room argument was "decoration". That was true of the server — the hub derives the room from
(project, path)after authorising the caller, and a caller who could name the room could join any project's document. It was not true of the browser, where the name is the entire identity of the document to the tab-to-tab channel. The comment now says both halves.The test needed one specific thing to be honest
Two tabs in one
BrowserContext. BroadcastChannel is per origin per profile; two Playwright contexts are two profiles and can't hear each other, so a test built onnewContext()passes against the bug. The spec says so in its header, so the next person doesn't "fix" it into a vacuous one.Scope
One line of behaviour (
disableBc: true+ path-keyed room name), one spec, rebuiltstatic/. Nothing on the hub side.🤖 Generated with Claude Code