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

opened this in answer to

Merged 50d 14h ago, 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.

Notes

opened this

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.

  • New parser: gateListAdds in src/checks/impact.ts reads git diff -U0 scripts/gate.ts. A line counts as a list entry if it is a bare "test/x.test.ts", or an EXCLUDED entry (file:, reason:, issue: or a brace). Added entries are returned, and moving an entry counts as adding it.
  • Logic still runs full: if any other line changes, the parser returns undefined and needsFull still forces the full tier. Removed entries select nothing.
  • Planner: fastSet takes an optional gateAdds. With it, scripts/gate.ts is 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.
  • Diff wiring: scripts/test-shards.ts runs the extra -U0 diff only when scripts/gate.ts is in the change set.
  • Test: a new case in test/check-tiers.test.ts covers three things. A list-only diff gives a plan that is not the full tier and includes the added test. Added logic returns undefined. Logic or an unread diff still runs everything. I also ran the parser on the real last-three-commits diff of gate.ts; it returned test/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.ts on a branch and run bun scripts/test-shards.ts --tier fast. The log line should no longer say "full tier".

Closes #1792

3 earlier comments · 1 event
commented

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 crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

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: gateListAdds in src/checks/impact.ts reads git diff -U0 scripts/gate.ts. A bare "test/x.test.ts", line or an EXCLUDED entry counts as a list entry, and moving an entry counts as adding it. Any other changed line returns undefined, and needsFull still forces the full tier. Removed entries select nothing.
  • Planner: fastSet takes an optional gateAdds. With it, scripts/gate.ts is swapped for the listed tests before the coverage and import logic runs.
  • Wiring: scripts/test-shards.ts runs the extra -U0 diff only when scripts/gate.ts is 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 main in scripts/test-shards.ts, src/checks/tiers.ts and test/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

commented

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.ts and test/check-tiers.test.ts. I kept both sides: the gateListAdds and GATE_FILE imports and tests from this branch, and handedImpact plus the new split between measured and unmeasured changes from main. In tiers.ts I dropped this branch's older name-guessing block. main's allNames/unseenNames replace it.
  • Planner change: the "unseen changes" set now starts from the swapped file list, with scripts/gate.ts replaced by the added tests. Otherwise gate.ts itself would have counted as a change the map cannot see and brought back the importer guesses.
  • Parser fix: gateListAdds now 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 returns undefined and 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

commented

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's GATE, gateRefusal and presentTests imports, and kept this branch's GATE_FILE and gateListAdds. main removed auditGate and EXCLUDED, and nothing here used them any more.
  • Fast-tier setup: main replaced the inline times-table read with loadTimes(), so I kept that. The gateAdds diff step from this branch stays, and its result is still passed to fastSet.

What the feature does:

  • Parser: gateListAdds in src/checks/impact.ts reads git 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: fastSet takes an optional gateAdds and swaps scripts/gate.ts for the added tests. Any other changed line leaves gateAdds undefined, so needsFull still forces the full tier.
  • Wiring: the extra diff in scripts/test-shards.ts runs only when scripts/gate.ts is 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

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs