@tinkcarlos/skillora 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/.temp-skill-index.md +245 -0
- package/.claude/skills/SKILL.md +264 -0
- package/.claude/skills/api-scaffolding/SKILL.md +431 -0
- package/.claude/skills/api-scaffolding/agents/backend-architect.md +282 -0
- package/.claude/skills/api-scaffolding/agents/django-pro.md +144 -0
- package/.claude/skills/api-scaffolding/agents/fastapi-pro.md +156 -0
- package/.claude/skills/api-scaffolding/agents/graphql-architect.md +146 -0
- package/.claude/skills/api-scaffolding/skills/fastapi-templates/SKILL.md +171 -0
- package/.claude/skills/api-testing-observability/SKILL.md +583 -0
- package/.claude/skills/api-testing-observability/agents/api-documenter.md +146 -0
- package/.claude/skills/api-testing-observability/commands/api-mock.md +1320 -0
- package/.claude/skills/brainstorming/SKILL.md +283 -0
- package/.claude/skills/bug-fixing/SKILL.md +382 -0
- package/.claude/skills/bug-fixing/references/backend-guide.md +132 -0
- package/.claude/skills/bug-fixing/references/bug-guide.md +354 -0
- package/.claude/skills/bug-fixing/references/bug-record-template.md +134 -0
- package/.claude/skills/bug-fixing/references/bug-records.md +88 -0
- package/.claude/skills/bug-fixing/references/code-review-gate.md +81 -0
- package/.claude/skills/bug-fixing/references/common-bugs.md +140 -0
- package/.claude/skills/bug-fixing/references/complete-workflow.md +361 -0
- package/.claude/skills/bug-fixing/references/config-driven-fixes.md +136 -0
- package/.claude/skills/bug-fixing/references/context-isolation-protocol.md +268 -0
- package/.claude/skills/bug-fixing/references/cross-surface-regression.md +120 -0
- package/.claude/skills/bug-fixing/references/database-investigation.md +129 -0
- package/.claude/skills/bug-fixing/references/dependency-and-integrity-protocol.md +369 -0
- package/.claude/skills/bug-fixing/references/fix-completeness-checklist.md +239 -0
- package/.claude/skills/bug-fixing/references/frontend-guide.md +219 -0
- package/.claude/skills/bug-fixing/references/fullstack-joint-guide.md +123 -0
- package/.claude/skills/bug-fixing/references/functional-breakage.md +117 -0
- package/.claude/skills/bug-fixing/references/ide-lint-errors-guide.md +176 -0
- package/.claude/skills/bug-fixing/references/impact-analysis.md +511 -0
- package/.claude/skills/bug-fixing/references/investigation-checklist.md +263 -0
- package/.claude/skills/bug-fixing/references/knowledge-extraction-guide.md +531 -0
- package/.claude/skills/bug-fixing/references/knowledge-workflow.md +212 -0
- package/.claude/skills/bug-fixing/references/post-edit-quality-gate.md +30 -0
- package/.claude/skills/bug-fixing/references/python-env-and-testing.md +126 -0
- package/.claude/skills/bug-fixing/references/rca-guide.md +428 -0
- package/.claude/skills/bug-fixing/references/similar-bug-patterns.md +113 -0
- package/.claude/skills/bug-fixing/references/skill-delegation-guide.md +350 -0
- package/.claude/skills/bug-fixing/references/skill-orchestration.md +155 -0
- package/.claude/skills/bug-fixing/references/testing-strategy.md +350 -0
- package/.claude/skills/bug-fixing/references/tooling-build-scripts.md +162 -0
- package/.claude/skills/bug-fixing/references/user-input-validation.md +77 -0
- package/.claude/skills/bug-fixing/references/ux-patterns.md +158 -0
- package/.claude/skills/bug-fixing/references/windows-terminal-hygiene.md +106 -0
- package/.claude/skills/bug-fixing/references/zero-regression-matrix.md +239 -0
- package/.claude/skills/bug-fixing/references/zero-risk-protocol.md +102 -0
- package/.claude/skills/bug-fixing/scripts/format_code.py +611 -0
- package/.claude/skills/bug-fixing/scripts/generate_report_template.py +74 -0
- package/.claude/skills/bug-fixing/scripts/lint_check.py +816 -0
- package/.claude/skills/bug-fixing/scripts/requirements.txt +36 -0
- package/.claude/skills/cicd-pipeline/SKILL.md +300 -0
- package/.claude/skills/code-review/SKILL.md +535 -0
- package/.claude/skills/code-review/references/anti-pattern-scan.md +102 -0
- package/.claude/skills/code-review/references/automated-analysis.md +456 -0
- package/.claude/skills/code-review/references/backend-common-issues.md +589 -0
- package/.claude/skills/code-review/references/backend-expert-guide.md +415 -0
- package/.claude/skills/code-review/references/backend-review.md +868 -0
- package/.claude/skills/code-review/references/batch-processing-strategy.md +198 -0
- package/.claude/skills/code-review/references/call-chain-analysis-protocol.md +166 -0
- package/.claude/skills/code-review/references/common-patterns.md +321 -0
- package/.claude/skills/code-review/references/configuration-review.md +425 -0
- package/.claude/skills/code-review/references/control-flow-completeness.md +114 -0
- package/.claude/skills/code-review/references/database-review.md +298 -0
- package/.claude/skills/code-review/references/dependency-and-integrity-protocol.md +313 -0
- package/.claude/skills/code-review/references/external-standards.md +51 -0
- package/.claude/skills/code-review/references/feature-review.md +329 -0
- package/.claude/skills/code-review/references/file-review-template.md +326 -0
- package/.claude/skills/code-review/references/frontend-advanced.md +654 -0
- package/.claude/skills/code-review/references/frontend-common-issues.md +482 -0
- package/.claude/skills/code-review/references/frontend-expert-guide.md +342 -0
- package/.claude/skills/code-review/references/frontend-review.md +783 -0
- package/.claude/skills/code-review/references/fullstack-consistency.md +418 -0
- package/.claude/skills/code-review/references/fullstack-review.md +477 -0
- package/.claude/skills/code-review/references/functional-completeness.md +386 -0
- package/.claude/skills/code-review/references/hidden-bugs-detection.md +473 -0
- package/.claude/skills/code-review/references/ide-lint-errors-guide.md +173 -0
- package/.claude/skills/code-review/references/infrastructure-review.md +453 -0
- package/.claude/skills/code-review/references/iteration-review.md +264 -0
- package/.claude/skills/code-review/references/job-review.md +335 -0
- package/.claude/skills/code-review/references/layered-checklist-protocol.md +157 -0
- package/.claude/skills/code-review/references/logic-completeness.md +535 -0
- package/.claude/skills/code-review/references/mandatory-checklist.md +288 -0
- package/.claude/skills/code-review/references/multi-language-guide.md +800 -0
- package/.claude/skills/code-review/references/new-project-review.md +226 -0
- package/.claude/skills/code-review/references/non-code-files-review.md +451 -0
- package/.claude/skills/code-review/references/overlooked-issues.md +657 -0
- package/.claude/skills/code-review/references/platform-specific-review.md +195 -0
- package/.claude/skills/code-review/references/precision-analysis-protocol.md +260 -0
- package/.claude/skills/code-review/references/python-patterns.md +494 -0
- package/.claude/skills/code-review/references/rca-techniques.md +362 -0
- package/.claude/skills/code-review/references/report-template.md +430 -0
- package/.claude/skills/code-review/references/resource-limits-and-degradation.md +137 -0
- package/.claude/skills/code-review/references/review-dimensions.md +311 -0
- package/.claude/skills/code-review/references/review-guide.md +202 -0
- package/.claude/skills/code-review/references/review-knowledge-workflow.md +257 -0
- package/.claude/skills/code-review/references/review-progress-tracker-protocol.md +172 -0
- package/.claude/skills/code-review/references/review-record-template.md +195 -0
- package/.claude/skills/code-review/references/skill-orchestration.md +143 -0
- package/.claude/skills/code-review/references/ui-ux-review.md +470 -0
- package/.claude/skills/containerization/SKILL.md +313 -0
- package/.claude/skills/database-migrations/agents/database-admin.md +142 -0
- package/.claude/skills/database-migrations/agents/database-optimizer.md +144 -0
- package/.claude/skills/database-migrations/commands/migration-observability.md +408 -0
- package/.claude/skills/database-migrations/commands/sql-migrations.md +492 -0
- package/.claude/skills/finishing-a-development-branch/SKILL.md +319 -0
- package/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/.claude/skills/frontend-design/SKILL.md +587 -0
- package/.claude/skills/frontend-design/references/color-consistency.md +487 -0
- package/.claude/skills/frontend-design/references/color-palettes-full.md +657 -0
- package/.claude/skills/frontend-design/references/design-system-generator.md +285 -0
- package/.claude/skills/frontend-design/references/font-pairings-full.md +705 -0
- package/.claude/skills/frontend-design/references/industry-anti-patterns.md +281 -0
- package/.claude/skills/frontend-design/references/layout-anti-patterns.md +582 -0
- package/.claude/skills/frontend-design/references/motion-patterns.md +659 -0
- package/.claude/skills/frontend-design/references/pre-delivery-checklist.md +153 -0
- package/.claude/skills/frontend-design/references/responsive-design.md +555 -0
- package/.claude/skills/frontend-design/references/style-modification-rules.md +335 -0
- package/.claude/skills/frontend-design/references/ui-styles-full.md +383 -0
- package/.claude/skills/frontend-design/references/ui-styles-rating.md +191 -0
- package/.claude/skills/frontend-design/references/ux-guidelines.md +640 -0
- package/.claude/skills/fullstack-developer/SKILL.md +512 -0
- package/.claude/skills/fullstack-developer/references/api-contract-guide.md +312 -0
- package/.claude/skills/fullstack-developer/references/api-response-patterns.md +223 -0
- package/.claude/skills/fullstack-developer/references/async-patterns.md +220 -0
- package/.claude/skills/fullstack-developer/references/bug-prevention.md +914 -0
- package/.claude/skills/fullstack-developer/references/code-quality-checklist.md +271 -0
- package/.claude/skills/fullstack-developer/references/complete-development-workflow.md +278 -0
- package/.claude/skills/fullstack-developer/references/context-isolation-protocol.md +256 -0
- package/.claude/skills/fullstack-developer/references/database-migration.md +331 -0
- package/.claude/skills/fullstack-developer/references/dependency-and-integrity-protocol.md +390 -0
- package/.claude/skills/fullstack-developer/references/development-phases.md +333 -0
- package/.claude/skills/fullstack-developer/references/expert-guide.md +214 -0
- package/.claude/skills/fullstack-developer/references/file-import-patterns.md +114 -0
- package/.claude/skills/fullstack-developer/references/graceful-degradation-patterns.md +78 -0
- package/.claude/skills/fullstack-developer/references/ide-lint-errors-guide.md +183 -0
- package/.claude/skills/fullstack-developer/references/integration-testing.md +301 -0
- package/.claude/skills/fullstack-developer/references/mock-api-patterns.md +307 -0
- package/.claude/skills/fullstack-developer/references/phase-gate-template.md +249 -0
- package/.claude/skills/fullstack-developer/references/post-edit-quality-gate.md +30 -0
- package/.claude/skills/fullstack-developer/references/python-engineering.md +79 -0
- package/.claude/skills/fullstack-developer/references/skill-orchestration.md +214 -0
- package/.claude/skills/fullstack-developer/references/skill-router-table.md +304 -0
- package/.claude/skills/fullstack-developer/references/state-sync.md +217 -0
- package/.claude/skills/fullstack-developer/references/ui-testing-checklist.md +292 -0
- package/.claude/skills/fullstack-developer/scripts/format_code.py +611 -0
- package/.claude/skills/fullstack-developer/scripts/lint_check.py +816 -0
- package/.claude/skills/fullstack-developer/scripts/requirements.txt +36 -0
- package/.claude/skills/performance-optimization/SKILL.md +250 -0
- package/.claude/skills/product-requirements/SKILL.md +357 -0
- package/.claude/skills/product-requirements/references/acceptance-criteria.md +335 -0
- package/.claude/skills/product-requirements/references/answer-first-questioning-protocol.md +299 -0
- package/.claude/skills/product-requirements/references/competitive-analysis-guide.md +183 -0
- package/.claude/skills/product-requirements/references/document-accuracy-protocol.md +253 -0
- package/.claude/skills/product-requirements/references/document-management-protocol.md +278 -0
- package/.claude/skills/product-requirements/references/external-standards.md +62 -0
- package/.claude/skills/product-requirements/references/feature-spec-template.md +359 -0
- package/.claude/skills/product-requirements/references/knowledge-acquisition-protocol.md +251 -0
- package/.claude/skills/product-requirements/references/plan-execution-protocol.md +334 -0
- package/.claude/skills/product-requirements/references/plan-generation-protocol.md +264 -0
- package/.claude/skills/product-requirements/references/prioritization-frameworks.md +80 -0
- package/.claude/skills/product-requirements/references/requirement-decomposition-protocol.md +291 -0
- package/.claude/skills/product-requirements/references/user-story-examples.md +297 -0
- package/.claude/skills/product-requirements/references/workflow-templates.md +266 -0
- package/.claude/skills/react-best-practices/SKILL.md +198 -0
- package/.claude/skills/react-best-practices/references/advanced-patterns.md +94 -0
- package/.claude/skills/react-best-practices/references/bundle-optimization.md +182 -0
- package/.claude/skills/react-best-practices/references/client-data-fetching.md +112 -0
- package/.claude/skills/react-best-practices/references/complete-guide.md +2249 -0
- package/.claude/skills/react-best-practices/references/eliminating-waterfalls.md +169 -0
- package/.claude/skills/react-best-practices/references/javascript-performance.md +256 -0
- package/.claude/skills/react-best-practices/references/rendering-performance.md +230 -0
- package/.claude/skills/react-best-practices/references/rerender-optimization.md +214 -0
- package/.claude/skills/react-best-practices/references/server-performance.md +182 -0
- package/.claude/skills/security-audit/SKILL.md +226 -0
- package/.claude/skills/shared-references/advanced-debugging-techniques.md +186 -0
- package/.claude/skills/shared-references/code-quality-checklist.md +218 -0
- package/.claude/skills/shared-references/code-review-efficiency-guide.md +125 -0
- package/.claude/skills/shared-references/mcp-dependency-compatibility-protocol.md +276 -0
- package/.claude/skills/shared-references/skill-call-graph.md +230 -0
- package/.claude/skills/shared-references/skill-orchestration-protocol.md +281 -0
- package/.claude/skills/shared-references/subagent-dispatch-templates.md +199 -0
- package/.claude/skills/skill-expert-skills/LICENSE.txt +204 -0
- package/.claude/skills/skill-expert-skills/QUICK_NAVIGATION.md +374 -0
- package/.claude/skills/skill-expert-skills/SKILL.md +247 -0
- package/.claude/skills/skill-expert-skills/docs/_index.md +91 -0
- package/.claude/skills/skill-expert-skills/references/deep-research-methodology.md +389 -0
- package/.claude/skills/skill-expert-skills/references/docs-generation-workflow.md +398 -0
- package/.claude/skills/skill-expert-skills/references/domain-expertise-protocol.md +343 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/_index.md +54 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/backend-expertise.md +517 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/bug-fixing-expertise.md +363 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/code-review-expertise.md +392 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge/frontend-expertise.md +410 -0
- package/.claude/skills/skill-expert-skills/references/domain-knowledge-template.md +503 -0
- package/.claude/skills/skill-expert-skills/references/examples.md +782 -0
- package/.claude/skills/skill-expert-skills/references/integration-examples.md +655 -0
- package/.claude/skills/skill-expert-skills/references/knowledge-validation-checklist.md +246 -0
- package/.claude/skills/skill-expert-skills/references/latest-knowledge-acquisition.md +461 -0
- package/.claude/skills/skill-expert-skills/references/mcp-tools-guide.md +439 -0
- package/.claude/skills/skill-expert-skills/references/official-best-practices.md +616 -0
- package/.claude/skills/skill-expert-skills/references/patterns.md +218 -0
- package/.claude/skills/skill-expert-skills/references/plugin-skills-guide.md +432 -0
- package/.claude/skills/skill-expert-skills/references/requirement-elicitation-protocol.md +290 -0
- package/.claude/skills/skill-expert-skills/references/skill-creator-SKILL.md +353 -0
- package/.claude/skills/skill-expert-skills/references/skill-templates.md +583 -0
- package/.claude/skills/skill-expert-skills/references/skills-knowledge-base.md +561 -0
- package/.claude/skills/skill-expert-skills/references/tools-guide.md +379 -0
- package/.claude/skills/skill-expert-skills/references/troubleshooting.md +378 -0
- package/.claude/skills/skill-expert-skills/references/universality-guide.md +205 -0
- package/.claude/skills/skill-expert-skills/references/writing-style-guide.md +466 -0
- package/.claude/skills/skill-expert-skills/scripts/__pycache__/quick_validate.cpython-313.pyc +0 -0
- package/.claude/skills/skill-expert-skills/scripts/__pycache__/universal_validate.cpython-313.pyc +0 -0
- package/.claude/skills/skill-expert-skills/scripts/analyze_trigger.py +425 -0
- package/.claude/skills/skill-expert-skills/scripts/diff_with_official.py +188 -0
- package/.claude/skills/skill-expert-skills/scripts/init_skill.py +349 -0
- package/.claude/skills/skill-expert-skills/scripts/package_skill.py +156 -0
- package/.claude/skills/skill-expert-skills/scripts/quick_validate.py +493 -0
- package/.claude/skills/skill-expert-skills/scripts/requirements.txt +2 -0
- package/.claude/skills/skill-expert-skills/scripts/universal_validate.py +182 -0
- package/.claude/skills/skill-expert-skills/scripts/upgrade_skill.py +431 -0
- package/.claude/skills/subagent-driven-development/SKILL.md +268 -0
- package/.claude/skills/test-driven-development/SKILL.md +246 -0
- package/.claude/skills/test-driven-development/references/testing-anti-patterns.md +192 -0
- package/.claude/skills/using-git-worktrees/SKILL.md +266 -0
- package/.claude/skills/using-skillstack/SKILL.md +127 -0
- package/.claude/skills/vercel-deploy/SKILL.md +166 -0
- package/.claude/skills/vercel-deploy/scripts/deploy.sh +249 -0
- package/.claude/skills/verification-before-completion/SKILL.md +305 -0
- package/.claude/skills/writing-plans/SKILL.md +259 -0
- package/README.md +69 -0
- package/bin/cli.js +468 -0
- package/lib/init.js +333 -0
- package/package.json +29 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Backend Bug-Fixing Guide – 2025 Edition
|
|
2
|
+
|
|
3
|
+
> Enterprise-grade guide for Java, Python, Go, Node.js, SQL, and distributed systems.
|
|
4
|
+
|
|
5
|
+
20+ years of production war stories → one unbreakable playbook.
|
|
6
|
+
|
|
7
|
+
## Core Philosophy
|
|
8
|
+
> "Backend bugs aren't just code—they're concurrency, transactions, or hidden state. Fix the system, not the symptom."
|
|
9
|
+
|
|
10
|
+
## The 5-Step Backend Repair Process
|
|
11
|
+
|
|
12
|
+
### 1. Reproduce & Isolate – Capture the Culprit
|
|
13
|
+
80% of "intermittent" bugs are environmental ghosts.
|
|
14
|
+
|
|
15
|
+
| Check | Verification Method |
|
|
16
|
+
|------------------------|----------------------------------------------------------|
|
|
17
|
+
| Load (QPS) | Artillery / k6 load test to match prod traffic |
|
|
18
|
+
| Database state | Dump prod-like data to local (anonymized) |
|
|
19
|
+
| Config drift | `diff dev/prod` for env vars, Spring profiles, etc. |
|
|
20
|
+
| Concurrency | Run with 10+ parallel threads/users |
|
|
21
|
+
| Logs / Traces | Full Jaeger/OpenTelemetry spans (not just console logs) |
|
|
22
|
+
|
|
23
|
+
Tools: Docker Compose (mirror prod env), Postman Newman (replay requests), Prometheus (metrics baseline)
|
|
24
|
+
|
|
25
|
+
### 2. Root Cause Analysis – Deep Dive
|
|
26
|
+
99% of re-opened bugs missed the true root.
|
|
27
|
+
|
|
28
|
+
Techniques:
|
|
29
|
+
- **5 Whys**: Why transaction failed? → Rollback timeout. Why? → Isolation level wrong.
|
|
30
|
+
- **Full Trace**: Controller → Service → Repo → DB (check locks, deadlocks)
|
|
31
|
+
- **Concurrency Detector**: Go race detector, Java ThreadMXBean dumps
|
|
32
|
+
|
|
33
|
+
Common traps:
|
|
34
|
+
- Async ghosts: Node Promise chains break, Go goroutine leaks
|
|
35
|
+
- Resource exhaustion: Unclosed connections → pool starvation
|
|
36
|
+
|
|
37
|
+
### 3. Surgical Fix – Minimal Invasion
|
|
38
|
+
Guidelines:
|
|
39
|
+
- Touch only the failure point (≤20 LOC)
|
|
40
|
+
- Preserve old paths under feature flags
|
|
41
|
+
- Idempotent: Retries must be safe
|
|
42
|
+
- Rollback-friendly: No schema changes without migration
|
|
43
|
+
|
|
44
|
+
```java
|
|
45
|
+
// Bad – rewrites entire service
|
|
46
|
+
@Transactional
|
|
47
|
+
public User getUser(Long id) { ... }
|
|
48
|
+
|
|
49
|
+
// Good – minimal guard
|
|
50
|
+
@Transactional(readOnly = true)
|
|
51
|
+
public User getUser(Long id) {
|
|
52
|
+
User user = repo.findById(id);
|
|
53
|
+
if (user == null) throw new UserNotFoundException(id); // Only this line added
|
|
54
|
+
return user;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Full-Stack Validation – Iron Testing
|
|
59
|
+
Unit green ≠ system stable.
|
|
60
|
+
|
|
61
|
+
Checklist:
|
|
62
|
+
- [ ] Unit: JUnit/Pytest (happy + edges + fault injection)
|
|
63
|
+
- [ ] Integration: Testcontainers (real DB/Redis)
|
|
64
|
+
- [ ] E2E/Load: k6/JMeter (network failures + peak load)
|
|
65
|
+
- [ ] Staging: Prod-like env (exact Java/Go/Python versions)
|
|
66
|
+
- [ ] Security: OWASP ZAP / Bandit static scan
|
|
67
|
+
- [ ] Blind Regression: QA re-tests original steps blindly
|
|
68
|
+
|
|
69
|
+
Pitfall: Local "Read Committed" hides prod Phantom Reads under concurrency.
|
|
70
|
+
|
|
71
|
+
### 5. Future-Proofing – Immunize the System
|
|
72
|
+
- AOP guards: Spring Interceptors for null checks
|
|
73
|
+
- CI hooks: Linting for common patterns
|
|
74
|
+
- Docs: PR tags "Bug #123 | Root: Concurrency | Fix: Lock"
|
|
75
|
+
|
|
76
|
+
## Common Backend Pitfalls Checklist (2025)
|
|
77
|
+
|
|
78
|
+
| Bug Type | Scenario & Root Cause | Fix & Prevention | Framework Traps |
|
|
79
|
+
|-------------------|------------------------------------------------|-------------------------------------------------------|------------------------------------------|
|
|
80
|
+
| **Logic/Data** | N+1 queries, missing transaction rollback | Fetch joins / pagination. Verify isolation levels | Hibernate lazy init vs SQLAlchemy dialects |
|
|
81
|
+
| **Concurrency** | Shared state no lock, Go channel deadlock | Mutex / optimistic locking. Run race detector | Go sync.Map copies; Java Virtual Threads pinning |
|
|
82
|
+
| **Performance** | O(n²) loops, cache penetration | Indexing + Bloom filters. Redis rate limiting | Node cluster imbalance; Python GIL on CPU |
|
|
83
|
+
| **Security** | SQL injection, JWT no signature | Parameterized queries. OWASP scans | Spring Security scopes; FastAPI Pydantic |
|
|
84
|
+
| **Resource Leak** | Unclosed connections, memory leaks | RAII / try-with-resources. Profiling (Valgrind) | Go defer close(); Java DirectByteBuffer |
|
|
85
|
+
| **Compatibility** | Dep conflicts, serialization mismatch | Version pinning. Protobuf schemas | Go mod vendor; Python AST changes |
|
|
86
|
+
| **Async/Net** | Unhandled Promise rejects, timeouts | Await coverage + timeouts. Mock externals | Node AbortController; Gin middleware |
|
|
87
|
+
| **Observability** | Sensitive logs, missing trace IDs | Structured + MDC. ELK tracing | Log4j vulns; Zap logger hooks |
|
|
88
|
+
| **Config Drift** | Env fallback missing | Unified config (Viper). Smoke tests | Spring @Value defaults; Make ifdefs |
|
|
89
|
+
|
|
90
|
+
## Quick Copy-Paste Fixes
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
# Atomic balance update (race-proof)
|
|
94
|
+
cursor.execute(
|
|
95
|
+
"UPDATE accounts SET balance = balance - %s WHERE id = %s AND balance >= %s",
|
|
96
|
+
(amount, account_id, amount)
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# Go error handling (no swallow)
|
|
100
|
+
err := db.QueryRow("SELECT ...").Scan(&user)
|
|
101
|
+
if err != nil {
|
|
102
|
+
return fmt.Errorf("query failed: %w", err) // Wrap, don't ignore
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
# Java try-with-resources (no leaks)
|
|
106
|
+
try (Connection conn = dataSource.getConnection();
|
|
107
|
+
PreparedStatement stmt = conn.prepareStatement("...")) {
|
|
108
|
+
// Use stmt
|
|
109
|
+
} // Auto-close
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## PR Template for Backend Fixes
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
## Bug Fix – Backend
|
|
116
|
+
|
|
117
|
+
**Bug ID**: BUG-XXXX
|
|
118
|
+
**Severity**: High / Medium / Low
|
|
119
|
+
**Reproduction**: (Postman collection or k6 script link)
|
|
120
|
+
|
|
121
|
+
**Root Cause**: (e.g., Missing row lock in concurrent update)
|
|
122
|
+
|
|
123
|
+
**Fix Approach**: Atomic SQL update + feature flag (if zero-risk)
|
|
124
|
+
|
|
125
|
+
**Validation**:
|
|
126
|
+
- [x] Unit tests with fault injection
|
|
127
|
+
- [x] Integration with Testcontainers
|
|
128
|
+
- [x] Load test: 10k QPS no failures
|
|
129
|
+
- [x] Staging smoke tests green
|
|
130
|
+
- [x] No security scan regressions
|
|
131
|
+
|
|
132
|
+
**Prevention**: Added to common-bugs.md + new linter rule
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# Bug Fixing Universal Guide
|
|
2
|
+
|
|
3
|
+
This document provides cross-project bug patterns, detection methods, and fix strategies. Updated periodically by extracting patterns from project-level bug records.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Common Bug Pattern Library
|
|
8
|
+
|
|
9
|
+
### Category 1: Input Handling Bugs
|
|
10
|
+
|
|
11
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
12
|
+
|---------|-----------------|-----------|--------------|
|
|
13
|
+
| **Format assumption mismatch** | User input doesn't match expected format | Check parser/validator logic | Add input normalization at parse time |
|
|
14
|
+
| **Missing input validation** | Crash or unexpected behavior on edge input | Test with empty/null/special chars | Add validation before processing |
|
|
15
|
+
| **Encoding issues** | Garbled text, truncation | Check charset handling | Ensure consistent UTF-8 throughout |
|
|
16
|
+
| **Whitespace sensitivity** | Matching fails unexpectedly | Compare with trimmed values | Normalize whitespace at input |
|
|
17
|
+
|
|
18
|
+
### Category 2: Status/State Bugs
|
|
19
|
+
|
|
20
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
21
|
+
|---------|-----------------|-----------|--------------|
|
|
22
|
+
| **Status mismatch** | UI says success but operation failed | Check both HTTP and business status | Parse full response body |
|
|
23
|
+
| **Stale state** | Shows outdated data after updates | Check state invalidation | Refresh state after mutations |
|
|
24
|
+
| **Race condition** | Intermittent failures, order-dependent | Add timing logs, stress test | Add proper synchronization |
|
|
25
|
+
| **Orphaned state** | Cleanup not triggered | Check cleanup paths | Ensure cleanup on all exit paths |
|
|
26
|
+
|
|
27
|
+
### Category 3: API Integration Bugs
|
|
28
|
+
|
|
29
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
30
|
+
|---------|-----------------|-----------|--------------|
|
|
31
|
+
| **Missing timeout** | Request hangs forever | Check timeout config | Add explicit timeout |
|
|
32
|
+
| **No retry logic** | Transient failures cause permanent errors | Check retry implementation | Add retry with backoff |
|
|
33
|
+
| **Response shape assumption** | Crash on unexpected API response | Check response parsing | Add defensive parsing |
|
|
34
|
+
| **Missing error propagation** | Errors silently swallowed | Trace error flow | Ensure errors surface |
|
|
35
|
+
|
|
36
|
+
### Category 4: Data Flow Bugs
|
|
37
|
+
|
|
38
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
39
|
+
|---------|-----------------|-----------|--------------|
|
|
40
|
+
| **Transform mismatch** | Data displays incorrectly | Trace data path end-to-end | Fix transformation logic |
|
|
41
|
+
| **Missing null check** | Crash on undefined/null | Check optional chaining | Add null guards |
|
|
42
|
+
| **Off-by-one errors** | Pagination/indexing issues | Check boundary conditions | Verify index calculations |
|
|
43
|
+
| **Type coercion** | Unexpected comparison results | Check type handling | Use explicit type conversion |
|
|
44
|
+
| **State-Display Mismatch** | UI doesn't reflect state changes | Compare write format vs read logic | Ensure read logic handles all write formats |
|
|
45
|
+
| **Parent-Child Selection Inconsistency** | Parent checked but children unchecked | Trace selection cascade logic | Read logic must check parent state |
|
|
46
|
+
|
|
47
|
+
### Category 5: Configuration Bugs
|
|
48
|
+
|
|
49
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
50
|
+
|---------|-----------------|-----------|--------------|
|
|
51
|
+
| **Environment mismatch** | Works in dev, fails in prod | Compare env configurations | Ensure config parity |
|
|
52
|
+
| **Missing default** | Crash when config not set | Check fallback values | Add sensible defaults |
|
|
53
|
+
| **Config priority confusion** | Wrong value used | Trace config loading order | Document config precedence |
|
|
54
|
+
| **Secret exposure** | Secrets in logs/UI | Search for sensitive data | Redact before logging |
|
|
55
|
+
|
|
56
|
+
### Category 5.1: 🔴 Multi-Environment Configuration Bugs (CRITICAL)
|
|
57
|
+
|
|
58
|
+
> **This is the #1 cause of "fix doesn't work" scenarios!**
|
|
59
|
+
|
|
60
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
61
|
+
|---------|-----------------|-----------|--------------|
|
|
62
|
+
| **Partial env file fix** | Fix works in prod, fails in dev | Check ALL .env* files | Update ALL environment files |
|
|
63
|
+
| **Startup script mismatch** | bat/sh uses different env | Check startup scripts | Verify which env file each script uses |
|
|
64
|
+
| **Config loading order** | Wrong value overrides correct one | Trace config loading | Document and fix precedence |
|
|
65
|
+
| **Missing env variable** | Feature works locally, fails in CI/CD | Compare local vs CI env | Add variable to all environments |
|
|
66
|
+
|
|
67
|
+
**Real-World Case Study:**
|
|
68
|
+
```
|
|
69
|
+
Problem: User's bat script used dev env file, but bug fix only added production env config
|
|
70
|
+
Result: Bug persisted when running in dev mode
|
|
71
|
+
|
|
72
|
+
Root Cause Analysis:
|
|
73
|
+
- dev.bat → loads .env.development
|
|
74
|
+
- npm run start → loads .env.production
|
|
75
|
+
- Fix only updated .env.production
|
|
76
|
+
- Dev mode never got the fix!
|
|
77
|
+
|
|
78
|
+
Correct Fix:
|
|
79
|
+
1. Identify ALL env files: .env, .env.development, .env.production, .env.test
|
|
80
|
+
2. Identify ALL startup scripts: dev.bat, start.bat, npm scripts
|
|
81
|
+
3. Map: script → env file → variable
|
|
82
|
+
4. Apply fix to ALL relevant env files
|
|
83
|
+
5. Verify in ALL modes
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Environment File Checklist (MANDATORY for config bugs):**
|
|
87
|
+
|
|
88
|
+
| File | Check | Updated |
|
|
89
|
+
|------|-------|---------|
|
|
90
|
+
| `.env` | [ ] | [ ] |
|
|
91
|
+
| `.env.local` | [ ] | [ ] |
|
|
92
|
+
| `.env.development` | [ ] | [ ] |
|
|
93
|
+
| `.env.development.local` | [ ] | [ ] |
|
|
94
|
+
| `.env.test` | [ ] | [ ] |
|
|
95
|
+
| `.env.staging` | [ ] | [ ] |
|
|
96
|
+
| `.env.production` | [ ] | [ ] |
|
|
97
|
+
| `.env.production.local` | [ ] | [ ] |
|
|
98
|
+
|
|
99
|
+
**Startup Script Checklist:**
|
|
100
|
+
|
|
101
|
+
| Script | Mode | Env File Used | Verified |
|
|
102
|
+
|--------|------|---------------|----------|
|
|
103
|
+
| `npm run dev` | Development | ? | [ ] |
|
|
104
|
+
| `npm run start` | Production | ? | [ ] |
|
|
105
|
+
| `dev.bat` / `dev.sh` | Development | ? | [ ] |
|
|
106
|
+
| `start.bat` / `start.sh` | Production | ? | [ ] |
|
|
107
|
+
| Docker Compose | Various | ? | [ ] |
|
|
108
|
+
|
|
109
|
+
**Quick Detection Commands:**
|
|
110
|
+
```bash
|
|
111
|
+
# Find all env files
|
|
112
|
+
find . -name ".env*" -o -name "*.env" 2>/dev/null
|
|
113
|
+
|
|
114
|
+
# Search for a config key across all files
|
|
115
|
+
grep -rn "YOUR_CONFIG_KEY" . --include="*.env*" --include="*.yml" --include="*.json"
|
|
116
|
+
|
|
117
|
+
# Find startup scripts
|
|
118
|
+
grep -rn "NODE_ENV\|VITE_\|REACT_APP_" . --include="*.sh" --include="*.bat" --include="package.json"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Category 5.2: 🔴 JSON/Regex Processing Bugs (CRITICAL)
|
|
122
|
+
|
|
123
|
+
> **This is a common cause of "hook error" or "parsing failed" scenarios!**
|
|
124
|
+
|
|
125
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
126
|
+
|---------|-----------------|-----------|--------------
|
|
127
|
+
| **Unnecessary JSON preprocessing** | JSON parsing fails after "fix" | Check if input is already valid JSON | Remove unnecessary regex/preprocessing |
|
|
128
|
+
| **Double-escaping backslashes** | `\\path` becomes `\\\path` | Compare input vs processed output | Trust the source, don't over-process |
|
|
129
|
+
| **Regex breaking valid escapes** | Valid `\\` becomes invalid `\\\` | Test with Windows paths containing `\` | Verify regex doesn't match already-escaped chars |
|
|
130
|
+
|
|
131
|
+
**Real-World Case Study:**
|
|
132
|
+
```
|
|
133
|
+
Problem: PowerShell hook script tried to "fix" Windows paths in JSON
|
|
134
|
+
Result: Valid JSON like {"cwd":"D:\\test\\path"} became invalid {"cwd":"D:\\test\\\path"}
|
|
135
|
+
|
|
136
|
+
Root Cause Analysis:
|
|
137
|
+
- Claude Code passes properly escaped JSON (backslashes are already \\)
|
|
138
|
+
- Script used regex to "fix" unescaped backslashes
|
|
139
|
+
- Regex matched the second \ in \\ and added another \
|
|
140
|
+
- Result: Triple backslash \\\ which is invalid JSON
|
|
141
|
+
|
|
142
|
+
Correct Fix:
|
|
143
|
+
1. Trust the input - Claude Code sends valid JSON
|
|
144
|
+
2. Remove unnecessary preprocessing regex
|
|
145
|
+
3. Parse JSON directly without modification
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**JSON Processing Checklist (MANDATORY for hook scripts):**
|
|
149
|
+
|
|
150
|
+
| Check | Action |
|
|
151
|
+
|-------|--------|
|
|
152
|
+
| Is input already valid JSON? | Test with `ConvertFrom-Json` directly first |
|
|
153
|
+
| Does preprocessing break valid input? | Test with Windows paths like `D:\test\path` |
|
|
154
|
+
| Is regex necessary? | Usually NO - trust the source |
|
|
155
|
+
|
|
156
|
+
### Category 6: Platform-Specific Bugs
|
|
157
|
+
|
|
158
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
159
|
+
|---------|-----------------|-----------|--------------|
|
|
160
|
+
| **API not available** | Feature fails in specific environment | Check platform compatibility | Add feature detection/fallback |
|
|
161
|
+
| **Permission denied** | Operation blocked | Check security config | Configure required permissions |
|
|
162
|
+
| **Path handling** | File operations fail across OS | Check path separators | Use platform-agnostic paths |
|
|
163
|
+
| **Binary vs text** | File corruption | Check read/write modes | Use correct mode for file type |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### Category 7: State-Display Consistency Bugs (NEW)
|
|
168
|
+
|
|
169
|
+
These bugs occur when the **write path** (how data is stored) and **read path** (how data is displayed) use inconsistent logic.
|
|
170
|
+
|
|
171
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
172
|
+
|---------|-----------------|-----------|--------------|
|
|
173
|
+
| **Write-Read Format Mismatch** | Action succeeds but UI doesn't update | Compare storage format vs display query | Align read query to handle all write formats |
|
|
174
|
+
| **Derived State Inconsistency** | Parent/child selection out of sync | Trace state derivation chain | Derive child state from parent, not vice versa |
|
|
175
|
+
| **Implicit vs Explicit State** | Checked item appears unchecked | Check if read assumes explicit storage | Read must handle implicit states (e.g., inherited from parent) |
|
|
176
|
+
| **Partial Update** | Some UI elements update, others don't | Trace all consumers of the state | Ensure all consumers react to state changes |
|
|
177
|
+
|
|
178
|
+
**Key Detection Questions:**
|
|
179
|
+
1. **What format does the WRITE function store?** (e.g., `{ type: 'folder', id }`)
|
|
180
|
+
2. **What format does the READ function expect?** (e.g., `t.type === 'interface'`)
|
|
181
|
+
3. **Do they match?** If not, the read must be extended to handle write's format.
|
|
182
|
+
|
|
183
|
+
**Common Scenario (Tree Selection):**
|
|
184
|
+
- Write: Store parent selection → `[{ type: 'folder', id: 1 }]`
|
|
185
|
+
- Read (buggy): Only checks `type === 'interface'` → Child shows unchecked
|
|
186
|
+
- Read (fixed): Checks `type === 'interface' || parentIsSelected(id)` → Child shows checked
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
### Category 8: Component Integration & Feature Propagation (NEW)
|
|
191
|
+
|
|
192
|
+
These bugs occur when a shared component is updated or reused, but not all consumers provide the required context or props.
|
|
193
|
+
|
|
194
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
195
|
+
|---------|-----------------|-----------|--------------|
|
|
196
|
+
| **Incomplete Prop Propagation** | Feature works in one place, broken in others | Grep all component usages | Ensure all parents pass required props (or use Context) |
|
|
197
|
+
| **Partial Feature Rollout** | New behavior only active in some views | Search for old pattern usage | Global search & replace / Centralize logic |
|
|
198
|
+
| **Context Tunneling** | Component needs data not available in parent | Check component hierarchy | Lift state up or use Global Store/Context |
|
|
199
|
+
| **Style/Theme Inconsistency** | Component looks different in different places | Check CSS inheritance/props | Standardize base styles or use design tokens |
|
|
200
|
+
|
|
201
|
+
**Case Study: Variable Highlighting**
|
|
202
|
+
- **Issue**: Added "gray out missing variables" feature to base `Highlight` component.
|
|
203
|
+
- **Bug**: Only worked in Main Editor, not in Modal/Sidebar.
|
|
204
|
+
- **Root Cause**: `availableVariables` prop was required but not passed by all parent components.
|
|
205
|
+
- **Fix**: Created `useAvailableVariables` hook and updated ALL consumers (`BodyEditor`, `ParamEditor`, `HeaderEditor`) to pass the data.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### Category 9: UI Display Completeness Bugs (NEW)
|
|
210
|
+
|
|
211
|
+
These bugs occur when backend returns data fields but frontend doesn't display them, or displays the wrong field for the context.
|
|
212
|
+
|
|
213
|
+
| Pattern | Typical Symptom | Detection | Fix Strategy |
|
|
214
|
+
|---------|-----------------|-----------|--------------|
|
|
215
|
+
| **Missing Display Component** | Data exists but not shown in UI | Compare API response fields vs UI elements | Add UI component for missing fields |
|
|
216
|
+
| **Wrong Field Priority** | Shows irrelevant data instead of expected | Check field selection logic | Use context-aware field selection |
|
|
217
|
+
| **Destructured but Unused** | Variable destructured but not rendered | Search for destructured-but-unused vars | Add render logic for all destructured data |
|
|
218
|
+
| **Method-agnostic Display** | Same logic for all HTTP methods | Check if display considers method type | Use method-aware logic (e.g., POST→body, GET→params) |
|
|
219
|
+
|
|
220
|
+
**Case Study: Scheduled Task Report**
|
|
221
|
+
- **Issue**: Report missing request headers; request body showing wrong data
|
|
222
|
+
- **Bug 1**: `request_headers` destructured but no `RequestHeadersBlock` component
|
|
223
|
+
- **Bug 2**: `content={request_params || request_body}` always prioritized params
|
|
224
|
+
- **Fix 1**: Added `RequestHeadersBlock` component with table display
|
|
225
|
+
- **Fix 2**: Method-aware priority: POST/PUT/PATCH→body first, GET/DELETE→params first
|
|
226
|
+
|
|
227
|
+
**Display Priority Pattern for HTTP Requests:**
|
|
228
|
+
```
|
|
229
|
+
Method Priority Display
|
|
230
|
+
---------- ----------------
|
|
231
|
+
GET request_params > request_body
|
|
232
|
+
DELETE request_params > request_body
|
|
233
|
+
POST request_body > request_params
|
|
234
|
+
PUT request_body > request_params
|
|
235
|
+
PATCH request_body > request_params
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## High-Frequency Root Causes (Top 13)
|
|
241
|
+
|
|
242
|
+
1. **Assumption without verification**: Assumed API/feature works without checking docs
|
|
243
|
+
2. **Incomplete status checking**: Only checked HTTP status, not business status
|
|
244
|
+
3. **Missing edge case handling**: Didn't consider empty/null/boundary inputs
|
|
245
|
+
4. **Stale closure/state**: Captured old values in callbacks/effects
|
|
246
|
+
5. **Missing cleanup**: Resources not released on error paths
|
|
247
|
+
6. **Environment differences**: Dev/prod config mismatch
|
|
248
|
+
7. **Type misunderstanding**: Wrong assumptions about data types
|
|
249
|
+
8. **Async ordering**: Assumed sequential execution of async operations
|
|
250
|
+
9. **Cache invalidation**: Stale cached data served
|
|
251
|
+
10. **Error swallowing**: Caught errors but didn't surface them
|
|
252
|
+
11. **State-Display Format Mismatch**: Write stores X, read expects Y
|
|
253
|
+
12. **Incomplete Prop Propagation**: Updated base component but missed some consumers
|
|
254
|
+
13. **UI Display Incompleteness**: Backend returns field but frontend doesn't render it (NEW)
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Universal Verification Checklist
|
|
259
|
+
|
|
260
|
+
Before marking any bug as fixed:
|
|
261
|
+
|
|
262
|
+
### Core Checks
|
|
263
|
+
|
|
264
|
+
- [ ] **Original scenario**: Bug no longer reproduces with exact same steps
|
|
265
|
+
- [ ] **Related features**: Adjacent features still work correctly
|
|
266
|
+
- [ ] **Error paths**: Error cases handled gracefully
|
|
267
|
+
- [ ] **Console/logs**: No new errors or warnings
|
|
268
|
+
- [ ] **Build/lint**: Code passes all static checks
|
|
269
|
+
|
|
270
|
+
### Edge Case Checks
|
|
271
|
+
|
|
272
|
+
- [ ] **Empty input**: Handles empty/null/undefined
|
|
273
|
+
- [ ] **Boundary values**: Handles min/max/zero values
|
|
274
|
+
- [ ] **Concurrent access**: No race conditions introduced
|
|
275
|
+
- [ ] **Resource cleanup**: No leaks on any exit path
|
|
276
|
+
|
|
277
|
+
### Regression Checks
|
|
278
|
+
|
|
279
|
+
- [ ] **Existing tests**: All tests still pass
|
|
280
|
+
- [ ] **New tests**: Added tests for the bug scenario
|
|
281
|
+
- [ ] **Similar patterns**: Checked for same bug elsewhere (Global Search)
|
|
282
|
+
- [ ] **Prop consistency**: Verified all consumers of modified components
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Pattern Extraction Guide
|
|
287
|
+
|
|
288
|
+
When you have 5-10 bug records in your project's `bugRecord.md`, extract common patterns:
|
|
289
|
+
|
|
290
|
+
### Step 1: Identify Recurring Themes
|
|
291
|
+
|
|
292
|
+
Group bugs by:
|
|
293
|
+
- Root cause type (input handling, state, API, etc.)
|
|
294
|
+
- Component/module affected
|
|
295
|
+
- Symptom similarity
|
|
296
|
+
|
|
297
|
+
### Step 2: Abstract to Universal Pattern
|
|
298
|
+
|
|
299
|
+
Transform project-specific details to generic patterns:
|
|
300
|
+
|
|
301
|
+
| Project-Specific | Universal Pattern |
|
|
302
|
+
|------------------|-------------------|
|
|
303
|
+
| "Excel column name ${keywords}" | "Wrapper syntax in user input" |
|
|
304
|
+
| "API returns code: -1" | "Business status code in response body" |
|
|
305
|
+
| "React state not updated" | "Stale closure in async callback" |
|
|
306
|
+
|
|
307
|
+
### Step 3: Document in This Guide
|
|
308
|
+
|
|
309
|
+
Add new patterns to the appropriate category table above with:
|
|
310
|
+
- Pattern name
|
|
311
|
+
- Typical symptom
|
|
312
|
+
- Detection method
|
|
313
|
+
- Fix strategy
|
|
314
|
+
|
|
315
|
+
### Step 4: Update Verification Checklist
|
|
316
|
+
|
|
317
|
+
If the pattern reveals a new verification need, add it to the checklist.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Anti-Patterns to Avoid
|
|
322
|
+
|
|
323
|
+
| Anti-Pattern | Why It's Bad | Better Approach |
|
|
324
|
+
|--------------|--------------|-----------------|
|
|
325
|
+
| **Fixing symptoms** | Root cause remains, bug recurs | Trace to true root cause |
|
|
326
|
+
| **Massive refactor** | High regression risk | Minimal surgical fix |
|
|
327
|
+
| **No verification** | Bug may not be fixed | Always test before claiming fixed |
|
|
328
|
+
| **Silent fix** | Lost learning opportunity | Document for future reference |
|
|
329
|
+
| **Assumption-based fix** | May introduce new bugs | Verify assumptions first |
|
|
330
|
+
| **Partial Fix** | Similar bugs remain in codebase | Perform Global Search & Pattern Matching |
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Quick Reference
|
|
335
|
+
|
|
336
|
+
### When Bug Recurs After "Fix"
|
|
337
|
+
|
|
338
|
+
1. Re-read the original root cause analysis
|
|
339
|
+
2. Check if fix addressed the actual root cause
|
|
340
|
+
3. Verify fix was applied to the correct code path
|
|
341
|
+
4. Consider if there are multiple entry points
|
|
342
|
+
|
|
343
|
+
### When Similar Bug Appears
|
|
344
|
+
|
|
345
|
+
1. Check if it's the same pattern as a previous bug
|
|
346
|
+
2. Look for systemic fix (fix all instances, not just one)
|
|
347
|
+
3. Update this guide with the pattern if new
|
|
348
|
+
|
|
349
|
+
### When Unsure of Root Cause
|
|
350
|
+
|
|
351
|
+
1. Add more logging/tracing
|
|
352
|
+
2. Reproduce in debugger
|
|
353
|
+
3. Compare working vs. broken scenarios
|
|
354
|
+
4. Bisect to find the change that introduced it
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Bug Record Template (bugRecord.md)
|
|
2
|
+
|
|
3
|
+
This template defines the standard format for project-level bug records. Create `bugRecord.md` in your project root directory using this structure.
|
|
4
|
+
|
|
5
|
+
## File Header
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# Bug Record
|
|
9
|
+
|
|
10
|
+
This document tracks bugs fixed in this project to prevent recurrence and enable pattern extraction.
|
|
11
|
+
|
|
12
|
+
Last Updated: [YYYY-MM-DD]
|
|
13
|
+
Total Records: [N]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Record Entry Format
|
|
17
|
+
|
|
18
|
+
Each bug fix should be documented using the following structure:
|
|
19
|
+
|
|
20
|
+
```markdown
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## [BUG-NNN] Brief Title
|
|
24
|
+
|
|
25
|
+
**Date**: YYYY-MM-DD
|
|
26
|
+
**Status**: Fixed | Reopened | Superseded by BUG-XXX
|
|
27
|
+
**Severity**: P0 (Critical) | P1 (High) | P2 (Medium) | P3 (Low)
|
|
28
|
+
**Category**: [See categories below]
|
|
29
|
+
|
|
30
|
+
### Symptom (What was observed)
|
|
31
|
+
|
|
32
|
+
- User-visible behavior or error message
|
|
33
|
+
- Steps to reproduce
|
|
34
|
+
- Environment/context where it occurred
|
|
35
|
+
|
|
36
|
+
### Root Cause (Why it happened)
|
|
37
|
+
|
|
38
|
+
- One-sentence root cause statement
|
|
39
|
+
- Technical explanation (file/function/line if helpful)
|
|
40
|
+
- What assumption was wrong
|
|
41
|
+
|
|
42
|
+
### Solution (How it was fixed)
|
|
43
|
+
|
|
44
|
+
- Summary of the fix (what changed)
|
|
45
|
+
- Key code changes (brief description, not full code)
|
|
46
|
+
- Why this solution was chosen over alternatives
|
|
47
|
+
|
|
48
|
+
### Verification (How we confirmed it's fixed)
|
|
49
|
+
|
|
50
|
+
- [ ] Bug scenario no longer reproduces
|
|
51
|
+
- [ ] Related features still work
|
|
52
|
+
- [ ] No new errors in console/logs
|
|
53
|
+
- [ ] Tests pass (if applicable)
|
|
54
|
+
|
|
55
|
+
### Pattern Notes (For future reference)
|
|
56
|
+
|
|
57
|
+
- Is this a recurring pattern? (Y/N)
|
|
58
|
+
- Related bugs: [BUG-XXX, BUG-YYY]
|
|
59
|
+
- Prevention suggestion for similar cases
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Bug Categories
|
|
65
|
+
|
|
66
|
+
Use one of the following categories:
|
|
67
|
+
|
|
68
|
+
| Category | Description |
|
|
69
|
+
|----------|-------------|
|
|
70
|
+
| **Input Handling** | User input parsing, validation, normalization |
|
|
71
|
+
| **State Management** | State sync, race conditions, stale data |
|
|
72
|
+
| **API Integration** | External API calls, response handling, timeouts |
|
|
73
|
+
| **Data Flow** | Data transformation, mapping, display |
|
|
74
|
+
| **Error Handling** | Missing error handling, wrong error messages |
|
|
75
|
+
| **Configuration** | Config mismatch, environment issues |
|
|
76
|
+
| **UI/UX** | Layout, interaction, accessibility |
|
|
77
|
+
| **Performance** | Slow operations, memory leaks, N+1 queries |
|
|
78
|
+
| **Security** | Auth bypass, data exposure, injection |
|
|
79
|
+
| **Platform** | Browser/OS specific, native app issues |
|
|
80
|
+
|
|
81
|
+
## Example Entry
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## [BUG-001] Success message shown but operation actually failed
|
|
87
|
+
|
|
88
|
+
**Date**: 2025-01-05
|
|
89
|
+
**Status**: Fixed
|
|
90
|
+
**Severity**: P1 (High)
|
|
91
|
+
**Category**: Error Handling
|
|
92
|
+
|
|
93
|
+
### Symptom
|
|
94
|
+
|
|
95
|
+
- User clicks "Save" button
|
|
96
|
+
- UI shows "Saved successfully" toast
|
|
97
|
+
- But data is not actually persisted
|
|
98
|
+
- Only discovered when page is refreshed
|
|
99
|
+
|
|
100
|
+
### Root Cause
|
|
101
|
+
|
|
102
|
+
The code only checked HTTP status code (200) but ignored business status code in response body. The API returns 200 OK with `{"code": -1, "message": "..."}` for business errors.
|
|
103
|
+
|
|
104
|
+
### Solution
|
|
105
|
+
|
|
106
|
+
Added response body parsing to check business status code before showing success message:
|
|
107
|
+
- Modified response handler to parse body
|
|
108
|
+
- Added error display for business error codes
|
|
109
|
+
- Updated all similar API calls
|
|
110
|
+
|
|
111
|
+
### Verification
|
|
112
|
+
|
|
113
|
+
- [x] Original scenario now shows error message correctly
|
|
114
|
+
- [x] Successful saves still show success message
|
|
115
|
+
- [x] No new console errors
|
|
116
|
+
- [x] Unit tests added for both paths
|
|
117
|
+
|
|
118
|
+
### Pattern Notes
|
|
119
|
+
|
|
120
|
+
- Recurring pattern: Yes
|
|
121
|
+
- Related bugs: None yet
|
|
122
|
+
- Prevention: Always check response body for business status, not just HTTP status
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Maintenance Guidelines
|
|
128
|
+
|
|
129
|
+
1. **Add new entries at the top** (most recent first)
|
|
130
|
+
2. **Update status** if a fix turns out to be wrong (mark as "Superseded")
|
|
131
|
+
3. **Link related bugs** to track patterns
|
|
132
|
+
4. **Review periodically** to extract common patterns for `bug-guide.md`
|
|
133
|
+
5. **Keep entries concise** - focus on actionable information
|
|
134
|
+
|