Back to Coding

What Should You Do With the Bug After Fixing It?

What Should You Do With the Bug After Fixing It?
AI Tutorials Team 19 June 2026

The bug is fixed and the temptation is to move on immediately. Five minutes at this point produces more value than the fix itself, because a single bug is worth very little and a class of bug is worth a great deal.

What should you record?

The cause, in one sentence, in the commit message. Not the change, which is visible in the diff: why the problem existed. That sentence is what somebody needs in a year when something similar happens.

Fixed the export dropping rows: the filter was comparing a date as text, so anything before the tenth of a month sorted incorrectly.

Why is that more useful than describing the change?

Because the change is obvious from the code and the reason never is. Somebody looking at a line and wondering why it is unusual gets the answer from a commit message, and gets nothing from a message saying the export was fixed.

What should you ask next?

Whether the same mistake exists elsewhere. Bugs are rarely unique: a date compared as text in one place is frequently compared as text in three, and finding the others takes a search rather than an investigation.

I found this bug in one place. Where else in this project does the same pattern appear, and would it produce the same problem there?

Should you write a test?

For anything that could recur quietly, yes, and this is the ideal moment. You have a known failing case, you know what the correct behaviour is, and the test writes itself.

A test written now is considerably more likely to be a good one than a test written speculatively.

What about preventing the class?

  • Validate at the boundary. If the cause was a type.
  • Add a check to your review prompt. If it is a category you keep hitting.
  • Fix the logging. If the investigation was harder than it should have been.
  • Note it in the project rules. If generated code keeps producing it.

Why is the logging point important?

Because the best moment to improve logging is immediately after an investigation that was difficult. You know exactly what information was missing, and that knowledge disappears within a day.

What is worth keeping personally?

A short list of bugs you have caused, with the belief behind each. After a few months the repeated entries are an accurate map of your own weak points, which is more useful than any general advice about what to learn.

What about telling anybody?

Worth doing if others work on the same code, particularly for a non-obvious cause. A sentence in a team channel prevents somebody spending an afternoon on the same thing next month.

What is the five-minute version?

Write why it happened in the commit, search for the same pattern elsewhere, and add a test if it could recur silently. That is the whole practice and it compounds in a way that fixing bugs individually does not.