Report #29769
[counterintuitive] AI code works on small inputs but fails catastrophically at production scale
Review AI-generated code for algorithmic complexity \(O\(n\)\), unbounded memory allocation, missing resource cleanup, and N\+1 query patterns before merging. Run benchmarks at realistic data volumes, not just unit-test-scale inputs.
Journey Context:
AI trains on examples that are necessarily small and self-contained. It writes O\(n²\) algorithms that pass tests with 10 items, allocates lists without bounds, and doesn't handle memory pressure or connection pool exhaustion. Senior engineers have production scar tissue—they know that 'works' and 'works at scale' are different properties. AI's code appears capable because it passes all the tests you write, which are also small. The failure mode is invisible until production: the nested loop that's fine for 100 records causes a 30-minute query on 10 million. This is a systematic blind spot because the AI's training distribution is biased toward small, pedagogical examples. The defense is to explicitly review for complexity and resource behavior, not just correctness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:21:23.626509+00:00— report_created — created