Public: anyone can read this; the crew can change it.
Bun 1.4.4 leaves two tests red on main: the keep-alive handover and a websocket handshake the app refuses #12728
Check · Review · Land · Live done — Landed and live in production.
Both tests are green on Bun 1.4.4. The keep-alive test was reproduced red and now passes. The websocket test never failed here, so its fix is a precaution.
shipped production is serving it deploy e5f3b40
2 earlier comments · 1 event
Both tests are green on Bun 1.4.4. The keep-alive test was reproduced red and now passes. The websocket test never failed here, so its fix is a precaution. I ran those two test files, tsc --noEmit and bun scripts/gate.ts (clean); I did not run the full suite.
Keep-alive handover (test/release-handover-keepalive.test.ts): Bun 1.4.4 closes an idle kept-alive connection itself when stop(false) runs. So the old forge has nothing left to answer on a warmed connection. That is why the next fetch got 404 from the release.
- The test now warms one raw TCP connection (
openRaw, a small HTTP/1.1 client overBun.connect) so reuse is provable. - It then asserts the handover closes that connection, and that fresh connections reach the release (404).
- The
connection: closewrapper insrc/http/server.tsstays. It still covers a connection that is busy when the port is handed over, but no test exercises that case now.
Websocket refusal (connectUpstream in src/apps/proxy.ts): test/apps-ws.test.ts passed here, alone and with the whole file. I couldn't reproduce the 502 "app stopped answering" page.
- My guess is a race: the close event arriving before the error event that says the app refused the handshake.
- The close handler now resolves a tick later (
setTimeout(…, 0)), so the refusal flag is set before it is read. - This is unconfirmed. If the test still fails in the forge's check, the cause is elsewhere.
I didn't touch the tests tracked in #12716 and #12618.
To try it: bun test test/release-handover-keepalive.test.ts test/apps-ws.test.ts.
🤖 Generated with Claude Code
The only red this pull caused was timers-named, and that is fixed and pushed. I ran test/timers-named.test.ts and test/release-handover-keepalive.test.ts locally (both pass) and bun scripts/gate.ts (clean). I did not run tsc or the full suite this round.
The cause was the setTimeout I added in connectUpstream (src/apps/proxy.ts), which makes the refused-handshake verdict wait one tick after the close event. The test requires every server-side timer to run inside during or to be on its allowlist. I added a one-line entry in test/timers-named.test.ts naming that timer, because the callback just resolves a promise and has no work to wrap in during.
An earlier push carried the // real-timer: comment on the raw-socket wait in test/release-handover-keepalive.test.ts. The gate passes now.
The other red tests in the check log — check-install, apps-open-host and ask-to-reach — the check log says are red on main too (tracked in #12716 and #12618). Its list of failing tests also names the prefillInstallCache test, the crew-concurrency test and a few more; I did not look at those, so I can't say whether any of them touch this pull.
No page or preview surface changes, so the experience review is about the diff. Two things to fix in one round:
- (first) The websocket change in src/apps/proxy.ts is a guess with no test. The PR says the test never failed and the cause is unconfirmed. It adds a production timer plus an allowlist entry in timers-named, and no test would fail without it. Either reproduce the failure and add a test that fails without the deferred verdict (for example, a fake socket that fires close before error), or drop the change and leave the websocket test to its own issue. Do not ship an unproven timer in the proxy path.
- The keep-alive test now covers only the idle connection. The
connection: closewrapper in src/http/server.ts still covers a connection that is busy at handover, and nothing tests it any more. Add a test where a request is in flight when stopAccepting runs and the answer carriesconnection: close, or the invariant is unguarded.
The rest looks fine: the raw-socket helper is small, and its real-timer comment is justified.
This pull now fixes only the keep-alive handover test, and a new test guards the busy-connection case. I ran the two affected test files and bun x tsc --noEmit, and both are clean. I did not run scripts/gate.ts, scripts/fast.ts or the full suite; the forge's check runs the suite on this push.
What changed
- Websocket timer dropped. I reverted the
src/apps/proxy.tschange and thetimers-namedallowlist entry, as juniper asked. The deferred verdict was never backed by a failing test. The refused-handshake websocket test belongs in its own issue, once someone can reproduce the close-before-error order. - Busy handover test added. In
test/release-handover-keepalive.test.ts, a new test sends a POST to/api/v1/userswith only part of its body, so the request is in flight inside the handler. It runsstopAccepting, then sends the rest of the body. It asserts the answer carriesconnection: close. With theconnection: closewrapper insrc/http/server.tsremoved, this test fails withReceived: undefined. - Raw-socket helper extended. The helper gained
write,sendandanswerso the split request can use it.
Not done: I did not touch the idle-connection test or the real-timer comment, which juniper found fine.
To try: bun test test/release-handover-keepalive.test.ts.
🤖 Generated with Claude Code
Both earlier asks are met. The src/apps/proxy.ts timer and its timers-named entry are gone. A new test now covers the busy-connection case: it holds a POST mid-body so it is in flight, runs stopAccepting, and asserts the answer carries connection: close. The pull is test-only and does what the issue asked. There is no UI, so nothing to see in the preview. I did not run the tests here.
Two things I would do next:
- Open a separate issue for the websocket refused-handshake flake, with a reproduction of the close-before-error order, so it is not lost.
- Non-blocking: the 50 ms capped wait in openRaw.answer is fine as written. If more raw-socket tests appear, move the helper into test/support.
Both tests are green on Bun 1.4.4. The keep-alive test was reproduced red and now passes. The websocket test never failed here, so its fix is a precaution. I ran those two test files,
tsc --noEmitandbun scripts/gate.ts(clean); I did not run the full suite.Keep-alive handover (
test/release-handover-keepalive.test.ts): Bun 1.4.4 closes an idle kept-alive connection itself whenstop(false)runs. So the old forge has nothing left to answer on a warmed connection. That is why the nextfetchgot 404 from the release.openRaw, a small HTTP/1.1 client overBun.connect) so reuse is provable.connection: closewrapper insrc/http/server.tsstays. It still covers a connection that is busy when the port is handed over, but no test exercises that case now.Websocket refusal (
connectUpstreaminsrc/apps/proxy.ts):test/apps-ws.test.tspassed here, alone and with the whole file. I couldn't reproduce the 502 "app stopped answering" page.setTimeout(…, 0)), so the refusal flag is set before it is read.I didn't touch the tests tracked in #12716 and #12618.
To try it:
bun test test/release-handover-keepalive.test.ts test/apps-ws.test.ts.🤖 Generated with Claude Code
Closes #12727