principle-fix-root-causes ยท diff
git:20260907.e8d856f to git:20261116.2f87c85
6 added, 15 removed. Audit A to A.
What this update changes in the checks
No check changed: every fixed check gives the same answer before and after this update.
A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.
---
name: principle-fix-root-causes
- description: "Apply when debugging. Trace each symptom to its root cause and fix it there; reproduce first, ask why until you reach it, resist nil-check guards that silence crashes."
+ description: "Apply when debugging. Trace each symptom back to the first place the system went wrong and fix it there. A guard is a fix only when the state it handles is legitimate."
disable-model-invocation: true
---
# Fix Root Causes
- When debugging, do not fix symptoms. Trace every problem to its root cause and fix it there.
-
- **Why:** Symptom fixes accumulate. Each workaround makes the system harder to reason about, and the real bug remains. Root-cause fixes are slower upfront but reduce total debugging time.
-
- **Pattern:**
- - Reproduce first
- - Ask "why" until you hit the root cause
- - Do not add guards (adding a nil check to silence a crash is a symptom fix)
- - If a workaround needs a paragraph-long comment to justify it, the code is wrong (fix the code, not the comment)
- - Check for the pattern, not just the instance (grep for the same pattern, fix all instances)
- - When stuck, instrument. Don't guess (add logging, read the actual error)
-
- **Restart bugs: suspect state before code**
+ Fix the fault, not the place where it surfaced. The root cause is the first place the system did something it should not do, or failed to handle a state it should handle.
- When something "fails after restart," suspect stale persistent state first: config files, caches, lock files, serialized state. If clearing a state file restores behavior, prioritize state validation as the fix.
+ - Reproduce first. Ask "why" until the answer is a wrong decision in the code. When stuck, instrument and read the actual state.
+ - Ask whether the state that triggered the symptom is legitimate. If it is, handle it where the code broke. If it should never exist, a check there hides the bug, so find what produced it. Guards, retries, swallowed errors, clamped values, and discarded state are the usual ways to hide a bug.
+ - Fix the pattern, not the instance. Find every place with the same fault.
+ - If the deciding fact took a deep dig, propose the cheap, always-on signal that would have shown it at first look.