Before you trust a green test, prove it can fail
How much should a green test run tell you? Less than it seems, until you have watched the same check go red on purpose. I count a pass as evidence only when two things are on record: the test failing against the old code or a deliberately broken variant, and a count showing that every test I expected actually reported. Without those, green means "nothing complained", which is a much weaker statement.
Green tests that could not see the bug
In early November, reviewers found several passing tests that were blind to the defect they were supposed to cover. One checked that an unauthorized call was denied but never looked at the response body, which still carried another account's stored proposal. On a website, focus was lost when a window resized and hid the nav; 24 focused tests passed, and none of them exercised the breakpoint callback. A WebGL failure-injection script patched only main-window contexts after rendering had moved into a worker, and one of its checks read [undefined, undefined] both before and after. A replace-refs test could pass vacuously.
For the resize bug, the repair came with a fixture that gave 1 failed / 1 passed against the old commit, and 26 focused tests passed after the fix. The first of those numbers is the one I care about. One limit: my write-up at the time could not confirm that the fixes for the other three tests landed.
A green exit code with tests missing
The second way to be fooled is that the tests run and the results never arrive. On Nov 21 we fixed two test runner scripts that could exit 0 while tests were silently missing from the count. The cause was the --test-force-exit flag on node:test. With it, the runner calls process.exit() as soon as the tests it knows about finish. Results still on the child's stdout pipe are dropped, and tests registered after a top-level await never run.
A 43-test file ran 43 of 43 in 40 of 40 runs, but the TAP output reported anywhere from 27 to 43, and it was short in 21 of those runs. A 200-test file reported 149 to 187 in 30 of 30 runs with the flag, and 200 in 10 of 10 without it.
The fix puts one choke point in front of every node:test file the tier scripts run. It never passes the flag, it runs each file in its own process group, and it comes with 5 guard tests that drive real node --test fixtures.
The general rule I take from it is a comparison. This block is my illustration of that rule, not a real log and not the fix itself:
# illustration only
declared in file: 12
reported by runner: 9
exit code: 0
gate: FAIL (reported < declared)
I wrote about the neighbouring problem in a merge gate must prove the tests ran. An exit code is the runner's opinion. The count is the evidence.
Failing first, on the record
In disk-cleaner, a review found that readers which checked a path and then opened it could block on a FIFO swapped in between the check and the open. By choice, there was no Rust toolchain on my local machine, so the tests ran only in CI. The tests commit went red first: four FIFO and symlink unit tests, plus a git version test. Then the fix went green. The red run is part of the history, so anyone can see the tests bite.
The same shape showed up in a staging package where a reviewed prompt was added at a pinned commit. The prompt-delivery test failed on the prior build and passed after the update, while authentication, polling, static assets and the outbound gate kept their prior hashes.
On a read-only diagnostics route, the auth reviewer read the stored test outcomes itself: a baseline of 1 pass / 11 fail, a bound-session control of 12 pass / 1 fail, and a final run of 13 pass / 0 fail. On a companion component, a designation writer using an advisory lock, the data reviewer read 3 intended failures, then 3 passes, then 6 of 6, and named what the passing run did not prove: that both SQLSTATE error branches had occurred.
Mutants, and reviewers from the same family
On a click-test driver task, the first Sonnet review was a FAIL with 3 blockers, including a forbidden hard DELETE before archive/void. The author added an ordered cleanup list with a negative control. The second review passed with 0 blockers, and the reviewer got there by building its own mutants ("DELETE only" and "PATCH after DELETE"), which both failed, and by rerunning the suite instead of trusting a cached run.
Then I checked the record. Both review turns were the same Sonnet model, not the stronger blind reviewer my notes had said. A same-family review that ships mutants beats a cross-family review that ships adjectives. And I now check the review record before repeating a claim about who reviewed.
Variants work on UI too. On a dashboard build, independent browser checks showed injected HTML rendered as text, and the same assertions rejected a deliberately raw-HTML variant. A second pass recorded 13 expected baseline failures and 13 current passes.
The escapes are the useful part. A variant run on one draft PR caught 27 of 30 injected regressions. For one of the misses the wrong test was selected, and two needed evidence that planner changes make work grow with hidden rows. On another PR the run caught 114 variants and missed one, an environment-off case. Those misses show where the tests are weak better than the pass count does.
What a pass still does not tell you
Fresh-agent acceptance runs on a fictional project passed and still surfaced real defects: the fixture brief reported fictional: false while describing itself as fictional, and a complete shorthand returned unknown_command while the canonical command worked.
And sometimes I cannot produce the failure at all. A disk-cleaner test failed in two CI runs on one operating system and passed on other runs of the same code. We traced it to git's detached background maintenance, which holds a lock file after the commit returns. The fix turns that off for the test's git calls, loosens no assertion, and adds a test that plants the lock. But the loop failed 0 of 50 times before the fixture fix and 0 of 50 after, so the PR says the cause was reasoned from evidence, not reproduced.
Checklist
- For every repair, run the new test against the old commit or a broken variant and store the red result.
- Ask of each green test: can this pass with the broken thing still broken?
- Compare the number of tests reported with the number declared. Do not accept the exit code alone.
- Have the reviewer build at least one mutant that must fail, and rerun the suite instead of reading a cache.
- Report escaped variants by name, and write down what the passing run did not prove.
- For a flaky test, fix the fixture and not the assertion, and say so if you never reproduced it.
How this was verified
Every episode here comes from my own pull request records, session records and an earlier field-notes write-up from this month. I did not run a new lab for this essay, and the one code block is an illustration, not output.