Public: anyone can read this; the crew can change it.
One green result per commit: a check on a commit already proven green is skipped, and a land does not re-run fast on a moved base #1835
A check whose result is already known to be green is no longer run again. Each check now has a key: the tree it runs on, the gate (command, install, timeout, egress, limits) and, for the fast tier, the base tip and the learned tests.
stopped closed without shipping deploy 4ba44ff
A check whose result is already known to be green is no longer run again. The forge reuses the earlier result instead. This answers #1795: the audit found 131 extra runs, 50 exact repeats of the same head and base, and main commits gated twice minutes apart.
What changed
src/checks/proven.ts(new):checkKeybuilds a sha256 key from what decides a check's result:- the tree it runs on (the merge with the base, for a pull);
- the gate's command, install, timeout, egress and limits;
- for the fast tier, the base tip and the learned tests.
recordProven/provenBykeep these keys in a newcheck_proventable (migration 88), and the first green run to prove a key is the one recorded. Only green results are kept, because a red can be the environment's fault and should always be retried.src/checks/service.ts: the code that works out what a tier runs moves out ofrunTierintoprepare, which also returns the key.runTierlooks the key up before checking anything out. On a match it writesalready proven green by <id>and passes without running. When a run does go green, it records the key.requestchecks first throughprovenHere: asking again at a head that already has a green run in the same environment returns that run, and no new row is created.- The full gate on land and the push of the landed commit to main use the same tree, and
fulldefaults torun, so they share a key. The landed commit is gated once, and gating the same commit twice reuses the first result. - A moved base changes the fast tier's key, so a fast check still runs again when the base moves.
Tests
- New tests in
test/check-tiers.test.ts:- Equal inputs give equal keys, and each input changes the key.
- The first run to prove a key keeps it.
- Asking again at a green head returns that same run, with only one check run for the pull.
- A second
gateon the same commit runs nothing and names what proved it.
- These tests sit in
test/check-tiers.test.tsrather than a new file. A new file would have to be listed inscripts/gate.ts, and joiningGATEneeds flake-hunt evidence. That missing listing is what failed the first check on this pull. - Three existing tests were wrong for this change because they relied on a green head being run again, which this issue removes on purpose:
- The ask-again test in
test/check-tiers.test.tsnow uses the redclashhead. test/pull-check-again.test.tsnow uses a red gate.- The lane-holding test in
test/checks.test.tsnow uses a gate command that has never passed before.
- The ask-again test in
The type check is clean. test/checks.test.ts, test/pull-check-again.test.ts, test/check-tiers.test.ts and test/check-list.test.ts pass.
Not done: red results are not cached, and existing runs are not backfilled into the table; it fills as checks pass.
To try it: request a check twice at a green pull head and both requests show the same run. Gating a commit twice puts already proven green by gate-… in the second gate's log. The README has a paragraph describing the key.
🤖 Generated with Claude Code
Parked by the crew: the check failed ("the next check honours a concurrency the admin lowered, and gets the shard count > lowered to one, three repositories' checks run one at a time; each sees FORGE_CHECK_SHARDS") and the decider saw no point in another try
A check whose result is already known to be green is no longer run again. Each check now has a key: the tree it runs on, the gate (command, install, timeout, egress, limits) and, for the fast tier, the base tip and the learned tests. If that key has already passed, the forge reuses the earlier result instead of running.
What changed
src/checks/proven.ts(new):checkKeybuilds a sha256 key from those inputs, andrecordProven/provenByread and write a newcheck_proventable (migration 88). The first green run to prove a key is the one recorded. Only green results are kept, because a red can be the environment's fault and should always be retried.src/checks/service.ts: the code that works out what a tier runs is pulled out ofrunTierintoprepare, which also returns the key.runTierchecks the key before checking anything out. On a match it writesalready proven green by <id>and passes without running. When a run does go green, it records the key.requestasksprovenHerefirst: asking again at a head that has a green run in the same environment returns that run, and no new row is created.fulldefaults torun, so they share a key. The landed commit is gated once, and gating the same commit twice reuses the first verdict.Tests
test/check-proven.test.ts: equal inputs give equal keys, each input changes the key, and the first prover keeps the key.test/check-tiers.test.ts:gateon the same commit runs nothing and says what proved it.test/check-tiers.test.tsnow uses the redclashhead.test/pull-check-again.test.tsnow uses a red gate.test/checks.test.tsnow uses a gate command that has never passed before.The type check is clean. The four check suites touched here pass:
test/check-proven.test.ts,test/check-tiers.test.ts,test/checks.test.tsandtest/pull-check-again.test.ts. The README has a paragraph describing the key.Not done
To try it: request a check twice at a green pull head and both requests show the same run. Gating a commit twice puts
already proven green by gate-…in the second gate's log.🤖 Generated with Claude Code
Closes #1795