# External Test Oracles Make AI-Generated Code Trustworthy
## Claim
AI-generated code only becomes verifiably correct, not just plausible, once it's checked against a test oracle that neither the AI nor the human reviewer authored or controls.
<!-- atomicity: 1 idea ✓ -->
## Scope & conditions
- Holds strongest when a mature, pre-existing, adversarial test corpus already exists (a language's own regression suite, an established compliance test set) — the oracle's independence is what does the work.
- Weakens in greenfield domains with no pre-existing ground truth, where the "oracle" would itself have to be built by the same human/AI pair it's meant to check, and so isn't fully independent.
- Doesn't by itself guard against the oracle's own plumbing lying (see the linked CRLF-normalization failure mode) — the oracle needs periodic verification too, not blind trust.
## Evidence
Ekin Ertaç's from-scratch PHP interpreter ("Phargo"), written in Rust by an AI agent and directed by an author who states he "cannot audit the code," is validated entirely against PHP's own ~22,000-file upstream `.phpt` test suite rather than against tests either the author or the AI wrote. The project reached a real WordPress front page and `/wp-admin/` render specifically because that external, adversarial scoreboard — "cannot be flattered, negotiated with, or prompted into a better mood" — caught bugs a non-expert human reviewer would have missed, including several "Potemkin" features that ran without erroring while doing nothing at all.
## Links
- [[AI & the Future of Knowledge Work MOC]] — the independent check that converts plausible output into verified output
- [[3. Resources/Permanent Notes/A Test That Cannot Return No Cannot Validate Yes]] — parallels: a check only demonstrates what it can also refuse; an oracle you didn't write is what supplies that discriminating power
- [[3. Resources/Permanent Notes/Eval Quality Is the Rate-Limiter on Safe Agent Autonomy]] — extends: names the mechanism (eval quality) this claim shows a concrete instance of
- [[3. Resources/MOCs/AI Agent Safety MOC]] — applies-in: the maker/checker discipline this claim generalizes into a governance principle
## Tests / falsifiers
- Find a project that gates AI-agent code behind an AI-authored (not third-party) test suite and compare its post-merge regression rate against Phargo-style external-oracle projects; if rates are comparable, oracle independence isn't doing the claimed work.
- Check whether Phargo's pass-rate curve keeps climbing once fuzzing moves past the fixed 22,000-test corpus — a static oracle that stops catching new bugs once "solved" would undercut the general claim.
## Maintenance
- Last tended: 2026-08-16
- Next review: 2026-11-16
## Source
- [[3. Resources/Literature Notes/I Don't Know Rust. My AI Is Rewriting PHP in It Anyway]] — reports the Phargo project's scoreboard mechanic, the CRLF harness bug, and the WordPress-boot milestone.