Skip to content

Ignore handshake validation failures after the server transport closes - #432

Merged
Armster15 merged 1 commit into
mainfrom
fix-consumed-handshake-rejection
Oct 21, 2026
Merged

Armster15 merged 1 commit into
mainfrom
fix-consumed-handshake-rejection

Conversation

@Armster15

Copy link
Copy Markdown
Contributor

Why

Fix a regression from #427: if custom handshake validation rejects after the server transport closes, handling that rejection reads a consumed session and causes an unhandled rejection.

What changed

Return early from the validation catch when the pending session has already been consumed. Normal validation failures still use the existing rejection path.

Add one public-boundary regression test that pauses validation, closes the server transport, and rejects validation. It checks that the server stays closed with no pending or connected sessions and never emits a connected transition. Vitest also fails the run on any unhandled rejection.

Validation:

  • Red proof with only the guard removed: exit 1; Vitest caught 1 unhandled error, with getting loggingMetadata on consumed state.
  • Full suite: 36 files passed; 804 tests passed, 1 skipped.
  • npm run check: passed TypeScript, Prettier, and ESLint.

Versioning

  • Breaking protocol change
  • Breaking ts/js API change

No protocol or API change.

~ written by ⠕ Replit

Closing the server transport consumes sessions whose handshake validation is still pending. Ignore a later validation rejection before reading the session so shutdown cannot cause an unhandled rejection. Keep normal validation failures on the existing rejection path.

Assisted-by: Replit
@Armster15
Armster15 marked this pull request as ready for review October 21, 2026 22:59
@Armster15
Armster15 requested a review from a team as a code owner October 21, 2026 22:59
@Armster15
Armster15 requested review from daweifeng-replit and rileyjones-dev and removed request for a team and rileyjones-dev October 21, 2026 22:59
@Armster15
Armster15 enabled auto-merge (squash) October 21, 2026 22:59
@Armster15
Armster15 merged commit 74ccb65 into main Oct 21, 2026
9 checks passed
@Armster15
Armster15 deleted the fix-consumed-handshake-rejection branch October 21, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants