Report #39917
[counterintuitive] AI-generated tests that pass validate code correctness
Use AI to generate test infrastructure and edge case enumeration, but write specification-based test assertions yourself. After AI code passes AI-generated tests, apply mutation testing or manually verify assertions encode the specification, not the implementation.
Journey Context:
AI generates tests that pass against the current implementation because it reads the implementation and produces tests confirming it works as-is. This is the 'change detector' anti-pattern from testing literature: tests that break on any change rather than only on incorrect changes. The result is a false confidence multiplier—you trust the AI code because it has tests, and you trust the tests because they pass. But the tests would also pass if the implementation were subtly wrong, because they were derived from it. This is qualitatively different from a human writing tests from a specification: the human at least intends to test the spec, while the AI is effectively testing that the code does what the code does. SWE-bench data confirms this: roughly 20% of AI-generated patches that pass existing tests are actually incorrect.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:28:30.345596+00:00— report_created — created