Fixing a defect

First reproduce it, then form a hypothesis, then make a small patch.

A defect does not start with the word "fix". First you have a reproduction: the input, the action, the actual result, the expectation. That same text is what you give the model. Without it, the model fixes a symptom in a random place and breaks a neighbouring case you did not name.

Then one hypothesis, not three. "It looks like an empty string slips past the check. Add a rejection for exactly that. Do not change the other rules. Here is the test; it is red right now." The model proposes a patch. You check that the test turned green and that the old tests were not thrown out.

If the hypothesis did not hold, do not pile five contradictory patches up in the chat. Roll back the tree, write down that the hypothesis is dead, set the next one. A chat history with a dozen "no, not that" confuses both you and the model.

After a green test, write the reason in plain words in the commit or the change description. "Fixed with AI" is an empty description. "An empty name after trimming spaces no longer passes the check" is a description someone can search for when hunting a regression.

Practice

  1. Where to start a fix

    What should the first request about a defect contain?

    • Fix it somehow
    • The steps, the actual result and the expected one
    • Rewrite the module
    • A list of ten hypotheses at once
  2. What to write in the description

    Which description is more useful: "fixed with AI" or the rule that now holds?

  3. How not to drown in the chat

    Select the sensible moves.

    • One red test per hypothesis
    • Five patches stacked on each other without rolling back
    • Roll back the tree if the hypothesis did not hold
    • Delete old tests so everything turns green