Repository navigation
Conversation
subscribePresence() is deferred behind authenticate().then(), while the presence manager sends its first update (and reSubscribeAll() its rebroadcast) synchronously. The update reached the server ahead of the subscribe frame and was dropped as 'presence update from non-subscriber'. Hold presence updates for a drive while its subscribe is pending and send them right behind it. Nothing is held before authentication, and a withdrawn subscription drops what was held, so the server's subscribe-time read check stays the only gate.
Member
Author
|
Trekmeester: included in batch #1966 (run 36898843808). It lands when that run is green; if this PR breaks something there, I take it out and say why here. |
Member
Author
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.
Requested by Joep · project thread
Before: the first presence update on a connection (and the rebroadcast after authentication or reconnect) went out ahead of
PRESENCE_SUBSCRIBE, so the server loggedpresence update from non-subscriberand dropped it. Only the 10 second heartbeat recovered it.After: the update is held until the subscribe frame is on the wire and sent right behind it.
subscribePresence()defers its frame behindauthenticate().then(...)(a microtask at best), whileDrivePresenceManagerandreSubscribeAll()send synchronously.WSClientnow keeps a short per-drive hold (max 16 updates) while a subscribe is pending. Nothing is held before authentication (the existing "no presence before auth" rule is unchanged), andunsubscribePresence, an identity change or a failed handshake drop what was held. The server's subscribe-time read check stays the only gate; no server change.How: three frame-level tests in
websockets.test.ts. The first two fail on develop (update precedes subscribe) and pass now; the third covers withdrawal. Full lib suite (1090 tests),tsc -b, oxlint and oxfmt pass. Not run here:pnpm run -r lintand the browser two-tab test (the full workspace install is blocked in this container), so a Mancave run is still needed.Generated by Claude Code