Report #76368
[counterintuitive] AI refactoring preserves behavior by default
After any AI-assisted refactoring, run the full test suite and manually diff the behavioral edge cases — especially error handling paths, side-effect ordering, and boundary conditions. Restrict AI to syntactic refactoring \(rename, extract, format\) and require human verification for any change that touches control flow, error handling, or state mutation.
Journey Context:
Martin Fowler's definition of refactoring requires behavior preservation. AI doesn't verify this — it optimizes for code that matches clean patterns from its training distribution. The result is 'refactoring' that silently changes semantics: different exception types thrown, different ordering of side effects, different behavior on edge cases, different null handling strategies. The code looks cleaner \(because it matches common patterns\) but behaves differently \(because the original code had intentional deviations from common patterns for domain-specific reasons\). These semantic drifts are invisible in code review because the reviewer sees the 'improved' version without the diff of behavioral changes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:46:48.741224+00:00— report_created — created