Repository navigation
Fix the WebSocket close-handshake test race and run it in CI again - #60
Merged
Merged
Conversation
The two real-handshake cases closed the socket as soon as it opened. Node's built-in WebSocket client reports 1006 when it closes while the server's first frame is still arriving; the ws client gets a clean 1000 against the same workerd server, so the race was the client's. They were skipped under CI on the theory that containers can't run them. Close after the first server frame instead, as a real client would, and drop the CI skip: they now pass repeatedly in a container, with and without CI=true. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LkjKD3QZivr3Qr2cKdjfbz
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.
tests/websocket-lifecycle.test.tshas two cases that drive a real close handshake against workerd (Miniflare). They were skipped underCIbecause they failed in containers with code 1006 instead of a clean 1000.Root cause
The test closed the socket right after
open. Probing the same server with two clients, closing immediately:WebSocket(undici)ws8.21Closing 200 ms after open was clean for both. So the server's close handshake is fine. Node's built-in client reports 1006 when it closes while the server's first frame (the presence count / room state) is still arriving.
Fix
process.env.CIskip and update the comment, so CI exercises these again.Testing
CI=true.🤖 Generated with Claude Code
https://claude.ai/code/session_01LkjKD3QZivr3Qr2cKdjfbz
Generated by Claude Code