NOTE 005 / AI-DRIVEN DEVELOPMENT, VERIFICATION / 2026-11 / 11 MIN READ
The model wrote the tests too: why a green run is not evidence, and what is
Abstract. When one author writes both an implementation and its tests, the tests inherit the author's blind spots, and a passing suite shows only that the two agree with each other. With AI-written code this is the default condition, not an edge case. We describe two sources of evidence that do not share that author: mutation testing, where the code is broken on purpose and a named test must fail, and live end-to-end runs against real infrastructure. The most useful result was not the mutations that survived but the ones that were counted as caught and meant nothing, and we give a taxonomy of those vacuous passes and how we now detect each.
One author, two artifacts
A bring-your-own-cloud database platform we worked on was built with AI-driven development: an AI model wrote most of the services, specifications, reviews and tests. The test code outweighed the production code it tested. That sounds reassuring and is not, because volume is not independence.
The model writes the implementation and its tests in the same pass, from the same understanding of the problem. If that understanding is wrong, both artifacts are wrong in the same direction, and the suite passes. A green run then proves that the code and the tests agree. It does not prove that either of them is right.
This is an old result in a new setting. In 1986 Knight and Leveson had 27 versions of one program written independently from the same specification and ran them through a million tests. Each version was very reliable alone, yet tests on which several versions failed together were substantially more frequent than independence predicts. Code and tests written by one author in one pass are the limiting case: the correlation is there by construction.
So we asked of every step between a ticket and a merge: who produced this? Specification, code, tests, reviews and review fixes all came from the model whose work we were checking. Two steps did not: the continuous integration run, which executes the code, and a live run against a real cloud provider. Everything below is about making those two count for more, and about what to do when even they can be fooled.
Mutation as an oracle the author does not control
Mutation testing inverts the question. Instead of asking whether the tests pass, it changes the code (deletes a guard, flips a comparison, returns early) and asks whether any test notices. A test that passes either way was never a test of that behaviour. The arbiter is the code's actual behaviour under the change, not the author's belief about it.
There is evidence that it measures something real. Just and colleagues found, over 357 real faults in five open-source projects, a statistically significant correlation between a suite's detection of mutants and its detection of real faults, independent of code coverage. Google surfaces diff-based mutants inside code review, which is close to how we use it.
Our rule was narrow and cheap. Every task that adds a guard states its mutation in advance, and the mutation must fail a named test, not merely turn something red. A typical task read: an expired credential fails validation, and this must fail when the rule is removed, which is checked by removing it. The mutations were applied by hand to the guards in the diff, not to the whole codebase.
What survived
In a cloud provider adapter, a review pass applied seven mutations to the working tree and re-ran the suite against each. All seven survived. The worst: the requested storage size never reached the create request, so every customer asking for a 100 GB disk would have silently received the 20 GB default, with every step reporting success. Another: the test double recorded nothing for two delete calls, so a teardown issuing deletes against arbitrary foreign resource IDs was invisible to the whole suite. Three gaps were closed before merge and the remaining four became tracked follow-up work.
In a command-line tool that issues credentials, four mutations to the program's entry point survived the entire suite, because the entry point had no tests at all. The worst swapped its two output streams, which would have written secret material to the operator's terminal and the public record into the credential file. A fleet-wide credential was tested only from below, for what it may and may not do at its own level. Two mutations widening it to the account's whole management API left every test green, because no test tried anything above that floor.
Several of our design rules exist only because a mutation survived. Every credential is now asserted from above as well as from below. Every connection option sits in a table where each row names what its absence costs, because three mutations had survived the suite of the component it was first written for. Entry points are split so they can be tested. None came from reading the code; each came from watching a deliberate break pass.
A taxonomy of vacuous passes
The more instructive finding was on the other side. In one change, 25 mutations were all caught, and four of them had to be corrected before they meant anything. After a review pass the change carried 36 mutations, all caught, and five of those needed redesigning first. Other changes showed the same modes. A "caught" mutation is itself a claim, and it can be as hollow as a green run.
| Kind of vacuous pass | What it looked like | How we detect it now |
|---|---|---|
| Stillborn mutation | Deleting a guard removed the only use of an import, so the package failed to compile. The red build was counted as a caught mutation. | A mutation must build. A build failure is not a catch; the mutation is redesigned to keep the code compiling, for example by keeping the variable in use. |
| Tautology | A file mode assertion compared the result against the same constant it was meant to pin. Changing the constant changed both sides. A usage-text check was built from the very constants it checked for. | Expected values are literals, never derived from the code under test. The test asserts the literal mode, and separately that the constant equals it. |
| A proof of its own copy | A scan for leaked secrets had a planted proof that it works, written as a second loop. Disabling the decode in the real scan left the proof green. Another test walked a second staged copy of a directory instead of the one the server was given. | The proof calls the production path. Scan and proof are one function, and the test walks the directory the running process actually received. |
| Wrong target | A mutation to a shared pattern was run against the wrong packages, so the tests that would have caught it never ran. | Record which packages ran, and see the named test fail, before counting the mutation. |
| Guard reachable by another path | Removing a key-type check left the suite green, because a pairing check further down refused the same input anyway, with a message useless to the person holding the wrong key. | Pin the specific refusal and its message, not just the fact of refusal. If no test can reach the guard, say so in the code rather than pretend. |
| The environment fails it for you | Removing an interactive-terminal check left the suite green, because the test binary's input is not a terminal and the password read failed anyway. | Assert the reason for the failure, not only that it failed. |
| Nothing was checked | A scan that read zero files passes. A handler that fails before reaching the code under test passes. A test double that records nothing for a call makes "never issued" look like "issued correctly". | A floor on work done (files read, listings made), a control arm that proves the fixture can produce the failure, and a recorder on every mutating call of a test double. |
| Observing nothing, read as a negative | On a live node, a file that must stay empty was empty, and that was read as the protection working. It was empty because the account held no keys to inject. | Plant the thing the claim says is absent, then show it stays absent. |
Mutation tools already handle the first kind: Stryker keeps a mutant that fails to compile out of the mutation score, and gremlins, a mutation tool for Go, reports it as not viable. Ours were hand-applied, with no tool keeping score. The last kind is not specific to tests: it is the difference between observing a negative and observing nothing, and live evidence is as exposed to it as unit tests.
Proving a security property by breaking it
Mutation is not only for unit tests. On Scaleway, the platform must guarantee that a key registered across the customer's cloud project cannot log in as root on database nodes. The design relied on cloud-init's disable_root. A first check showed that it does not set OpenSSH's PermitRootLogin no, so an explicit setting was added. A second check, against a project that actually held a key, found that the provider also delivers project keys through cloud-init vendor data, which places them in root's authorized_keys regardless of the agent we had disabled. The first check had seen that file empty only because the project held no keys.
Reading the configuration would have suggested two layers of protection. Mutation said otherwise. With the explicit PermitRootLogin no moved aside and the SSH daemon restarted, the project key authenticated as root, held short of a shell only by a forced command we did not own. One control was carrying the guarantee, and the line that looked like tidy-up was load-bearing.
After hardening, which removes root's authorized_keys at boot, the same mutation was run again. The project key was still refused, because there was no longer any key material for it to match. Only now were the two controls independent. Without that second mutation, it would have been impossible to tell defence in depth from one control with a decorative second layer.
Bugs that exist only against real infrastructure
Some defects are invisible to anything that reads code or specifications, because the code and the specification agree with each other and are both wrong about the world. The control plane logged into one provider's nodes with a non-root default user, and that provider's images accept only root. Nothing in the code was inconsistent and nothing in the specification was wrong. One live run against the real provider found it.
The same bug carried a second lesson. A plausible hypothesis, a race in which the key was not yet written at login, was disproved: the refusal was immediate and permanent, and raising the retry interval changed nothing. We now hold causal claims in shared artifacts to the standard of tests: quote the actual log line and source line, and label anything else a hypothesis.
Two practices follow from treating live runs as evidence rather than as a smoke test.
- A bug found by an end-to-end run is accepted as fixed only when the author of the fix reruns the exact scenario, with the same provider, engine and parameters, and attaches that run to the pull request, ideally as a status check. A new unit test that passes is not proof that the product bug the cloud run found is gone.
- Pull requests for end-to-end work carry a section titled "what this proved about the product". Each claim is backed by a short excerpt from the real run's logs, and faults the runs caught along the way belong there too. A reviewer sees what the product demonstrably does, not only that the build is green.
Independence has to come from people
Mutation and live runs check the code against reality. Neither checks that the tests ask the right questions, because the model also chose which behaviours to test and which mutations to apply. That is the remaining shared blind spot.
The method we have proposed, and not yet built, moves the human into exactly that gap. Before any implementation, people agree the scenarios: when this happens, then that must be observable. The scenarios become failing tests in their own commit, and the tooling must stop and wait for human agreement on them. The model may draft the scenarios. Independence comes from people agreeing them, not from the model writing them. The same idea appears in the design review we proposed, which asks, among six fixed questions, what observable evidence would prove the change works, and expects that evidence attached when the code arrives.
What we would do differently
- Mutate from the first commit, not at review. The survivors in the cloud adapter were found by a review pass after the code was written. Stating each guard's mutation in the task, as the later changes did, costs less than finding the gap afterwards.
- Use a tool alongside the hand-picked mutations. Our mutations were chosen by the same model that wrote the code, which is a selection bias. An off-the-shelf mutation tool applies operators without knowing what the author believes, and it keeps score correctly, so stillborn mutations cannot be counted as catches. We proposed wrapping one into the workflow; it is not built yet.
- Treat "caught" as a claim that needs its own evidence. Every row of the taxonomy was a mutation reported as caught. Recording which test failed, and why, is the cheap part of the check and the part we skipped first.
- Let mutation delete tests too. One test was removed because mutating its check failed eleven others: it added documentation, not detection.
Open questions
- Some guards are not mutation-provable. A default branch behind an enumeration that is validated earlier cannot be reached by any test, and we kept it anyway because without it an unexpected value fell through as a silent success. How should such guards be marked so that they are not later "simplified" away?
- When a bug's symptom is racy, its mutation passes or fails by chance. We pinned a property instead (a file descriptor is still seekable afterwards). Is there a general way to turn a racy symptom into a deterministic property?
- How many mutations per change are enough, and who chooses them, when the chooser shares the author's blind spots?
- Can faults be injected into live runs as systematically as mutations into unit tests, so live evidence meets the same standard?