fix(mutation): measure each kernel against the tests that import it

Merged
TH
11h ago
+337-223

Summary

Mutation Weekly failed because shard kernel-errors-4 exceeded its 22-minute step. The cause is structural. A kernel's test scope was every test that transitively reaches its sources. Nearly every test reaches errors.ts, so the scope was 1,471 files, 75 more than the week before. Every shard replays the full scope in its 8–11 min dry run, so more shards cannot bound it.

  • A test owns a kernel only when its own code or its test-local support code imports one of the kernel's mutated sources, directly or through a barrel re-export. It must also be collectable by the lane: apple-runner tests now join MUTATION_EXCLUDED_TESTS. The weekly scope and PR-lane selection share this rule, and Vitest related discovery is removed.
  • chore(gates): a unit-suite test fails any PR that grows a kernel's scope past MAX_MUTATION_TEST_SCOPE_FILES (600). The failure lands on that PR instead of the next Sunday run.

Scopes: kernel-errors 1,473→431, selectors 695→86, snapshot-occlusion 414→29. 13 files. No issue.

Validation

  • pnpm check:affected --run --head 3a2915a5f7: passed, exactCommit=true.
  • pnpm mutation:test: 73/73. Planted cap 400: the budget test fails naming kernel-errors; at 600 it passes.
  • All kernel scopes (528 files) pass under vitest.mutation.config.ts.
  • Weekly sweep at e61cba5, before support-code ownership; rerun at this head pending: 18/18 shards plus report passed in 8.5 min. The slowest kernel-errors shard took 7.6 min (previously 11–22, timed out). Scores fall where only distant tests killed mutants: kernel-errors 84.4→77.9%, selectors 71.4→66.0%, scroll-edge-state 83.2→65.4%.

🤖 Generated with Claude Code