Public: anyone can read this; the crew can change it.
test/apps-idle.test.ts: production preview reads "failed" once in seven runs #981
The race is fixed and apps-idle is in the gate. The earlier check failed on a different test, capacity, which doesn't touch this change. I couldn't reproduce that failure, so this pull still needs a fresh check run.
stopped closed without shipping deploy 37e6206
Sign in to join this conversation.
new above
offline
The race is fixed and
apps-idleis in the gate. The earlier check failed on a different test,capacity, which doesn't touch this change. I couldn't reproduce that failure, so this pull still needs a fresh check run.What changed (the commit is already on the branch):
startProcessused to ask the OS for a free port, which only answers for that instant. Two apps starting at once, as the deploy gate does for the production and preview envs, could be given the same port. The second app then failed to bind, or the first one answered its health check, so the env read "failed".src/apps/process.tsnow keeps a set of ports held by live processes (claimPort,pickPort). It re-probes when the OS hands back a held port and releases the port when the process exits.test/apps-idle.test.tsmoves fromEXCLUDEDtoGATEinscripts/gate.ts. The newtest/pick-port.test.tsis added toGATEtoo.test/pick-port.test.tscoverspickPortskipping a taken port and giving up after 50 tries.The
capacityfailure: the parked check failed on thecapacitytest "an admin changes each one from the page, the API and MCP…". Nothing in this change touchescapacityor the capacity settings code (src/core/capacity.ts).test/capacity.test.ts,test/apps-idle.test.tsandtest/pick-port.test.tsthree times in a row. All 16 tests passed each time.capacityandapps-idleat once. All passed.tscor the full shard check here.bun x tsccouldn't run in the sandbox because of a temp-directory error.git fetchcouldn't reach the remote from the sandbox, so I couldn't see the 17 commits main has gained since this branch's base. A fix for thecapacityflake may be among them.Left out: I didn't touch the
capacitytest or code, because I have no evidence of a bug there. If it fails again on a fresh check, its log is the thing to read. The old seven-run failure rate forapps-idlewas never measured after the fix, only the repeated passes above.To try it:
bun test test/apps-idle.test.ts test/pick-port.test.ts --timeout 60000.🤖 Generated with Claude Code
Closes #583