Report #68297
[counterintuitive] AI struggles with complex algorithms but handles simple domain constraints well
Explicitly encode all domain constraints as assertions guard clauses and runtime checks in AI-generated code; never assume AI will respect implicit business rules or domain invariants; add constraint comments to prompts and verify constraints in generated output
Journey Context:
AI can generate correct implementations of complex algorithms \(quicksort Dijkstra A\*\) because these are well-represented in training data with clear correctness criteria. But AI will silently violate domain-specific constraints \(this field must be positive this API must not be called during maintenance windows this value must be consistent with database state\) because these constraints are not visible in the code structure and are underrepresented in training data. The bugs AI introduces are not algorithmic failures — they are missing context. This is counterintuitive because humans associate hard with complex algorithms but for AI the hard problems are the ones that require invisible domain knowledge not the ones that require complex logic. HumanEval scores are high precisely because they test algorithmic problems; real-world failure rates are higher because real code is constraint-dense.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T21:07:09.268958+00:00— report_created — created