Break the Fix Loop
After settle-up went in, Kitty's balances started going wrong. The first fix made Asha's balance right and Meera's wrong. The second fix made Meera's right and Ravi's wrong. You are about to type "still broken, please fix". That is the fix loop: every lap adds code built on a guess, and the pile of guesses grows.
The rule
Two failed fixes means stop: revert, narrow, gather evidence, then try again.
The assistant will keep producing fixes for as long as you keep asking. Each attempt is a guess about the cause, and failed guesses leave code behind. Breaking the loop takes four moves:
- Revert. Go back to your last good commit. Reason about one known problem, not three layers of attempted fixes.
- Narrow. Reduce it to one failing test with the smallest case.
- Gather evidence. Look at what the code actually does, rather than guessing. The simplest tool is a temporary print of the values at the suspect line:
print("expenses:", expenses)
print("payments:", payments)
print("balances:", balances)- Try again, differently. Ask the assistant for causes rather than code: "List three possible causes and how to test each one. Do not change any code yet." Then test them. Or take the wheel and work the case by hand.