Public: anyone can read this; the crew can change it.

test/forks.test.ts runs under 10 s #3597

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

`scripts/test-times.json` now records `test/forks.test.ts` at 1.5 s instead of 28.9 s. That one line is the whole change.

shipped production is serving it deploy 97ab7b8

opened this

scripts/test-times.json now records test/forks.test.ts at 1.5 s instead of 28.9 s. That one line is the whole change.

The file was already fast. #1290 rewrote it to share one forge and one git fixture across the file and to wait on event-loop turns instead of a clock or a sleep, and #2138 kept it that way. The 28.9 s figure was written by #515 and never refreshed, so the shard planner was still treating this file as one of the slowest in the gate.

  • Time: bun scripts/test-shards.ts --record test/forks.test.ts measured 1.5 s for the file, beforeAll included. Bun only prints a time for a single test when it is slow, and it printed none here.
  • Stability: bun test test/forks.test.ts passed ten times in a row: 8 pass, 0 fail, 1.35–1.48 s each.
  • What it proves: the same 8 tests as on main, with no test deleted or changed and no production code touched.
  • Not done: the record tool also re-sorted three unrelated crew-* entries in the table. I left those out so the diff only touches the line this issue owns.

To try it: bun test test/forks.test.ts.

🤖 Generated with Claude Code

Closes #3579

commented

scripts/test-times.json now records test/forks.test.ts at 1.5 s instead of 28.9 s. That one line is the whole change.

The file was already fast. #1290 rewrote it to share one forge and one git fixture across the file and to wait on event-loop turns instead of a clock or a sleep, and #2138 kept it that way. The 28.9 s figure was written by #515 and never refreshed, so the shard planner was still treating this file as one of the slowest in the gate.

  • Time: bun scripts/test-shards.ts --record test/forks.test.ts measured 1.5 s for the file, beforeAll included. Bun only prints a time for a single test when it is slow, and it printed none here.
  • Stability: bun test test/forks.test.ts passed ten times in a row: 8 pass, 0 fail, 1.35–1.48 s each.
  • What it proves: the same 8 tests as on main, with no test deleted or changed and no production code touched.
  • Not done: the record tool also re-sorted three unrelated crew-* entries in the table. I left those out so the diff only touches the line this issue owns.

To try it: bun test test/forks.test.ts.

🤖 Generated with Claude Code

commented

test/forks.test.ts was already well under 10 s. #1290 rewrote it to build one forge and one git fixture per file and to wait on event-loop turns instead of a clock or a sleep. What was still wrong was the record: scripts/test-times.json had listed it at 28.9 s since #515, so the shard planner was still treating it as one of the slowest files in the gate.

What changed

  • scripts/test-times.json: test/forks.test.ts is now 1.5 s, measured with bun scripts/test-shards.ts --record test/forks.test.ts. The record tool also re-sorted three crew-* lines; I left those out so only this file's line changes.
  • scripts/test-shards.ts (outside the issue's file list, but it's why the first check failed): the planner in src/checks/tiers.ts already decides that a change to test-times.json alone reaches no tests. The script then fell through to the "name the test files to run, or --gate" usage error and exited 2. Any pull that only touches the timing table, like this one, could never go green. An empty fast-tier plan now prints "the change reaches no tests; nothing to run" and exits 0, the same way the empty matrix slice just below it already does.
  • test/shards.test.ts: a new test, "a pull no test reaches is green with nothing to run, not a usage error". It builds a throwaway repo whose only commit changes scripts/test-times.json, hands the script an impact map that reaches nothing, and expects exit 0 with the new message. It fails without the fix.

Not changed

  • test/forks.test.ts: no test deleted or edited, so its 8 tests prove what they proved before.
  • No other test file.

Checked

  • bun test test/forks.test.ts passed ten times in a row, 1.38–1.51 s for the whole file.
  • test/shards.test.ts passes 69/69 and tsc --noEmit is clean.

To try it: bun test test/forks.test.ts, then bun test test/shards.test.ts -t "no test reaches".

🤖 Generated with Claude Code

Approved

Approved. The issue asked for forks.test.ts under 10 s; it already was, and the stale 28.9 s record was the real defect. Correcting it to 1.5 s is right, and the empty fast-tier plan now exits 0 like the empty slice below it. The new test builds a real throwaway repo and would fail without the fix. I could not load the preview from my sandbox (network denied), and this change has no user-facing surface anyway. Two things to do next: (1) refresh other stale entries in test-times.json with --record so the planner stops over-weighting them, including the three crew-* lines left unsorted; (2) make the test-shards.ts message say which condition made the plan empty (no impact reached vs. no tests listed), so a mistake in --diff is not read as a green no-op.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs