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

Fast checks: compare `bun test --changed` with the impact map on the last 50 pulls, keep whichever never missed a red #2066

Merged opened this

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

Merged

I added a replay script and the comparison, but I did not change `check.fast` in `forge.json`. Neither pick met "never missed a red", so there is nothing to switch to. The type check and `test/changed-compare.test.ts` plus `test/check-tiers.test.ts` pass; I did not run the whole check.

shipped production is serving it deploy 1018b7a

opened this

I added a replay script and the comparison, but I did not change check.fast in forge.json. Neither pick met "never missed a red", so there is nothing to switch to. The type check and test/changed-compare.test.ts plus test/check-tiers.test.ts pass; I did not run the whole check.

What changed

  • scripts/compare-changed.ts replays the last 50 merged pulls. For each it takes the squash commit against its parent, the test files red in that pull's check logs, the fastSet pick, and the bun test --changed=<parent> pick from a detached worktree at that commit.
  • src/checks/changed_compare.ts holds the parsing and the verdict, and test/changed-compare.test.ts covers it. The test is added to the gate list.
  • Changes bun can't judge by imports (forge.json, bun.lock, fixtures, scripts/, anything that isn't source) make the --changed pick the whole gate. Prose and the two gate tables don't.
  • Run it with FORGE_URL=… FORGE_TOKEN=… bun scripts/compare-changed.ts [--pulls 50] [--map <impact map>].

Result

fast tier--changed
reds missed76
total tests picked57548563

Both miss reds on 30 compared pulls. Of the 50, 20 were left out because their squash commit changes nothing against its parent (the work landed in an earlier commit). The fast tier picks fewer tests (about 190 per pull against about 285 for --changed) but is no safer. Rows with misses:

pullchangedfast set--changed setredsfast missed--changed missed
#19502112402pull-variants, rehearsalrehearsal
#193932362292schema-additiveschema-additive
#192632402552schema-additiveschema-additive
#192422332553flake, schema-additiveflake, schema-additive
#188722362482data-homedata-home

I read most of these misses as tests that go red without any import from the changed files. schema-additive misses on all three pulls it appears in, and --changed misses the same ones, so a smaller or different pick will not fix it. Those would need to be always-run tests in the fast tier.

The other 25 compared pulls missed nothing under either pick. #2018 is one example (283 fast, 328 --changed). The full per-pull table comes from the script.

Limits

  • The impact map of each day isn't kept, and none was available in the sandbox, so the fast pick here is the import-guess fallback. Run with --map <today's map> for a closer replay.
  • Reds come from the logs of the pull's own check runs and the land gate on its squash commit.

Closes #2056

Approved

Approved. The issue asked for a table and for check.fast to switch only to a pick that never missed a red. The pull has the table, and neither pick qualifies (fast missed 7, --changed missed 6), so leaving forge.json alone is the honest outcome. The parsing is small and pure, and the tests cover each function and the verdict branches. I added no preview checks: this is a dev script with no page, API or terminal surface and takes no user input. Two things to do next: (1) Open an issue to make the tests that go red without an import (schema-additive, flake, data-home, rehearsal) always-run in the fast tier, then rerun the script to see whether either pick reaches zero misses. (2) Say in the README how to run scripts/compare-changed.ts and that it needs a --map. In the script, replace the any payloads from get() with a small typed shape, and check the HTTP status before parsing JSON or caching a log, so an error body is never cached as a log.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs