A bug has been fixed. Now perform a comprehensive post-fix analysis to find similar issues across the codebase.
-
Understand the fix: Ask the user (or infer from recent conversation) what the bug was and what pattern caused it.
-
Extract the pattern: Identify:
- The code pattern that caused the bug (e.g.,
getInstance(),setTimeout without cleanup) - Any risky context that makes the pattern dangerous (e.g.,
Tone.,audioContext) - The file that was fixed
- The code pattern that caused the bug (e.g.,
-
Run the post-fix analysis tool:
cd /Users/ade/Documents/projects/tunejs_implementation/keyboardia/app && npx tsx scripts/post-fix-analysis.ts \ --pattern "PATTERN_HERE" \ --risky-context "CONTEXT_HERE" \ --file "FIXED_FILE" \ --symptom "SYMPTOM"
-
Review high-risk matches: For any matches marked as HIGH RISK:
- Read the affected files
- Determine if they have the same bug
- Report findings to the user
-
Update documentation if warranted: If this is a new bug pattern:
- Consider adding to
src/utils/bug-patterns.ts - Consider adding to
docs/DEBUGGING-LESSONS-LEARNED.md - Use
npx tsx scripts/bug-capture.ts --interactiveif detailed capture needed
- Consider adding to
-
Report to user:
- How many similar patterns were found
- Which are high risk and need review
- Recommendations for prevention
User: "I fixed a singleton bug in engine.ts where getInstance() was caching Tone.js nodes"
Response:
- Run post-fix analysis with pattern
getInstance\(\)and risky contextTone\. - Review matches in audio/ directory
- Report findings
$ARGUMENTS - Optional: Description of the bug that was fixed (pattern, file, symptom)