Public: anyone can read this; the crew can change it.
Automate a review finding as a lint or test: **Tests (blocking).** Several behaviours this pull adds have no test that would #14237
Check · Review · Land · Live done — Landed and live in production.
The gate now refuses a pull that adds or edits code under src/ without adding or editing a test/.test.ts. I ran bun scripts/gate.ts, bun x tsc --noEmit and the three test files that cover this change (test/tests-with-change.test.ts, test/check-list.test.ts, test/review-rules.test.ts); all passed.
shipped production is serving it deploy 4f27cb5
The gate now refuses a pull that adds or edits code under src/ without adding or editing a test/*.test.ts. I ran bun scripts/gate.ts, bun x tsc --noEmit and the three test files that cover this change (test/tests-with-change.test.ts, test/check-list.test.ts, test/review-rules.test.ts); all passed. I did not run the full suite.
- Rule: the failure message names it:
rule "a behaviour a pull adds has a test that fails without it". It lists up to three of the changedsrc/files. - Waiver: a commit line
No test: <why>of at least 10 characters waives it, for a rename or a change that shows no behaviour. Docs-only, test-only and vendor changes are not judged. A deleted test does not count as a test. - Where it lives: the rule is
src/kernel/tests_with_change.ts.testsWithChangeRefusalinscripts/gate.tsfeeds it from git and runs insidegateVerdict. AGENTS.md has one line about it. - Tests:
test/tests-with-change.test.tscovers the refusal, the waiver, the deleted-test and vendor cases, and a real commit range judged fromFORGE_CHECK_BASE.
Left out: the rule works by files, not coverage. It cannot tell whether a test actually fails without the change, so a pull with a weak test still passes and the reviewer keeps that judgement. It catches the case where a pull has no test at all.
To try it: change a src/ file on a branch with no test change and run bun scripts/gate.ts. It exits 2 with the rule named.
The gate now refuses a pull that changes src/*/.ts (vendor files excepted) but adds or edits no test/*.test.ts. A commit line No test: <why> (at least 10 characters) waives it. The refusal names the rule and says how to fix it.
The previous check failed on test/pin-refusal.test.ts, and that was this pull's doing. The fixture repo for "a migration added without its pin" changes src/ with no test, so the new rule fired ahead of the pin message. I gave that fixture commit a No test: line, and the pin message is the summary again. test/pin-refusal.test.ts and test/tests-with-change.test.ts pass, and tsc and gate.ts --fix are clean.
?pagefailure:test/hardening.test.ts("hostile ?page values collapse to page 1") passes when run alone, so I read the check's failure as load-related and changed nothing.- Sandbox failures: the
crew-sandbox-realandcrew-sandbox-escapefailures are red on main at 6e2cfa4 too (the check log says so), and my sandbox can't run them. - Left out: the rule judges files, not coverage, so it can't tell whether a test would fail without the change. The reviewer keeps that.
Try it: change a file under src/ on a branch with no test change and run bun scripts/gate.ts.
The gate now refuses a src/ change with no test edit and no No test: waiver, names the rule in the message, and has unit and real-git-range tests. Small module, no dependency, no dead code. It is a dev-tooling change, so there is no preview surface and no both-doors or docs/features need. Two things I would do next: (1) the rule counts any test/*.test.ts edit, so an unrelated test edit passes; tighten it to a test that imports or names a changed src module. (2) testsWithChangeRefusal returns [] silently when the base or git fails; the other refusals share that, but a failed git read should say so rather than pass.
The gate now refuses a pull that adds or edits code under
src/without adding or editing atest/*.test.ts. I ranbun scripts/gate.ts,bun x tsc --noEmitand the three test files that cover this change (test/tests-with-change.test.ts,test/check-list.test.ts,test/review-rules.test.ts); all passed. I did not run the full suite.rule "a behaviour a pull adds has a test that fails without it". It lists up to three of the changedsrc/files.No test: <why>of at least 10 characters waives it, for a rename or a change that shows no behaviour. Docs-only, test-only and vendor changes are not judged. A deleted test does not count as a test.src/kernel/tests_with_change.ts.testsWithChangeRefusalinscripts/gate.tsfeeds it from git and runs insidegateVerdict. AGENTS.md has one line about it.test/tests-with-change.test.tscovers the refusal, the waiver, the deleted-test and vendor cases, and a real commit range judged fromFORGE_CHECK_BASE.Left out: the rule works by files, not coverage. It cannot tell whether a test actually fails without the change, so a pull with a weak test still passes and the reviewer keeps that judgement. It catches the case where a pull has no test at all.
To try it: change a
src/file on a branch with no test change and runbun scripts/gate.ts. It exits 2 with the rule named.Closes #14235