Fixed real-time waits make tests slow and flaky. test/ has 764 await Bun.sleep(<number>) calls in 392 files, plus 90 setTimeout(resolve, <number>) waits in 62 files. The worst files are release-prove (12), crew-early (10), my-shells (9), flake (8) and drill-weekly (8). Today scripts/flake.ts finds a flake only after it happens; a static check would stop new ones before merge.
The idea comes from the no-fixed-sleep rule in interfere-inc/landmines (MIT, Oxlint plugin). We will not add it as a dependency: it needs Node and Oxlint, and the forge has one gate.
Change: add scripts/test_honesty.ts, imported by scripts/gate.ts. It counts fixed numeric waits per test file and compares the counts to a committed allowance file (same pattern as docs/design/size-budget.json). A file over its allowance fails the gate with the message: "await the operation or an event it emits instead of a fixed delay". A file under its allowance also fails until the allowance is lowered, so the list only shrinks. FORGE_SLEEP_WRITE=1 regenerates the file.
Also count mock.module( (3 today) and test retry: / raised timeout: (5 today) with the same allowance.
Done when: the gate runs the check in pull checks and on main, the allowance file matches today's counts, and a test adding one new await Bun.sleep(50) fails the gate.
Not in scope: landmines' no-comments and no-explicit-return-types. They contradict how the forge documents its code.
Fixed real-time waits make tests slow and flaky.
test/has 764await Bun.sleep(<number>)calls in 392 files, plus 90setTimeout(resolve, <number>)waits in 62 files. The worst files are release-prove (12), crew-early (10), my-shells (9), flake (8) and drill-weekly (8). Todayscripts/flake.tsfinds a flake only after it happens; a static check would stop new ones before merge.The idea comes from the
no-fixed-sleeprule in interfere-inc/landmines (MIT, Oxlint plugin). We will not add it as a dependency: it needs Node and Oxlint, and the forge has one gate.Change: add
scripts/test_honesty.ts, imported byscripts/gate.ts. It counts fixed numeric waits per test file and compares the counts to a committed allowance file (same pattern asdocs/design/size-budget.json). A file over its allowance fails the gate with the message: "await the operation or an event it emits instead of a fixed delay". A file under its allowance also fails until the allowance is lowered, so the list only shrinks.FORGE_SLEEP_WRITE=1regenerates the file.Also count
mock.module((3 today) and testretry:/ raisedtimeout:(5 today) with the same allowance.Done when: the gate runs the check in pull checks and on main, the allowance file matches today's counts, and a test adding one new
await Bun.sleep(50)fails the gate.Not in scope: landmines'
no-commentsandno-explicit-return-types. They contradict how the forge documents its code.