A coding agent writes a plausible fix and breaks adjacent behavior. How would you catch that?

Instruction: Describe how you would protect against locally correct but globally harmful patches. Python contract: an empty sequence sums to 0; a nonempty numeric sequence returns its total, including negatives. Proposed patch is return max(sum(xs), 0) to fix a UI that displayed -0.0. Give a counterexample, diagnosis and narrower next step.

Context: Tests how the candidate diagnoses the problem, chooses the safest next step, and reasons through recovery. Describe how you would protect against locally correct but globally harmful patches.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

I'd reproduce the reported failure, then trace callers and shared behavior before accepting the fix...

Your preparation path

Work through these questions in order. Read the answer aloud, then explain it in your own words.

Related Questions