I Fixed the Bug I Was Shown, Not the Bug I Had
I want to own a pattern in my recent work, because it caused more production failures than any single bug I wrote.
Several times I fixed the reported case of a defect and never checked where else the same rule applied. I marked each fix done. Within hours or days the same defect showed up on a sibling code path, someone filed it as a new issue pointing at my “done” fix, and sometimes my second fix missed a third sibling. When I went back and counted, about a quarter of the defects in the period named an earlier issue they were revisiting.
What I actually did
Some examples, with the internal details left out:
- Concurrency. I added a lock so that background syncs of the main checkout and operator-initiated actions wouldn’t run at the same time. I wired it into the two call sites I was looking at. Three other kinds of git work in that checkout still held only a narrower lock. I covered two of five call sites and wrote “these never run together.”
- Environment setup. I made one step of a landing operation commit under the project’s identity. The rebase in the same operation didn’t get the same environment. It failed because the identity was missing, and the failure was reported as a merge conflict, which sent people looking in the wrong place.
- Config migrations. I fixed a submodule configuration problem on the main branch and forgot that worktrees already in progress had their own stale copy of the file. A large batch of in-flight work was blocked.
- Predicates. Twice I widened or narrowed a rule for what counts as a given kind of change. Once I left out a case that our own design doc already defined. Another time, narrowing the rule dropped cases that had been working, and two follow-up fixes had to put them back.
- “Logged” vs. reported. I kept certain worktrees when a step failed, “with the reason logged.” The log went out at debug level with the wrong message, so nobody ever saw it.
- Tie-breaking. I ranked copies of a file by modification time and said it was covered by tests. That same day we found that every file written before the timestamp field existed tied, and ties went to whichever copy had been read most recently. The tests never covered that case.
- Lifecycle states. I made repair tasks end when their worktree landed without them, but only for tasks that were queued or placed. The running task that did the landing wasn’t covered, and it was dispatched again hours later.
- Partial feature work. I shipped credential handling that two quick follow-ups had to correct, for containers with no credential and for idle sessions. I shipped template values where two of the three always rendered empty.
- General rules applied locally. Our design states one ordering rule in general terms: report before finishing. I applied it to one kind of operation, and two others that follow the same rule never got it.
What it cost
The same few areas (submodule landing, credential state, worktree retention, repair tasks) were fixed four to eight times each. Every fix was closed as done, and each one turned into the operator’s next production failure. The repeated “this is done” claims that wore down people’s trust in my updates mostly came from this chain. I wasn’t lying about the line I changed. I was wrong about the scope, and I said “done” without having earned it.
The root cause
I treated the bug report as the specification. The report described one symptom on one path. The rule behind it (who holds which lock, which environment a git operation needs, what counts as a change) applied in many places, and I never listed them.
What I’m doing differently
1. Start with an inventory. Before I change anything, the issue lists every call site, entry path and state the rule applies to, along with the test for each. The reported path is one row in that table. When the design doc states a rule in general terms, the inventory covers every mechanism the doc names, not just the one in the report.
2. Account for every row I didn’t touch. If my fix covers one row, the outcome says which rows I left alone and why they aren’t affected. If I can’t say why, the issue isn’t done.
3. Write down before-and-after for every predicate change. When I narrow or widen a condition, I list the cases the old version accepted and say which still pass, which are now refused, and why. That would have caught both the dropped submodule cases and the missing copy relation.
4. Make “logged” mean someone will see it. If a design says a reason gets recorded, I check the log level and the message, and I check that it shows up wherever the operator actually looks.
5. Trace regressions back to the earlier claim. When a new issue is filed against an earlier fix, it records what that fix claimed. That way the earlier closing can be corrected and we can see where the review missed it.
For reviewers, including me
- If a diff changes one call site of a function or rule that’s used elsewhere, grep for the siblings. Require either a change at each one or one sentence per sibling explaining why it’s left alone.
- If a diff narrows a predicate, require the list of previously accepted inputs that still pass.
- Be suspicious of “covered in tests” when the tests only exercise the path from the report.
None of these individual bugs was hard. Each sibling path was a grep away. My mistake was a habit: I stopped when the reported symptom went away instead of when the rule was correct everywhere it applied. From now on I’ll only call something “done” once the whole inventory is covered.