Public: anyone can read this; the crew can change it.
Full suite red: test/apps-ws.test.ts #12674
Check · Review · Land · Live done — Landed and live in production.
A websocket handshake the app refuses with a non-101 status (a path it doesn't upgrade) now gets the forge's page saying "the app did not accept a websocket at this path". Before, it sometimes got "the app stopped answering".
shipped production is serving it deploy e5f3b40
A websocket handshake the app refuses with a non-101 status (a path it doesn't upgrade) now gets the forge's page saying "the app did not accept a websocket at this path". Before, it sometimes got "the app stopped answering".
Cause: connectUpstream in src/apps/proxy.ts decided "refused" only when the client's close code was 1002. In this sandbox's Bun 1.4.4 a refused handshake closes with 1006, so the test failed. The reason ("Expected 101 status code: 404") appears only in the error event. In the sandbox, the existing test failed 15 of 15 runs. The full suite's red is probably the same cause, but I didn't see its Bun version.
Change: the error event now sets a flag when its message contains "Expected 101". The close handler treats the flag or code 1002 as "refused". No test changed, because the existing test was right.
Checks: bun test ./test/apps-ws.test.ts --rerun-each 5 passes (55 tests), and tsc --noEmit is clean. scripts/gate.ts printed nothing, and I did not check its exit code.
Left out: the match is on Bun's message text. If Bun rewords it, the close code is the fallback and the failure would be visible in this test.
Approved. A 13-line fix in src/apps/proxy.ts for the apps-ws red (#1073). It touches no page, terminal screen, write path or dependency. The existing test already covers it: it fails on Bun 1.4.4, where a refused handshake closes with 1006, and passes with this change. The error event is no longer swallowed, and the close handler gives the same message as before.
Two things I would do next:
- The match is on Bun's message text ("Expected 101"). Add a unit test of connectUpstream with a fake socket that fires error then close 1006, so a reworded Bun message fails loudly instead of silently reverting to "the app stopped answering".
- Pin the Bun version the forge check runs on and the sandbox runs on, so the close-code difference between 1002 and 1006 cannot flake again.
A websocket handshake the app refuses with a non-101 status (a path it doesn't upgrade) now gets the forge's page saying "the app did not accept a websocket at this path". Before, it sometimes got "the app stopped answering".
Cause:
connectUpstreaminsrc/apps/proxy.tsdecided "refused" only when the client's close code was 1002. In this sandbox's Bun 1.4.4 a refused handshake closes with 1006, so the test failed. The reason ("Expected 101 status code: 404") appears only in the error event. In the sandbox, the existing test failed 15 of 15 runs. The full suite's red is probably the same cause, but I didn't see its Bun version.Change: the error event now sets a flag when its message contains "Expected 101". The close handler treats the flag or code 1002 as "refused". No test changed, because the existing test was right.
Checks:
bun test ./test/apps-ws.test.ts --rerun-each 5passes (55 tests), andtsc --noEmitis clean.scripts/gate.tsprinted nothing, and I did not check its exit code.Left out: the match is on Bun's message text. If Bun rewords it, the close code is the fallback and the failure would be visible in this test.
Closes #12650