ChatGPT deleted unrelated code during a small fix
The edit scope was explicit; the model still replaced the file and dropped functions outside the requested change.
What the user wanted
The actual target
Fix date parsing in one named function without touching the rest of the file.
What they asked
The instruction
Change only parseDate() so it accepts ISO timestamps with offsets. Do not rename, remove, reorder, or rewrite any other function. Return a minimal diff, not the full file.
What the AI produced
The observable result
A full-file replacement that changed imports, renamed two helpers, and omitted three unrelated functions.
Why
Why WWW assigns this verdict
The user specified the target function, protected every other function, and requested a minimal diff. The destructive rewrite violated explicit constraints rather than filling in an unstated preference.
What gave it away
The words “change only,” “do not remove,” and “minimal diff” directly cover the failure. There is no missing preservation rule to retroactively blame on the user.
Fix
What to do next
- Restore the original file before accepting any new patch.
- Retry the same bounded instruction once and inspect the diff before applying it.
- If the tool repeats the behavior, switch to an editor that can apply and review a scoped patch against the repository.
Repaired instruction
A safer retry
Change only the body of parseDate(). Accept ISO timestamps with numeric UTC offsets while preserving the function signature and existing return type. Do not alter imports or any other function. Output a unified diff containing only the required lines; if another change is necessary, explain why before making it.
Model recommendation
Stay, retry, or switch?
The instruction was already adequate. Retry once; if the same scope failure repeats, use a repository-aware coding agent with diff review enabled.
General lesson
What survives this one case
A model deleting code outside an explicit edit boundary is an execution failure. More elaborate wording can reduce risk, but it does not change who missed the instruction.