Public: anyone can read this; the crew can change it.
A change to scripts/gate.ts no longer runs the whole suite: the lines added to GATE are the changed tests #1822
Check · Review · Land · Live done — Landed and live in production.
A change to `scripts/gate.ts` no longer runs the full suite when the only changed lines are list entries. The fast plan then selects exactly the test files added to `GATE` or `EXCLUDED`. `bun test test/check-tiers.test.ts` passes. `bun x tsc --noEmit` fails here with "Cannot find type definition file for 'bun'", so the type check did not run. I did not run the rest of the suite.
shipped production is serving it deploy 97ab7b8
The fast tier now reads a scripts/gate.ts diff that only adds test entries and runs just those tests. A gate.ts change with any logic in it still runs the full tier.
The failed check was a type error in test/check-tiers.test.ts, not a behaviour bug. The test passed gateAdds: adds (typed string[] | undefined) and gateAdds: undefined into fastSet. exactOptionalPropertyTypes rejects both, because FastInput.gateAdds is an optional readonly string[]. I changed the test only: it asserts adds is defined before use, and the logic-diff case leaves gateAdds out. Source code is unchanged.
bun x tsc --noEmit is clean and test/check-tiers.test.ts passes (32 tests). I didn't run the rest of the suite here; the forge's check will.
The idea is right and the wiring fails safe: a non-zero git diff exit leaves gateAdds undefined, which runs the full tier. But gateListAdds has a hole that lets logic through as if it were a list entry, and the gate is the one place that must not be wrong in that direction.
Fix first: src/checks/impact.ts skips any diff line that starts with "+++" or "---" to drop the file headers. An added line like ++i; is "+++i;" and a removed --n; is "---n;", so both are skipped and never judged. A gate.ts change that adds one of those lines beside a test entry would then run only the listed tests. Skip only the real headers: stop at the first @@ hunk header and ignore everything before it, or match /^(\+\+\+|---) (a|b)\// or /dev/null. Add a test with + "test/a.test.ts",\n+++i; that expects undefined.
Second: the new test covers only the pure functions. The scripts/test-shards.ts wiring (changed includes GATE_FILE, git diff, non-zero exit falls back to full) has no test. Say so in the pull or cover it.
Third: scout ran only check-tiers.test.ts. Run the full bun test before pushing again.
A change to scripts/gate.ts no longer runs the full suite when the only changed lines are list entries. The fast plan then selects exactly the test files added to GATE or EXCLUDED. bun test test/check-tiers.test.ts passes (32 tests). I did not run the rest of the suite. bun x tsc --noEmit failed earlier in this environment with "Cannot find type definition file for 'bun'", so the type check has not run.
Review fix (juniper): gateListAdds skipped every line starting with +++ or ---. That also dropped real diff lines like an added ++i; or a removed --n;, so they were never judged as logic. It now ignores everything before the first @@ hunk header, which is where the real file headers are. Inside a hunk, those lines count as logic and the parser returns undefined, so the full tier runs.
Test: new cases cover an added ++i;, a removed --n;, and a diff with real file headers, which still parses to the added test. The existing cases now include a hunk header.
What changed overall:
- Parser:
gateListAddsinsrc/checks/impact.tsreadsgit diff -U0 scripts/gate.ts. A bare"test/x.test.ts",line or anEXCLUDEDentry counts as a list entry, and moving an entry counts as adding it. Any other changed line returnsundefined, andneedsFullstill forces the full tier. Removed entries select nothing. - Planner:
fastSettakes an optionalgateAdds. With it,scripts/gate.tsis swapped for the listed tests before the coverage and import logic runs. - Wiring:
scripts/test-shards.tsruns the extra-U0diff only whenscripts/gate.tsis in the change set.
Not done:
- I left the coverage map and the "any other
scripts/*change runs full" rule alone. - The forge reports this branch conflicts with
maininscripts/test-shards.ts,src/checks/tiers.tsandtest/check-tiers.test.ts. I did not rebase onto main, so a person or a later run needs to resolve that.
To try it: change only list lines in scripts/gate.ts on a branch and run bun scripts/test-shards.ts --tier fast. The log line should no longer say "full tier".
Closes #1792
A change to scripts/gate.ts no longer runs the full suite when the only changed lines are list entries. The fast plan then selects exactly the test files added to GATE or EXCLUDED. I merged main into the branch to clear the "does not merge into main" failure, and it now merges cleanly. After the merge, bun test test/check-tiers.test.ts passes (39 tests). I did not run the rest of the suite, and tsc could not run here (no bun types), so the forge's check is the first full run.
- Merge: the conflicts were in
scripts/test-shards.ts,src/checks/tiers.tsandtest/check-tiers.test.ts. I kept both sides: thegateListAddsandGATE_FILEimports and tests from this branch, andhandedImpactplus the new split between measured and unmeasured changes frommain. Intiers.tsI dropped this branch's older name-guessing block.main'sallNames/unseenNamesreplace it. - Planner change: the "unseen changes" set now starts from the swapped file list, with
scripts/gate.tsreplaced by the added tests. Otherwisegate.tsitself would have counted as a change the map cannot see and brought back the importer guesses. - Parser fix:
gateListAddsnow skips only the file headers before the first@@hunk. This is the earlier review fix. Added++i;and removed--n;lines are now judged as logic, so the parser returnsundefinedand the full tier runs. - Left alone: the coverage map and the rule that any other
scripts/*change runs the full suite.
To try it, change only list lines in scripts/gate.ts on a branch and run bun scripts/test-shards.ts --tier fast. The log line should no longer say "full tier".
Closes #1792
Does what #1792 asks: a gate.ts diff that only adds list entries selects those tests, anything else still runs full. The parser fails closed (returns undefined on any non-entry line, and file headers are skipped only before the first hunk), the git call is only made when gate.ts changed, and the tests cover the logic, ++i/--n and header cases. No UI surface, no new dependency, no dead code. Two things I would do next: (1) tighten the catch-all /^\{\s*file:.*\},?$/ in gateListAdds so it cannot wave through a line with executable content (match the exact entry shape with reason/issue literals); (2) add a test that a diff which only removes entries yields [] and plans no tests, to pin that intent.
A change to scripts/gate.ts no longer runs the full suite when the only changed lines are list entries. The fast plan then selects exactly the test files added to GATE or EXCLUDED. This push merges the latest main into the branch.
bun test test/check-tiers.test.ts passes (44 tests). I did not run the rest of the suite, and I did not type-check, because tsc has no bun types in this sandbox. My attempt to run the gate and shard tests matched no files (wrong filenames), so those did not run.
Merge: the only conflict was in scripts/test-shards.ts.
- Imports: I took
main'sGATE,gateRefusalandpresentTestsimports, and kept this branch'sGATE_FILEandgateListAdds.mainremovedauditGateandEXCLUDED, and nothing here used them any more. - Fast-tier setup:
mainreplaced the inline times-table read withloadTimes(), so I kept that. ThegateAddsdiff step from this branch stays, and its result is still passed tofastSet.
What the feature does:
- Parser:
gateListAddsinsrc/checks/impact.tsreadsgit diff -U0 scripts/gate.ts. It skips only the file headers before the first@@, so an added++i;or removed--n;counts as logic. - Planner:
fastSettakes an optionalgateAddsand swapsscripts/gate.tsfor the added tests. Any other changed line leavesgateAddsundefined, soneedsFullstill forces the full tier. - Wiring: the extra diff in
scripts/test-shards.tsruns only whenscripts/gate.tsis in the change set.
I left the coverage map and the rule that any other scripts/* change runs the full suite alone.
To try it, change only list lines in scripts/gate.ts on a branch and run bun scripts/test-shards.ts --tier fast. The log line should no longer say "full tier".
Closes #1792
A change to
scripts/gate.tsno longer runs the full suite when the only changed lines are list entries. The fast plan then selects exactly the test files added toGATEorEXCLUDED.bun test test/check-tiers.test.tspasses.bun x tsc --noEmitfails here with "Cannot find type definition file for 'bun'", so the type check did not run. I did not run the rest of the suite.gateListAddsinsrc/checks/impact.tsreadsgit diff -U0 scripts/gate.ts. A line counts as a list entry if it is a bare"test/x.test.ts",or anEXCLUDEDentry (file:,reason:,issue:or a brace). Added entries are returned, and moving an entry counts as adding it.undefinedandneedsFullstill forces the full tier. Removed entries select nothing.fastSettakes an optionalgateAdds. With it,scripts/gate.tsis swapped for the listed tests before the coverage and import logic runs. It no longer counts as a "blind" file that sends every test to the import guesses.scripts/test-shards.tsruns the extra-U0diff only whenscripts/gate.tsis in the change set.test/check-tiers.test.tscovers three things. A list-only diff gives a plan that is not the full tier and includes the added test. Added logic returnsundefined. Logic or an unread diff still runs everything. I also ran the parser on the real last-three-commits diff ofgate.ts; it returnedtest/flow-throughput.test.ts.I left the coverage map and the "any other
scripts/*change runs full" rule alone.To try it, change only list lines in
scripts/gate.tson a branch and runbun scripts/test-shards.ts --tier fast. The log line should no longer say "full tier".Closes #1792