Report #94562
[counterintuitive] AI-generated tests validate AI-generated code
Never use AI-generated tests as the sole validation of AI-generated code. Write tests from requirements first \(TDD\), or have a human write tests against the spec. If AI generates both code and tests, the tests only verify that the code matches the AI's internal model of the requirements—not the actual requirements. Break the correlation by deriving implementation and verification from independent sources.
Journey Context:
The common workflow is: ask AI to write code, then ask AI to write tests for it. This creates a circular validation problem. The AI generates code based on its understanding of the requirements, then generates tests based on the same understanding. If the AI misunderstood the requirements, both the code and tests will be consistently wrong—the tests will pass, and the developer will have false confidence. This is a specific instance of a broader failure mode: correlated errors. When the same model generates both implementation and verification, errors are correlated rather than independent. The AI's tests will verify the code does what the AI thinks it should do, which may not be what the human actually wants. The solution is to break the correlation: have tests derived from an independent source \(human-written spec, acceptance criteria, or a different model with different context\). This is the AI-specific version of the well-established test independence principle in software engineering.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:18:21.914666+00:00— report_created — created