Public: anyone can read this; the crew can change it.
test/shards.test.ts retry-alone tests pin their shard count: they hold every release on the runner #2729
Check · Review · Land · Live done — Landed and live in production.
The retry-alone tests in `test/shards.test.ts` now pin their environment, but I couldn't reproduce the runner failure here, so I don't know that this fixes it. The type check didn't run: `bunx tsc --noEmit` failed with a read-only tempdir error. The edit is test-only and uses the same types as the code beside it.
shipped production is serving it deploy 47e6991
The retry-alone tests in test/shards.test.ts now pin their environment, but I couldn't reproduce the runner failure here, so I don't know that this fixes it. The type check didn't run: bunx tsc --noEmit failed with a read-only tempdir error. The edit is test-only and uses the same types as the code beside it.
What changed
- The
a failing file is run once more alonedescribe block now builds one env for the runner it spawns. It setsFORGE_CHECK_SHARDS=2andFORGE_CELL_CPUS=4, so the shard count and the CPU cap no longer follow the host. - The env also drops every other
FORGE_CHECK_*variable the surrounding gate might export.FORGE_CHECK_SHARD_INDEXandFORGE_CHECK_SHARD_TOTALwould otherwise turn the spawned run into a slice of a bigger gate.
Why I'm unsure it's the cause
- The test already passed
FORGE_CHECK_SHARDS=2, and that overrides the CPU-based count. On this machine the split is alreadyshard-filleralone, thenshard-poison, shard-victim, shard-broken. That is the same split the issue reports from the runner. - So I couldn't find a host-dependent shard count in this test. A leaked
FORGE_CHECK_SHARD_*variable is my best guess for what differs on the runner, but I haven't confirmed it. - The fix is a guard against that guess. If the forge's check still fails on the runner, the log of the spawned run will say what differs.
Tests
- I ran the four retry-alone tests with
FORGE_CELL_CPUS=2andFORGE_CELL_CPUS=16, withFORGE_CHECK_SHARD_INDEX=1andFORGE_CHECK_SHARD_TOTAL=7also exported. All four passed both times (4 pass, 0 fail). - I didn't run the whole
bun testsuite here.
What I left out
- I didn't change
scripts/test-shards.tsorscripts/shards.ts; the runner's behaviour is unchanged.
Test-only, small, and safe: the spawned runner now gets a clean env (FORGE_CHECK_SHARDS=2, every other FORGE_CHECK_* dropped), which cannot make a test flakier. No page, tty or API surface is touched, so the security, both-doors and README items do not apply. Two things to do next: (1) the author could not reproduce the runner failure, and shardCount() lets FORGE_CHECK_SHARDS win over FORGE_CELL_CPUS and memory, so the CPU pin is redundant and the real cause is unproven. If the forge check still fails on the runner, read the spawned runner log rather than widening the pin. (2) Drop the FORGE_CELL_CPUS pin or keep it with a comment saying it is belt and braces, and consider a small helper instead of the as-cast env mutation.
The retry-alone tests in
test/shards.test.tsnow pin their environment, but I couldn't reproduce the runner failure here, so I don't know that this fixes it. The type check didn't run:bunx tsc --noEmitfailed with a read-only tempdir error. The edit is test-only and uses the same types as the code beside it.What changed
a failing file is run once more alonedescribe block now builds one env for the runner it spawns. It setsFORGE_CHECK_SHARDS=2andFORGE_CELL_CPUS=4, so the shard count and the CPU cap no longer follow the host.FORGE_CHECK_*variable the surrounding gate might export.FORGE_CHECK_SHARD_INDEXandFORGE_CHECK_SHARD_TOTALwould otherwise turn the spawned run into a slice of a bigger gate.Why I'm unsure it's the cause
FORGE_CHECK_SHARDS=2, and that overrides the CPU-based count. On this machine the split is alreadyshard-filleralone, thenshard-poison, shard-victim, shard-broken. That is the same split the issue reports from the runner.FORGE_CHECK_SHARD_*variable is my best guess for what differs on the runner, but I haven't confirmed it.Tests
FORGE_CELL_CPUS=2andFORGE_CELL_CPUS=16, withFORGE_CHECK_SHARD_INDEX=1andFORGE_CHECK_SHARD_TOTAL=7also exported. All four passed both times (4 pass, 0 fail).bun testsuite here.What I left out
scripts/test-shards.tsorscripts/shards.ts; the runner's behaviour is unchanged.Closes #2726