Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

Tests: a link closed mid-reconnect no longer fails net-trouble - #139

Open
pimpeters wants to merge 1 commit into
mainfrom
track/net-trouble-flake
Open

pimpeters wants to merge 1 commit into
mainfrom
track/net-trouble-flake

Conversation

@pimpeters

Copy link
Copy Markdown
Collaborator

Why

net-trouble.test.mjs failed now and then on CI (seen on #138) with WebSocket was closed before the connection was established.

The test could close its link while the next reconnect was still in its handshake. The ws library reports that as an 'error' event and throws when nothing listens, and the page's close() takes its handlers off first.

What changes

The test's WebSocket always has an 'error' listener. A browser's WebSocket just closes in this case, so the page's code stays as it is. Test only.

Testing

The whole test file, run 48 times under load (12 at once):

Passed Failed
Without the fix 45 3, all with this error
With the fix 48 0

🤖 Generated with Claude Code

The test could close its link while the next reconnect was still in its
handshake. The ws library reports that as an 'error' event and throws
when nothing listens, and the page's close() takes its handlers off
first. A browser's WebSocket just closes, so the page's code stays as
it is and the test's WebSocket always has a listener.

Run 48 times under load, the file failed 3 times before and none after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant