refactor(transport): SSOT phase 3 — clean reconnect#440
Open
dimakis wants to merge 5 commits into
Open
Conversation
handleReconnect no longer does reattach/rekey/zombie cleanup — that's all handled by handleSendV2 on the first user message. Reconnect now only does: watch + cursor replay + suspend resume + boot context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Periodic sync (5s timer retrying missed events) is redundant now that reconnect replays via EventStore cursor on welcome. Removes setEventStore, startPeriodicSync, stopPeriodicSync, EventStoreAdapter interface, and all associated tests and wiring. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reconnect POST no longer defers _connected — the client marks connected immediately on welcome. handleSendV2 handles ownership on first message, and replayed events arrive via SSE regardless of POST outcome. Removes doReconnectPost, scheduleReconnect, reconnectTimer, and reconnectDelayMs. Replaces 12 deferred/stale/failure tests with 4 fire-and-forget tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reconnect is REST-only — keep the schema export for the REST handler but exclude it from IncomingWsMessageV2. The WS dispatcher already ignores it with a comment explaining why. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tion Stale session test now asserts remove is NOT called (deferred to handleSendV2). Suspend resume test clears reattachChat mock to avoid bleed from prior tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
handleReconnect— reattach/rekey/zombie cleanup removed (~60 lines).handleSendV2already handles all of this on the first user message, making it redundant on reconnect.ConnectionRegistrythat retried missed events is eliminated (~130 lines). Cursor-based replay on welcome covers the gap._connecteduntil the reconnect POST succeeds (~100 lines). Connection is marked immediately on welcome; the POST is advisory.ReconnectMessagefrom WS union — reconnect is REST-only, not dispatched via WebSocket.Net: -1,043 lines across 9 files. All 177 affected tests pass.
Context
Phase 3 of the Transport SSOT series (P0 #431, P1 #433). The reconnect "ownership dance" duplicated logic already handled by
handleSendV2on the first user message. Periodic sync was a safety net made redundant by cursor replay on welcome.What's kept
/reconnectREST endpoint +handleReconnecthandler (watch + cursor reset + EventStore replay + boot context + suspend resume)doPost('reconnect', ...)on welcome (fire-and-forget)ConnectionRegistry.resetCursor()and cursor tracking inbroadcast()Test plan
npx vitest run— all 177 tests pass (ws-handler-v2, connection-registry, sse-connection)🤖 Generated with Claude Code