codex-genesis-harness 0.1.5 → 0.1.7

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.
Files changed (178) hide show
  1. package/.codebase/ARCHITECTURE_REVIEW_COMPLETE.md +216 -216
  2. package/.codebase/CURRENT_STATE.md +8 -2
  3. package/.codebase/FILE_NAMING_CLARIFICATION.md +161 -161
  4. package/.codebase/HARNESS_COMPLETENESS_AUDIT.md +613 -613
  5. package/.codebase/IMPLEMENTATION_COMPLETE.md +429 -429
  6. package/.codebase/IMPLEMENTATION_HANDOFF.md +351 -351
  7. package/.codebase/IMPROVEMENTS_SUMMARY.md +419 -419
  8. package/.codebase/PHASE3_SKILLS_NAMING_COMPLETE.md +292 -292
  9. package/.codebase/PHASE_DEPENDENCY_MAP.md +486 -486
  10. package/.codebase/QUICK_START_SPEC_IMPACT.md +456 -456
  11. package/.codebase/README.md +139 -139
  12. package/.codebase/RECOVERY_POINTS.md +83 -438
  13. package/.codebase/beads.json +16 -0
  14. package/.codex/skills/genesis-ai-provider/SKILL.md +1 -1
  15. package/.codex/skills/genesis-api-contract/SKILL.md +1 -1
  16. package/.codex/skills/genesis-api-sync/SKILL.md +354 -354
  17. package/.codex/skills/genesis-api-sync/checklists/api-sync-checklist.md +101 -101
  18. package/.codex/skills/genesis-api-sync/templates/api-change-template.md +257 -257
  19. package/.codex/skills/genesis-architecture/SKILL.md +1 -1
  20. package/.codex/skills/genesis-codebase-map/SKILL.md +1 -1
  21. package/.codex/skills/genesis-debug-guide/SKILL.md +479 -479
  22. package/.codex/skills/genesis-debug-guide/checklists/flaky-test-investigation.md +339 -339
  23. package/.codex/skills/genesis-debug-guide/checklists/production-bug-debug.md +210 -210
  24. package/.codex/skills/genesis-debug-guide/checklists/test-failure-debug.md +158 -158
  25. package/.codex/skills/genesis-debug-guide/observability/debug-commands.md +365 -365
  26. package/.codex/skills/genesis-debug-guide/playbooks/unit-test-failures.md +289 -289
  27. package/.codex/skills/genesis-debug-guide/templates/debug-investigation-log.md +288 -288
  28. package/.codex/skills/genesis-design-spec/SKILL.md +3 -3
  29. package/.codex/skills/genesis-docs-automation/SKILL.md +1003 -1003
  30. package/.codex/skills/genesis-docs-automation/checklists/docs-validation.md +359 -359
  31. package/.codex/skills/genesis-docs-automation/checklists/spec-alignment.md +312 -312
  32. package/.codex/skills/genesis-docs-automation/observability/docs-tracking.md +382 -382
  33. package/.codex/skills/genesis-docs-automation/playbooks/auto-update-flow.md +851 -851
  34. package/.codex/skills/genesis-docs-automation/playbooks/changelog-generation.md +491 -491
  35. package/.codex/skills/genesis-docs-automation/templates/changelog-entry-template.md +187 -187
  36. package/.codex/skills/genesis-docs-automation/templates/handoff-template.md +297 -297
  37. package/.codex/skills/genesis-harness/SKILL.md +1428 -1427
  38. package/.codex/skills/genesis-harness/agents/openai.yaml +7 -7
  39. package/.codex/skills/genesis-harness/checklists/bug-fix-qa.md +169 -169
  40. package/.codex/skills/genesis-harness/checklists/new-feature-qa.md +157 -157
  41. package/.codex/skills/genesis-harness/checklists/refactor-qa.md +216 -216
  42. package/.codex/skills/genesis-harness/checklists/requirements-validation.md +211 -211
  43. package/.codex/skills/genesis-harness/references/planning-schema.md +35 -35
  44. package/.codex/skills/genesis-harness/references/quality-rubric.md +21 -21
  45. package/.codex/skills/genesis-harness/references/research-rubric.md +41 -41
  46. package/.codex/skills/genesis-harness/references/workflows.md +33 -33
  47. package/.codex/skills/genesis-harness/resources/agents-template.md +27 -27
  48. package/.codex/skills/genesis-harness/resources/api-docs-template.md +32 -32
  49. package/.codex/skills/genesis-harness/resources/architecture-template.md +30 -30
  50. package/.codex/skills/genesis-harness/resources/audit-template.md +26 -26
  51. package/.codex/skills/genesis-harness/resources/bug-template.md +34 -34
  52. package/.codex/skills/genesis-harness/resources/change-impact-matrix-template.md +204 -204
  53. package/.codex/skills/genesis-harness/resources/check-template.md +21 -21
  54. package/.codex/skills/genesis-harness/resources/conventions-template.md +42 -42
  55. package/.codex/skills/genesis-harness/resources/decision-template.md +33 -33
  56. package/.codex/skills/genesis-harness/resources/design-template.md +26 -26
  57. package/.codex/skills/genesis-harness/resources/escalation-template.md +21 -21
  58. package/.codex/skills/genesis-harness/resources/feature-template.md +49 -49
  59. package/.codex/skills/genesis-harness/resources/foundation-phase-template.md +131 -131
  60. package/.codex/skills/genesis-harness/resources/integrations-template.md +32 -32
  61. package/.codex/skills/genesis-harness/resources/journeys-template.md +13 -13
  62. package/.codex/skills/genesis-harness/resources/lessons-learned-template.md +12 -12
  63. package/.codex/skills/genesis-harness/resources/observability-template.md +34 -34
  64. package/.codex/skills/genesis-harness/resources/phase-00-foundation-template.md +76 -76
  65. package/.codex/skills/genesis-harness/resources/phase-template.md +34 -34
  66. package/.codex/skills/genesis-harness/resources/pitfalls-template.md +22 -22
  67. package/.codex/skills/genesis-harness/resources/planning-tree-template.md +39 -39
  68. package/.codex/skills/genesis-harness/resources/post-implementation-guide.md +347 -347
  69. package/.codex/skills/genesis-harness/resources/project-template.md +38 -38
  70. package/.codex/skills/genesis-harness/resources/quality-score-template.md +11 -11
  71. package/.codex/skills/genesis-harness/resources/requirements-template.md +26 -26
  72. package/.codex/skills/genesis-harness/resources/research-template.md +26 -26
  73. package/.codex/skills/genesis-harness/resources/review-template.md +22 -22
  74. package/.codex/skills/genesis-harness/resources/spec-changelog-template.md +6 -6
  75. package/.codex/skills/genesis-harness/resources/stack-template.md +33 -33
  76. package/.codex/skills/genesis-harness/resources/verification-template.md +26 -26
  77. package/.codex/skills/genesis-harness/scripts/check-architecture-boundaries.sh +0 -0
  78. package/.codex/skills/genesis-harness/scripts/check-docs-sync.sh +0 -0
  79. package/.codex/skills/genesis-harness/scripts/check-no-debug-logs.sh +0 -0
  80. package/.codex/skills/genesis-harness/scripts/check-required-planning-files.sh +0 -0
  81. package/.codex/skills/genesis-harness/scripts/check-spec-changelog.sh +0 -0
  82. package/.codex/skills/genesis-harness/scripts/check-task-tracking.sh +0 -0
  83. package/.codex/skills/genesis-harness/scripts/compact-context.sh +0 -0
  84. package/.codex/skills/genesis-harness/scripts/create-adr.sh +0 -0
  85. package/.codex/skills/genesis-harness/scripts/create-bug.sh +0 -0
  86. package/.codex/skills/genesis-harness/scripts/create-feature.sh +0 -0
  87. package/.codex/skills/genesis-harness/scripts/detect-stack.sh +0 -0
  88. package/.codex/skills/genesis-harness/scripts/init-planning.sh +0 -0
  89. package/.codex/skills/genesis-harness/scripts/list-changed-files.sh +0 -0
  90. package/.codex/skills/genesis-harness/scripts/offload-log.sh +0 -0
  91. package/.codex/skills/genesis-harness/scripts/run-verification.sh +0 -0
  92. package/.codex/skills/genesis-harness/scripts/run-verify-loop.sh +0 -0
  93. package/.codex/skills/genesis-harness/scripts/update-state.sh +0 -0
  94. package/.codex/skills/genesis-harness-engineering/SKILL.md +1 -1
  95. package/.codex/skills/genesis-new-design/SKILL.md +2 -1
  96. package/.codex/skills/genesis-new-design/agents/openai.yaml +3 -3
  97. package/.codex/skills/genesis-observability-automation/checklists/.gitkeep +0 -0
  98. package/.codex/skills/genesis-observability-automation/observability/.gitkeep +0 -0
  99. package/.codex/skills/genesis-observability-automation/playbooks/.gitkeep +0 -0
  100. package/.codex/skills/genesis-observability-automation/templates/.gitkeep +0 -0
  101. package/.codex/skills/genesis-pipeline-orchestration/SKILL.md +1 -1
  102. package/.codex/skills/genesis-planning/SKILL.md +26 -1
  103. package/.codex/skills/genesis-planning/checklists/mvp-readiness.md +18 -0
  104. package/.codex/skills/genesis-planning/examples/5-phase-roadmap-example.md +43 -0
  105. package/.codex/skills/genesis-planning/templates/phase-1-core.md +17 -0
  106. package/.codex/skills/genesis-planning/templates/phase-2-auth.md +17 -0
  107. package/.codex/skills/genesis-planning/templates/phase-3-features.md +17 -0
  108. package/.codex/skills/genesis-planning/templates/phase-4-integrations.md +17 -0
  109. package/.codex/skills/genesis-planning/templates/phase-5-readiness.md +17 -0
  110. package/.codex/skills/genesis-release/SKILL.md +24 -1
  111. package/.codex/skills/{genesis-release-orchestration → genesis-release}/checklists/post-deployment-verification.md +274 -274
  112. package/.codex/skills/{genesis-release-orchestration → genesis-release}/checklists/pre-release-validation.md +220 -220
  113. package/.codex/skills/{genesis-release-orchestration → genesis-release}/observability/release-tracking.md +253 -253
  114. package/.codex/skills/{genesis-release-orchestration → genesis-release}/playbooks/canary-deployment-orchestration.md +472 -472
  115. package/.codex/skills/{genesis-release-orchestration → genesis-release}/playbooks/semantic-versioning-automation.md +494 -494
  116. package/.codex/skills/{genesis-release-orchestration → genesis-release}/templates/deployment-strategy-template.md +303 -303
  117. package/.codex/skills/{genesis-release-orchestration → genesis-release}/templates/release-runbook-template.md +420 -420
  118. package/.codex/skills/genesis-research-first/SKILL.md +237 -237
  119. package/.codex/skills/genesis-research-first/templates/.gitkeep +0 -0
  120. package/.codex/skills/genesis-spec-propagation/SKILL.md +534 -534
  121. package/.codex/skills/genesis-spec-propagation/checklists/phase-update-verification.md +384 -384
  122. package/.codex/skills/genesis-spec-propagation/checklists/spec-change-detection.md +257 -257
  123. package/.codex/skills/genesis-spec-propagation/observability/propagation-tracking.md +373 -373
  124. package/.codex/skills/genesis-spec-propagation/playbooks/breaking-change-propagation.md +692 -692
  125. package/.codex/skills/genesis-spec-propagation/playbooks/feature-change-propagation.md +434 -434
  126. package/.codex/skills/genesis-spec-propagation/templates/migration-guide-template.md +407 -407
  127. package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/SKILL.md +1 -1
  128. package/.codex/skills/genesis-upgrade-design/agents/openai.yaml +3 -3
  129. package/.codex/skills/spec-impact-engine/SKILL.md +504 -504
  130. package/.codex/skills/spec-impact-engine/detect-spec-changes.sh +0 -0
  131. package/.codex-plugin/plugin.json +19 -19
  132. package/CHANGELOG.md +56 -0
  133. package/LICENSE +22 -22
  134. package/README.EN.md +780 -730
  135. package/README.VI.md +772 -723
  136. package/README.md +102 -247
  137. package/VERSION +2 -2
  138. package/bin/genesis-harness.js +695 -92
  139. package/package.json +9 -3
  140. package/scripts/README.md +342 -342
  141. package/scripts/compact-context.sh +0 -0
  142. package/scripts/contract_integrity_gate.js +83 -0
  143. package/scripts/detect-changes.sh +0 -0
  144. package/scripts/healing_telemetry.js +118 -0
  145. package/scripts/install.sh +5 -6
  146. package/scripts/offload-log.sh +0 -0
  147. package/scripts/prompt_sentinel.js +84 -0
  148. package/scripts/run-evals.sh +20 -24
  149. package/scripts/run-verify-loop.sh +11 -0
  150. package/scripts/spec_visual_sync.js +157 -0
  151. package/scripts/test_generator.js +142 -0
  152. package/scripts/transition_state.sh +0 -0
  153. package/scripts/uninstall.sh +2 -5
  154. package/scripts/validation_gates.sh +40 -1
  155. package/scripts/verify.sh +6 -61
  156. package/tests/unit/contract_integrity_gate.test.js +74 -0
  157. package/tests/unit/healing_telemetry.test.js +58 -0
  158. package/tests/unit/prompt_sentinel.test.js +50 -0
  159. package/tests/unit/spec_visual_sync.test.js +77 -0
  160. package/tests/unit/test_generator.test.js +62 -0
  161. package/.codex/skills/genesis-docs/SKILL.md +0 -46
  162. package/.codex/skills/genesis-docs/agents/openai.yaml +0 -7
  163. package/.codex/skills/genesis-release-orchestration/SKILL.md +0 -653
  164. package/.codex/skills/genesis-release-orchestration/agents/openai.yaml +0 -7
  165. package/.codex/skills/genesis-research/SKILL.md +0 -46
  166. package/.codex/skills/genesis-research/agents/openai.yaml +0 -7
  167. /package/.codex/skills/{genesis-docs/checklists/checklist.md → genesis-docs-automation/checklists/manual-docs-checklist.md} +0 -0
  168. /package/.codex/skills/{genesis-docs/examples/example.md → genesis-docs-automation/examples/manual-docs-example.md} +0 -0
  169. /package/.codex/skills/{genesis-docs → genesis-docs-automation}/templates/docs-update-template.md +0 -0
  170. /package/.codex/skills/{genesis-state-machine/SKILL.md → genesis-harness/references/state-machine.md} +0 -0
  171. /package/.codex/skills/{genesis-release-orchestration/examples/example.md → genesis-release/examples/orchestration-example.md} +0 -0
  172. /package/.codex/skills/{genesis-research → genesis-research-first}/checklists/checklist.md +0 -0
  173. /package/.codex/skills/{genesis-research/examples/example.md → genesis-research-first/examples/manual-research-example.md} +0 -0
  174. /package/.codex/skills/{genesis-research → genesis-research-first}/templates/research-note-template.md +0 -0
  175. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/agents/openai.yaml +0 -0
  176. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/checklists/checklist.md +0 -0
  177. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/examples/example.md +0 -0
  178. /package/.codex/skills/{ui-ux-test-skill → genesis-ui-ux-test}/templates/playwright-test-template.md +0 -0
