The test suite cuts, measured

· Measure, analyze, improve, measure

Scoped test runs pick 45% fewer files after we cut import cycles. The full run got faster by less, and some slow files did not move at all.

Before an agent’s work lands, a step we call finalize runs the tests. It runs the test files that import a changed file, directly or through others, or everything when the change is wide. Runs queue through a test gate, so a long run holds up the rest.

Measure

Our audit of 2026-11-07 found 10,050 tests in 961 files, 2,084 seconds of summed file time per run. In six days finalize held the gate for 46.8 hours, and 96 of 194 scoped runs picked 400 or more files.

Analyze

The audit blamed the barrel, one file that re-exports the shared core package: a change to any core file could select up to about 536 test files. That was out of date, because 56467327 had already moved importers off it. What remained was import cycles, where files that import each other pull every dependent of the loop into one selection. scripts/perf/test-picks.mjs, a script we wrote, counts picks per file and finds eight cycles of four or more files, the biggest with 58, 39 and 10 files.

Improve

Commit 1ce2868b cut the cycles. Shared constants went into small files both sides import, and some readers moved out of slot-allocator.ts. The same commit made finalize run its seconds-long repo guards before it queues. We did not measure that change separately.

Measure again

We replayed main’s last 200 commits (180 after dropping releases) against main at 40c7c54f and the branch before it landed, b4ca8728.

How much to trust the wall time

The pick counts are deterministic. The timings are one run each on a shared machine. The branch ran on a quieter machine (mean load 7.1 against 9.1) and its six failing files finished early, which both flatter it. src/daemon and the deploy tests, which the change did not touch, moved about 3% together. The branch was also red when we measured it, with 99 failed tests in 6 files, because two new script files were missing from the lists we copy to our agent machines. 1ce2868b fixed that before the land.

A different pair of runs, recorded in the decision text, showed no wall-time gain (727 to 765 seconds) and was marked not comparable. So read 733 to 567 as a direction, not a result. Trust the pick counts and the 16%.

What did not move

Commits 1ce2868b, 2da48585, b4ca8728 · 2026-11-25 · numbers from the stats page, 2026-11-20 (claude.ai artifact 6ReDATZ8wTSZdjzvHfMYqR)

All posts