fix(client): clear connectPromise and re-arm reconnect on failed open#12
Merged
Conversation
A socket that never OPENED fires no close event, so the close-handler recovery can't run; the cached rejected connectPromise then wedges the transport — every later connect() returns the same rejection. On failed open, clear it and re-arm the reconnect (inline, mirroring the close handler) while subscriptions are live. Adapted for main: inlines the reconnect schedule rather than calling feat/ssr's extracted scheduleReconnect() (which does not exist on main). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 13, 2026
Merged
grrowl
added a commit
that referenced
this pull request
Jun 13, 2026
Bug-fix batch from the deep-audit follow-up (audit-excluded SSR topic aside): client reconnect-wedge fix (#12), wire-input hardening + error sanitization (#15, ADR-0012), catch-up N+1 batching (#14), plus expanded error/wire test coverage (#11) and dead-code/identifier-quoting cleanup (#13). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
grrowl
added a commit
that referenced
this pull request
Jun 13, 2026
- transport: express the failed-open reconnect recovery (#12) via the existing scheduleReconnect() rather than the inline form main carried (main had no such method; feat/ssr does) — same behavior, one path. - regenerate package-lock against the merged package.json (0.4.0-dev.0, vendored PR-1564 tarballs). The 0.3.2 fixes (#11–#15) now coexist with the SSR feature: readSyncSnapshot + readChangesSinceFor + wire guards in sync-do; highWaterSeq + per-table indexed reads + quoted trigger DDL in changes; ADR index carries 0011+0012. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
grrowl
added a commit
that referenced
this pull request
Jun 13, 2026
- transport: express the failed-open reconnect recovery (#12) via the existing scheduleReconnect() rather than the inline form main carried (main had no such method; feat/ssr does) — same behavior, one path. - regenerate package-lock against the merged package.json (0.4.0-dev.0, vendored PR-1564 tarballs). The 0.3.2 fixes (#11–#15) now coexist with the SSR feature: readSyncSnapshot + readChangesSinceFor + wire guards in sync-do; highWaterSeq + per-table indexed reads + quoted trigger DDL in changes; ADR index carries 0011+0012. Co-Authored-By: Claude Fable 5 <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.
Lands plan-002's reconnect-wedge fix on main (0.3.2 patch).
Bug (present on main): a WebSocket that never
open()s fires nocloseevent, so the close-handler's auto-reconnect can't run. The cached rejectedconnectPromisethen wedges the transport permanently — every laterconnect()returns the same rejection. The client never recovers from a single failed initial attempt while subscriptions are live.Fix: on a failed open, clear
connectPromiseand re-arm the reconnect (inlined, mirroring the existing close-handler) while subscriptions remain. No double-scheduling: a socket that fails to open fires noclose, so only this path runs; an opened-then-dropped socket runs only the close handler.Main-adaptation: inlines the reconnect schedule rather than calling feat/ssr's extracted
scheduleReconnect()(which doesn't exist on main).TDD red→green pinned by
tests/reconnect-recovery.test.ts(2 cases). Validated on main + published @tanstack/db 0.6.5: typecheck + full suite (153 passed) + build green. Supersedes feat/ssr PR #5.🤖 Generated with Claude Code