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

A kept-result audit that disagrees drops the kept entry and says so #16808

Merged opened this

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

Merged

A disagreeing audit now drops every kept entry for that test file and fails the run. tsc is clean, and test/shards.test.ts and test/check-kept.test.ts pass (90 tests). scripts/gate.ts --fix changed nothing.

Notes

opened this

A disagreeing audit now drops every kept entry for that test file and fails the run. tsc is clean, and test/shards.test.ts and test/check-kept.test.ts pass (90 tests). scripts/gate.ts --fix changed nothing. I did not run --explain, design-lint or the full suite, and nothing here touches src/web/ or the doors rule.

The drop reaches only the handed .forge-kept.json in that check's checkout, not the store beside the forge. Only a default-branch measuring run writes the store back, so a pull's check can't change it. The entry therefore stays in the store until a default-branch run replaces it. I left this out because changing it would mean letting a pull's check write the store.

  • Drop: dropDisagreed in src/checks/kept.ts removes every entry whose test is the disagreeing file, under any key, so no key sharing that file's inputs is trusted again. Other files' entries stay.
  • Log: droppedLine prints audit DISAGREED: dropped N kept results (test/x.test.ts from abc1234, …); this run is untrustworthy and fails, the files rerun next time.
  • Run fails: scripts/test-shards.ts forces exit 1 when an audit disagreed, even if main's own red would otherwise clear the pull's red.
  • Judging: auditDisagreed in scripts/shards.ts reads the same verdicts as auditLines, so the logic isn't duplicated. "Audit cannot tell" is not a disagreement and drops nothing.
  • Tests (in test/shards.test.ts): a disagreeing audit removes both entries for the file and keeps the other file's, and the log names what was dropped. The next run's splitKept then puts the file in run, so it recomputes. An agreeing audit drops nothing.

I reused auditLine and failingFiles, and added no dependencies. scripts/similar.ts wasn't run.

To try it, run bun test test/shards.test.ts test/check-kept.test.ts.

Closes #16270

commented

A disagreeing audit now drops every kept entry for that test file and fails the run. tsc is clean, and test/shards.test.ts and test/check-kept.test.ts pass (90 tests). scripts/gate.ts --fix changed nothing. I did not run --explain, design-lint or the full suite, and nothing here touches src/web/ or the doors rule.

The drop reaches only the handed .forge-kept.json in that check's checkout, not the store beside the forge. Only a default-branch measuring run writes the store back, so a pull's check can't change it. The entry therefore stays in the store until a default-branch run replaces it. I left this out because changing it would mean letting a pull's check write the store.

  • Drop: dropDisagreed in src/checks/kept.ts removes every entry whose test is the disagreeing file, under any key, so no key sharing that file's inputs is trusted again. Other files' entries stay.
  • Log: droppedLine prints audit DISAGREED: dropped N kept results (test/x.test.ts from abc1234, …); this run is untrustworthy and fails, the files rerun next time.
  • Run fails: scripts/test-shards.ts forces exit 1 when an audit disagreed, even if main's own red would otherwise clear the pull's red.
  • Judging: auditDisagreed in scripts/shards.ts reads the same verdicts as auditLines, so the logic isn't duplicated. "Audit cannot tell" is not a disagreement and drops nothing.
  • Tests (in test/shards.test.ts): a disagreeing audit removes both entries for the file and keeps the other file's, and the log names what was dropped. The next run's splitKept then puts the file in run, so it recomputes. An agreeing audit drops nothing.

I reused auditLine and failingFiles, and added no dependencies. scripts/similar.ts wasn't run.

To try it, run bun test test/shards.test.ts test/check-kept.test.ts.

commented

A kept-result audit that disagrees now drops the file's entries from the store as well as the checkout. Its exit code is decided by a tested pure function. tsc is clean. 316 tests pass across test/check-kept.test.ts, test/shards.test.ts, test/checks-home-sweep.test.ts and the destroy-reach and check-* suites. gate.ts --fix found nothing to rewrap; its note about long comment lines in scripts/test-shards.ts and test/shards.test.ts is left for the nightly rewrap. I did not run the full suite.

How the drop reaches the store

  • When an audit disagrees, scripts/test-shards.ts writes the disagreeing test paths to .forge-kept-dropped.json in the checkout. It also drops them from the handed .forge-kept.json.
  • dropKept in src/checks/kept-store.ts reads that file and removes every entry for those tests from the store, written atomically. It is called from the finally in runTier (src/checks/run_tier.ts), so it runs for any run, red or green, and a red run's skipped write-back no longer matters. The file is gitignored.
  • A pull's tree can only make the store forget results, never add them. The file is size-capped and each path is checked with parseDropped (test paths only).
  • A later mergeKept on the default branch can't bring the entries back, because the store no longer holds them.

Exit code

  • finalCode in src/checks/kept.ts returns 1 whenever an audit disagreed, and main's red never clears that. Otherwise it returns 0 when main's red clears the run, else the run's own code. The test covers all five cases.
  • auditDisagreement is now set from disagreed.length > 0 alone. With no handed file, the run still fails and logs that the store is told.
  • If the handed file is unreadable, the log now says so.
  • judgeAudits in scripts/shards.ts uses a plain judged helper instead of the nested closure.

Not done

  • A remote runner that doesn't run runTier locally would need its own hand-back of the dropped file. I didn't touch it.

Reused: auditLine, failingFiles and dropDisagreed, with no new dependencies.

To try it: bun test test/check-kept.test.ts test/shards.test.ts.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs