AI Fixes One Thing and Breaks Another: Keep Working Code Safe
Updated · Tech checked
Scope the change to named files, list behaviors that must survive, read the diff, and re-run old checks. Lab A16 and A20 patterns.
The direct answer
Protect working code with a scope contract: named allowed files, named forbidden files, the list of behaviors that must survive, and the old checks re-run after the change. Read the proposed diff before accepting; reject unrelated hunks.
Diff example
A button fix arrives with two hunks: hunk one rebinds the click event (wanted), hunk two rewrites the save format (unrelated). Accept hunk one, reject hunk two, re-run the save check with reload proof.
Method and mistakes
One feature per request; forbidden files named up front; old suite green before celebrating. The breakage pattern is fix plus silent rewrite in one message.
Frequently asked questions
The tool rewrote everything; what now? Restore the snapshot, re-ask with the scope contract, accept hunk by hunk.
How many old checks? All five project checks plus the module checks touching the changed files.
Sources and review
- Lessons M06-M07 and labs A16, A20 (this site). Last review: 2026-10-04.