@@ -1,288 +1,288 @@
1
- # Debug Investigation Log
2
-
3
- **Template**: Use this to document your debugging process for a specific issue.
4
-
5
- **Purpose**: Record findings so team can learn from investigation, help others with similar issues, and rebuild context if work resumes later.
6
-
7
- ---
8
-
9
- ## Incident Information
10
-
11
- **Date**: [YYYY-MM-DD]
12
- **Time Started**: [HH:MM]
13
- **Investigator**: [Your Name]
14
- **Bug ID/Ticket**: [Link if applicable]
15
- **Severity**: Critical / High / Medium / Low
16
-
17
- ---
18
-
19
- ## Problem Summary
20
-
21
- ### What
22
- Brief description of what is broken:
23
-
24
- [e.g., "User profile API returns 500 when fetching user with unicode characters in name"]
25
-
26
- ### Impact
27
- Who/what is affected:
28
-
29
- - [ ] Users affected: [count or percentage]
30
- - [ ] Data integrity: [yes/no - if yes, describe]
31
- - [ ] Revenue impact: [yes/no - if yes, describe]
32
- - [ ] Production outage: [yes/no]
33
-
34
- ### Reproducibility
35
- How consistent is the problem:
36
-
37
- - [ ] Consistent (fails every time)
38
- - [ ] Intermittent (fails ~X% of time)
39
- - [ ] Environment-specific
40
- - [ ] User-specific
41
- - [ ] Data-specific
42
-
43
- ### Reproduction Steps
44
- Exact steps to trigger the problem:
45
-
46
- 1. [First step]
47
- 2. [Second step]
48
- 3. [Third step]
49
-
50
- ---
51
-
52
- ## Investigation Process
53
-
54
- ### Step 1: Initial Analysis
55
- **Time**: [HH:MM] | **Duration**: [X min]
56
-
57
- **What I did**:
58
- - Reviewed error message
59
- - Checked application logs
60
- - Reproduced locally/in staging
61
-
62
- **Findings**:
63
- - Error stack trace shows: [key line]
64
- - Logs show: [relevant log entry]
65
- - Reproduced: [yes/no - where]
66
-
67
- **Hypotheses formed**:
68
- 1. [Hypothesis A]
69
- 2. [Hypothesis B]
70
- 3. [Hypothesis C]
71
-
72
- ---
73
-
74
- ### Step 2: Deep Investigation
75
- **Time**: [HH:MM] | **Duration**: [X min]
76
-
77
- **What I did**:
78
- - Examined code at error location
79
- - Added debug logging
80
- - Checked git history
81
- - Tested with different inputs
82
-
83
- **Findings**:
84
- - Code location: `src/users/controller.js` line 42
85
- - Recent changes: [Yes/No - which PR?]
86
- - Test coverage: [good/poor/none]
87
-
88
- **Eliminated hypotheses**:
89
- - ❌ Hypothesis A because: [reason]
90
- - ❌ Hypothesis B because: [reason]
91
-
92
- **Remaining hypotheses**:
93
- - ✓ Hypothesis C: [most likely cause]
94
-
95
- ---
96
-
97
- ### Step 3: Root Cause Identification
98
- **Time**: [HH:MM] | **Duration**: [X min]
99
-
100
- **Root Cause**:
101
- [Detailed explanation of why the bug occurs]
102
-
103
- Example:
104
- ```
105
- The Unicode character 'é' (U+00E9) in the user name is not
106
- being properly escaped in the SQL query. The database driver
107
- receives: SELECT * FROM users WHERE name='José'
108
- But doesn't properly handle the é character, causing a
109
- SQL syntax error → 500 error.
110
- ```
111
-
112
- **Evidence**:
113
- - Stack trace points to: [line X in file Y]
114
- - Debug output shows: [variable values]
115
- - Git history shows: [commit Z changed this]
116
- - Similar issue: [GitHub issue #123]
117
-
118
- **Contributing Factors**:
119
- - [ ] Missing test for unicode characters
120
- - [ ] No input validation for special characters
121
- - [ ] Database driver version issue
122
- - [ ] Configuration missing
123
-
124
- ---
125
-
126
- ## Solution
127
-
128
- ### Fix Strategy
129
- **Approach**: [Describe the fix approach]
130
-
131
- Example:
132
- ```
133
- Option 1: Use parameterized queries (preferred)
134
- - Pro: Prevents all SQL injection issues
135
- - Con: Requires database layer refactoring
136
-
137
- Option 2: Escape unicode before query (quick fix)
138
- - Pro: Quick, minimal change
139
- - Con: Only fixes unicode, not other characters
140
-
141
- Decision: Option 1 (proper solution)
142
- ```
143
-
144
- ### Fix Implementation
145
- **File**: `src/users/repository.js`
146
- **Lines**: 42-50
147
-
148
- ```javascript
149
- // BEFORE (buggy):
150
- const query = `SELECT * FROM users WHERE name='${name}'`;
151
- const result = await db.query(query);
152
-
153
- // AFTER (fixed):
154
- const result = await db.query(
155
- 'SELECT * FROM users WHERE name = ?',
156
- [name] // Parameter passed separately - properly escaped
157
- );
158
- ```
159
-
160
- **Why This Fixes It**:
161
- - Parameterized queries handle all special characters
162
- - Database driver handles escaping automatically
163
- - More secure (prevents SQL injection)
164
-
165
- ---
166
-
167
- ## Verification
168
-
169
- ### Test Added
170
- **Test file**: `src/users/__tests__/repository.test.js`
171
-
172
- **Test case**:
173
- ```javascript
174
- test('should fetch user with unicode name', async () => {
175
- const user = await repository.getByName('José');
176
- expect(user).toEqual({ id: 1, name: 'José' });
177
- });
178
-
179
- test('should fetch user with special characters', async () => {
180
- const user = await repository.getByName("O'Brien");
181
- expect(user).toEqual({ id: 2, name: "O'Brien" });
182
- });
183
- ```
184
-
185
- ### Verification Results
186
- - [ ] Failing test created → fails before fix
187
- - [ ] Test passes after fix
188
- - [ ] Full test suite passes
189
- - [ ] No new test failures
190
- - [ ] No debug code left in implementation
191
- - [ ] Verified in staging environment (if production bug)
192
- - [ ] Performance: No degradation observed
193
-
194
- ### Regression Testing
195
- - [ ] All user-related tests pass
196
- - [ ] Query building tests pass
197
- - [ ] Integration tests with database pass
198
- - [ ] Similar code patterns reviewed (no other unicode issues)
199
- - [ ] Code coverage: Now at [X%]
200
-
201
- ---
202
-
203
- ## Lessons Learned
204
-
205
- ### What Went Wrong
206
- 1. **No test for unicode characters** - Input validation should include international characters
207
- 2. **String interpolation used for SQL** - Parameterized queries should be standard
208
- 3. **No code review process for input handling** - Missed in PR review
209
-
210
- ### Prevention
211
- 1. **Add test suite for international character handling**
212
- - Names with accents (José, François)
213
- - Apostrophes (O'Brien)
214
- - Unicode emoji (😀)
215
- - Right-to-left text (العربية)
216
-
217
- 2. **Add linting rule**
218
- - Ban string interpolation in SQL
219
- - Enforce parameterized queries
220
- - Review all user input handling
221
-
222
- 3. **Process improvement**
223
- - Code review checklist: "Check all user input is validated"
224
- - Input validation strategy doc
225
- - New developer onboarding includes input handling section
226
-
227
- ### Similar Bugs to Look For
228
- - [ ] All user input handling reviewed (search for template literals in queries)
229
- - [ ] Found 2 other locations with same pattern → Fixed together
230
- - [ ] Added to "Known Issues" if not fixed: [none]
231
-
232
- ---
233
-
234
- ## Timeline Summary
235
-
236
- | Time | Event |
237
- |------|-------|
238
- | 14:00 | Bug reported: API returns 500 for unicode names |
239
- | 14:05 | Reproduced locally |
240
- | 14:15 | Identified: String interpolation in SQL |
241
- | 14:25 | Fixed: Changed to parameterized queries |
242
- | 14:30 | Tests passing, verified in staging |
243
- | 14:45 | Code review approved |
244
- | 15:00 | Deployed to production |
245
- | 15:05 | Monitoring shows error rate at 0% ✓ |
246
-
247
- **Total Investigation Time**: 45 minutes
248
-
249
- ---
250
-
251
- ## Questions for Next Investigation
252
-
253
- If similar issue occurs:
254
- - [ ] Is it unicode-related?
255
- - [ ] Is it in the database layer?
256
- - [ ] Check: Are parameterized queries used everywhere?
257
- - [ ] Check: Is input validation comprehensive?
258
-
259
- ---
260
-
261
- ## Artifacts
262
-
263
- ### Created Files
264
- - `src/users/__tests__/repository.test.js` - New test cases
265
- - `.codebase/RECOVERY_POINTS.md` - Updated with unicode handling notes
266
-
267
- ### Modified Files
268
- - `src/users/repository.js` - Fixed SQL query
269
- - `src/users/controller.js` - Code review pass
270
-
271
- ### Documentation
272
- - Added to observability/failures/: This investigation log
273
- - Updated `.codebase/KNOWN_ISSUES.md`: Similar patterns noted
274
-
275
- ---
276
-
277
- ## Sign-Off
278
-
279
- - [ ] Investigation complete
280
- - [ ] Fix verified
281
- - [ ] Tests passing
282
- - [ ] Team notified
283
- - [ ] Ticket resolved
284
- - [ ] Log archived
285
-
286
- **Investigator**: [Your Name]
287
- **Date Completed**: [YYYY-MM-DD]
288
- **Approved By**: [Code Reviewer Name]
1
+ # Debug Investigation Log
2
+
3
+ **Template**: Use this to document your debugging process for a specific issue.
4
+
5
+ **Purpose**: Record findings so team can learn from investigation, help others with similar issues, and rebuild context if work resumes later.
6
+
7
+ ---
8
+
9
+ ## Incident Information
10
+
11
+ **Date**: [YYYY-MM-DD]
12
+ **Time Started**: [HH:MM]
13
+ **Investigator**: [Your Name]
14
+ **Bug ID/Ticket**: [Link if applicable]
15
+ **Severity**: Critical / High / Medium / Low
16
+
17
+ ---
18
+
19
+ ## Problem Summary
20
+
21
+ ### What
22
+ Brief description of what is broken:
23
+
24
+ [e.g., "User profile API returns 500 when fetching user with unicode characters in name"]
25
+
26
+ ### Impact
27
+ Who/what is affected:
28
+
29
+ - [ ] Users affected: [count or percentage]
30
+ - [ ] Data integrity: [yes/no - if yes, describe]
31
+ - [ ] Revenue impact: [yes/no - if yes, describe]
32
+ - [ ] Production outage: [yes/no]
33
+
34
+ ### Reproducibility
35
+ How consistent is the problem:
36
+
37
+ - [ ] Consistent (fails every time)
38
+ - [ ] Intermittent (fails ~X% of time)
39
+ - [ ] Environment-specific
40
+ - [ ] User-specific
41
+ - [ ] Data-specific
42
+
43
+ ### Reproduction Steps
44
+ Exact steps to trigger the problem:
45
+
46
+ 1. [First step]
47
+ 2. [Second step]
48
+ 3. [Third step]
49
+
50
+ ---
51
+
52
+ ## Investigation Process
53
+
54
+ ### Step 1: Initial Analysis
55
+ **Time**: [HH:MM] | **Duration**: [X min]
56
+
57
+ **What I did**:
58
+ - Reviewed error message
59
+ - Checked application logs
60
+ - Reproduced locally/in staging
61
+
62
+ **Findings**:
63
+ - Error stack trace shows: [key line]
64
+ - Logs show: [relevant log entry]
65
+ - Reproduced: [yes/no - where]
66
+
67
+ **Hypotheses formed**:
68
+ 1. [Hypothesis A]
69
+ 2. [Hypothesis B]
70
+ 3. [Hypothesis C]
71
+
72
+ ---
73
+
74
+ ### Step 2: Deep Investigation
75
+ **Time**: [HH:MM] | **Duration**: [X min]
76
+
77
+ **What I did**:
78
+ - Examined code at error location
79
+ - Added debug logging
80
+ - Checked git history
81
+ - Tested with different inputs
82
+
83
+ **Findings**:
84
+ - Code location: `src/users/controller.js` line 42
85
+ - Recent changes: [Yes/No - which PR?]
86
+ - Test coverage: [good/poor/none]
87
+
88
+ **Eliminated hypotheses**:
89
+ - ❌ Hypothesis A because: [reason]
90
+ - ❌ Hypothesis B because: [reason]
91
+
92
+ **Remaining hypotheses**:
93
+ - ✓ Hypothesis C: [most likely cause]
94
+
95
+ ---
96
+
97
+ ### Step 3: Root Cause Identification
98
+ **Time**: [HH:MM] | **Duration**: [X min]
99
+
100
+ **Root Cause**:
101
+ [Detailed explanation of why the bug occurs]
102
+
103
+ Example:
104
+ ```
105
+ The Unicode character 'é' (U+00E9) in the user name is not
106
+ being properly escaped in the SQL query. The database driver
107
+ receives: SELECT * FROM users WHERE name='José'
108
+ But doesn't properly handle the é character, causing a
109
+ SQL syntax error → 500 error.
110
+ ```
111
+
112
+ **Evidence**:
113
+ - Stack trace points to: [line X in file Y]
114
+ - Debug output shows: [variable values]
115
+ - Git history shows: [commit Z changed this]
116
+ - Similar issue: [GitHub issue #123]
117
+
118
+ **Contributing Factors**:
119
+ - [ ] Missing test for unicode characters
120
+ - [ ] No input validation for special characters
121
+ - [ ] Database driver version issue
122
+ - [ ] Configuration missing
123
+
124
+ ---
125
+
126
+ ## Solution
127
+
128
+ ### Fix Strategy
129
+ **Approach**: [Describe the fix approach]
130
+
131
+ Example:
132
+ ```
133
+ Option 1: Use parameterized queries (preferred)
134
+ - Pro: Prevents all SQL injection issues
135
+ - Con: Requires database layer refactoring
136
+
137
+ Option 2: Escape unicode before query (quick fix)
138
+ - Pro: Quick, minimal change
139
+ - Con: Only fixes unicode, not other characters
140
+
141
+ Decision: Option 1 (proper solution)
142
+ ```
143
+
144
+ ### Fix Implementation
145
+ **File**: `src/users/repository.js`
146
+ **Lines**: 42-50
147
+
148
+ ```javascript
149
+ // BEFORE (buggy):
150
+ const query = `SELECT * FROM users WHERE name='${name}'`;
151
+ const result = await db.query(query);
152
+
153
+ // AFTER (fixed):
154
+ const result = await db.query(
155
+ 'SELECT * FROM users WHERE name = ?',
156
+ [name] // Parameter passed separately - properly escaped
157
+ );
158
+ ```
159
+
160
+ **Why This Fixes It**:
161
+ - Parameterized queries handle all special characters
162
+ - Database driver handles escaping automatically
163
+ - More secure (prevents SQL injection)
164
+
165
+ ---
166
+
167
+ ## Verification
168
+
169
+ ### Test Added
170
+ **Test file**: `src/users/__tests__/repository.test.js`
171
+
172
+ **Test case**:
173
+ ```javascript
174
+ test('should fetch user with unicode name', async () => {
175
+ const user = await repository.getByName('José');
176
+ expect(user).toEqual({ id: 1, name: 'José' });
177
+ });
178
+
179
+ test('should fetch user with special characters', async () => {
180
+ const user = await repository.getByName("O'Brien");
181
+ expect(user).toEqual({ id: 2, name: "O'Brien" });
182
+ });
183
+ ```
184
+
185
+ ### Verification Results
186
+ - [ ] Failing test created → fails before fix
187
+ - [ ] Test passes after fix
188
+ - [ ] Full test suite passes
189
+ - [ ] No new test failures
190
+ - [ ] No debug code left in implementation
191
+ - [ ] Verified in staging environment (if production bug)
192
+ - [ ] Performance: No degradation observed
193
+
194
+ ### Regression Testing
195
+ - [ ] All user-related tests pass
196
+ - [ ] Query building tests pass
197
+ - [ ] Integration tests with database pass
198
+ - [ ] Similar code patterns reviewed (no other unicode issues)
199
+ - [ ] Code coverage: Now at [X%]
200
+
201
+ ---
202
+
203
+ ## Lessons Learned
204
+
205
+ ### What Went Wrong
206
+ 1. **No test for unicode characters** - Input validation should include international characters
207
+ 2. **String interpolation used for SQL** - Parameterized queries should be standard
208
+ 3. **No code review process for input handling** - Missed in PR review
209
+
210
+ ### Prevention
211
+ 1. **Add test suite for international character handling**
212
+ - Names with accents (José, François)
213
+ - Apostrophes (O'Brien)
214
+ - Unicode emoji (😀)
215
+ - Right-to-left text (العربية)
216
+
217
+ 2. **Add linting rule**
218
+ - Ban string interpolation in SQL
219
+ - Enforce parameterized queries
220
+ - Review all user input handling
221
+
222
+ 3. **Process improvement**
223
+ - Code review checklist: "Check all user input is validated"
224
+ - Input validation strategy doc
225
+ - New developer onboarding includes input handling section
226
+
227
+ ### Similar Bugs to Look For
228
+ - [ ] All user input handling reviewed (search for template literals in queries)
229
+ - [ ] Found 2 other locations with same pattern → Fixed together
230
+ - [ ] Added to "Known Issues" if not fixed: [none]
231
+
232
+ ---
233
+
234
+ ## Timeline Summary
235
+
236
+ | Time | Event |
237
+ |------|-------|
238
+ | 14:00 | Bug reported: API returns 500 for unicode names |
239
+ | 14:05 | Reproduced locally |
240
+ | 14:15 | Identified: String interpolation in SQL |
241
+ | 14:25 | Fixed: Changed to parameterized queries |
242
+ | 14:30 | Tests passing, verified in staging |
243
+ | 14:45 | Code review approved |
244
+ | 15:00 | Deployed to production |
245
+ | 15:05 | Monitoring shows error rate at 0% ✓ |
246
+
247
+ **Total Investigation Time**: 45 minutes
248
+
249
+ ---
250
+
251
+ ## Questions for Next Investigation
252
+
253
+ If similar issue occurs:
254
+ - [ ] Is it unicode-related?
255
+ - [ ] Is it in the database layer?
256
+ - [ ] Check: Are parameterized queries used everywhere?
257
+ - [ ] Check: Is input validation comprehensive?
258
+
259
+ ---
260
+
261
+ ## Artifacts
262
+
263
+ ### Created Files
264
+ - `src/users/__tests__/repository.test.js` - New test cases
265
+ - `.codebase/RECOVERY_POINTS.md` - Updated with unicode handling notes
266
+
267
+ ### Modified Files
268
+ - `src/users/repository.js` - Fixed SQL query
269
+ - `src/users/controller.js` - Code review pass
270
+
271
+ ### Documentation
272
+ - Added to observability/failures/: This investigation log
273
+ - Updated `.codebase/KNOWN_ISSUES.md`: Similar patterns noted
274
+
275
+ ---
276
+
277
+ ## Sign-Off
278
+
279
+ - [ ] Investigation complete
280
+ - [ ] Fix verified
281
+ - [ ] Tests passing
282
+ - [ ] Team notified
283
+ - [ ] Ticket resolved
284
+ - [ ] Log archived
285
+
286
+ **Investigator**: [Your Name]
287
+ **Date Completed**: [YYYY-MM-DD]
288
+ **Approved By**: [Code Reviewer Name]
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: design-spec-skill
2
+ name: genesis-design-spec
3
3
  description: Define UI design specs, route contracts, visual states, accessibility expectations, and UI/API synchronization before frontend implementation. Use for new screens, redesigns, visual QA, or UI contract updates.
4
4
  ---
5
5
 
@@ -18,7 +18,7 @@ Do not use for backend-only changes with no UI effect.
18
18
  UI route, audience, state list, API dependencies, fixtures, and visual references if available.
19
19
 
20
20
  ## Outputs required
21
- UI contract, Playwright fixture, acceptance states, and visual regression expectations.
21
+ UI contract, a generated visual mockup image representing the screen layout (saved as `mockup.png` in the active feature/bug directory), Playwright fixture, acceptance states, and visual regression expectations.
22
22
 
23
23
  ## Required tests
24
24
  Create load, interaction, validation, API sync, and visual regression tests where applicable.
@@ -36,7 +36,7 @@ Update `.codebase/UI_ROUTES.md` and frontend summary.
36
36
  Use state tables and route maps instead of long visual prose.
37
37
 
38
38
  ## Acceptance criteria
39
- The UI can be implemented and tested without guessing states or API behavior.
39
+ The UI can be implemented and tested without guessing states or API behavior. A high-fidelity visual mockup `mockup.png` must be created using the `generate_image` tool and saved in the active task directory as the visual contract.
40
40
 
41
41
  ## Common mistakes
42
42
  Designing only the happy path, skipping empty/error states, and omitting API synchronization.