jettypod 4.1.2 → 4.1.4

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 (179) hide show
  1. package/.nvmrc +1 -0
  2. package/docs/COMPLETE-TESTING-STRATEGY.md +970 -0
  3. package/docs/DECISIONS.md +10 -12
  4. package/docs/NODE_VERSION.md +83 -0
  5. package/docs/TDD-INFRASTRUCTURE-STRATEGY.md +1374 -0
  6. package/docs/TESTING-FOR-NON-ENGINEERS.md +1588 -0
  7. package/docs/TESTING-STRATEGY-AUDIT.md +698 -0
  8. package/hooks/post-checkout +17 -0
  9. package/hooks/post-merge +17 -0
  10. package/hooks/pre-commit +30 -0
  11. package/jettypod.js +259 -120
  12. package/lib/coverage-tracker.js +218 -0
  13. package/lib/database.js +2 -0
  14. package/lib/db-export.js +192 -0
  15. package/lib/db-import.js +193 -0
  16. package/lib/external-transition-handler.js +32 -0
  17. package/lib/git-hook-helpers.js +174 -0
  18. package/lib/git-root.js +90 -0
  19. package/lib/infrastructure-chore-generator.js +45 -0
  20. package/lib/install-hooks.js +52 -0
  21. package/lib/jettypod-backup.js +238 -0
  22. package/lib/merge-lock.js +193 -0
  23. package/lib/migrations/012-add-worktree-path.js +38 -0
  24. package/lib/migrations/013-worktrees-table.js +86 -0
  25. package/lib/migrations/014-migrate-worktree-data.js +161 -0
  26. package/lib/migrations/015-merge-locks-table.js +67 -0
  27. package/lib/pattern-finder.js +152 -0
  28. package/lib/process-manager.js +140 -0
  29. package/lib/production-standards-reader.js +13 -2
  30. package/lib/production-standards-writer.js +85 -0
  31. package/lib/skills/feature-planning/dry-run-validator.js +135 -0
  32. package/lib/skills/feature-planning/validation-formatter.js +160 -0
  33. package/lib/smart-conflict-detection.js +168 -0
  34. package/lib/smart-fetch-rebase.js +614 -0
  35. package/lib/step-definition-parser.js +76 -0
  36. package/lib/unit-test-generator.js +232 -0
  37. package/lib/verification-command-generator.js +66 -0
  38. package/lib/worktree-diagnostics.js +413 -0
  39. package/lib/worktree-facade.js +174 -0
  40. package/lib/worktree-manager.js +636 -0
  41. package/lib/worktree-reconciler.js +429 -0
  42. package/package.json +30 -3
  43. package/skills-templates/external-transition/SKILL.md +34 -3
  44. package/skills-templates/feature-planning/SKILL.md +190 -24
  45. package/skills-templates/production-mode/SKILL.md +127 -9
  46. package/skills-templates/speed-mode/SKILL.md +454 -51
  47. package/skills-templates/stable-mode/SKILL.md +285 -76
  48. package/.claude/PROTECT_SKILLS.md +0 -28
  49. package/.claude/settings.json +0 -24
  50. package/.claude/settings.local.json +0 -16
  51. package/.claude/skills/epic-planning/SKILL.md +0 -297
  52. package/.claude/skills/external-transition/SKILL.md +0 -384
  53. package/.claude/skills/feature-planning/SKILL.md +0 -464
  54. package/.claude/skills/production-mode/SKILL.md +0 -369
  55. package/.claude/skills/speed-mode/SKILL.md +0 -481
  56. package/.claude/skills/stable-mode/SKILL.md +0 -713
  57. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/epic-planning/SKILL.md +0 -297
  58. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/feature-planning/SKILL.md +0 -464
  59. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/speed-mode/SKILL.md +0 -467
  60. package/.claude/skills.backup-2025-11-10T23-33-09-368Z/stable-mode/SKILL.md +0 -673
  61. package/.claude/skills.backup-2025-11-11T16-15-10-070Z/epic-discover/SKILL.md +0 -297
  62. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/epic-planning/SKILL.md +0 -297
  63. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/feature-planning/SKILL.md +0 -464
  64. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/speed-mode/SKILL.md +0 -467
  65. package/.claude/skills.backup-2025-11-11T16-42-43-212Z/stable-mode/SKILL.md +0 -673
  66. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/epic-planning/SKILL.md +0 -297
  67. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/feature-planning/SKILL.md +0 -464
  68. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/speed-mode/SKILL.md +0 -467
  69. package/.claude/skills.backup-2025-11-11T17-06-09-783Z/stable-mode/SKILL.md +0 -673
  70. package/.devpod/current-work.json +0 -10
  71. package/.devpod/work.db +0 -0
  72. package/.github/workflows/test-safety.yml +0 -85
  73. package/.jettypod/config.json +0 -5
  74. package/.jettypod/current-work.json +0 -10
  75. package/.jettypod/hooks/README.md +0 -77
  76. package/.jettypod/hooks/protect-claude-md.js +0 -338
  77. package/.jettypod/test-work.db +0 -0
  78. package/.jettypod/work.db +0 -0
  79. package/CLAUDE.md +0 -49
  80. package/SPEED-STABLE-AUDIT.md +0 -853
  81. package/SYSTEM-BEHAVIOR.md +0 -2199
  82. package/TEST_SAFETY_AUDIT.md +0 -314
  83. package/TEST_SAFETY_IMPLEMENTATION.md +0 -97
  84. package/cucumber-report.html +0 -45
  85. package/dist/devpod-linux +0 -0
  86. package/dist/devpod-macos +0 -0
  87. package/dist/devpod-win.exe +0 -0
  88. package/docs/features/jettypod-standards-explained.md +0 -543
  89. package/docs/features/standards-inventory.md +0 -257
  90. package/features/auto-generate-production-chores.feature +0 -13
  91. package/features/backlog-command.feature +0 -26
  92. package/features/backlog-filtering-production.feature +0 -10
  93. package/features/claude-md-protection/steps.js +0 -498
  94. package/features/decisions/index.js +0 -490
  95. package/features/decisions/index.test.js +0 -208
  96. package/features/fix-text-wrapping.feature +0 -42
  97. package/features/git-hooks/git-hooks.feature +0 -30
  98. package/features/git-hooks/index.js +0 -93
  99. package/features/git-hooks/index.test.js +0 -137
  100. package/features/git-hooks/post-commit +0 -56
  101. package/features/git-hooks/post-merge +0 -47
  102. package/features/git-hooks/pre-commit +0 -28
  103. package/features/git-hooks/simple-steps.js +0 -53
  104. package/features/git-hooks/simple-test.feature +0 -10
  105. package/features/git-hooks/steps.js +0 -196
  106. package/features/jettypod-update-command.feature +0 -46
  107. package/features/mode-prompts/index.js +0 -95
  108. package/features/mode-prompts/simple-steps.js +0 -44
  109. package/features/mode-prompts/simple-test.feature +0 -9
  110. package/features/mode-prompts/validation.test.js +0 -120
  111. package/features/multiple-claude-instances.feature +0 -121
  112. package/features/production-mode-skill.feature +0 -121
  113. package/features/refactor-mode/steps.js +0 -217
  114. package/features/refactor-mode.feature +0 -49
  115. package/features/simplify-external-transition.feature +0 -166
  116. package/features/skills-update/index.test.js +0 -216
  117. package/features/step_definitions/backlog-command.steps.js +0 -37
  118. package/features/step_definitions/fix-text-wrapping.steps.js +0 -271
  119. package/features/step_definitions/multiple-claude-instances.steps.js +0 -621
  120. package/features/step_definitions/production-mode-skill.steps.js +0 -862
  121. package/features/step_definitions/simplify-external-transition.steps.js +0 -370
  122. package/features/step_definitions/terminal-logo.steps.js +0 -145
  123. package/features/step_definitions/update-command.steps.js +0 -183
  124. package/features/support/hooks.js +0 -9
  125. package/features/terminal-logo/index.js +0 -39
  126. package/features/terminal-logo/terminal-logo.feature +0 -30
  127. package/features/update-command/index.js +0 -181
  128. package/features/update-command/index.test.js +0 -225
  129. package/features/work-commands/bug-workflow-display.feature +0 -22
  130. package/features/work-commands/index.js +0 -498
  131. package/features/work-commands/simple-steps.js +0 -69
  132. package/features/work-commands/stable-tests.feature +0 -57
  133. package/features/work-commands/steps.js +0 -1174
  134. package/features/work-commands/validation.test.js +0 -88
  135. package/features/work-commands/work-commands.feature +0 -13
  136. package/features/work-tracking/discovery-validation.test.js +0 -228
  137. package/features/work-tracking/index.js +0 -1921
  138. package/features/work-tracking/mode-required.feature +0 -112
  139. package/features/work-tracking/phase-tracking.test.js +0 -482
  140. package/features/work-tracking/prototype-tracking.test.js +0 -485
  141. package/features/work-tracking/tree-view.test.js +0 -310
  142. package/features/work-tracking/work-set-mode.feature +0 -71
  143. package/features/work-tracking/work-start-mode.feature +0 -88
  144. package/full-test.txt +0 -0
  145. package/lib/bug-workflow.test.js +0 -177
  146. package/lib/claudemd.test.js +0 -195
  147. package/lib/config.test.js +0 -511
  148. package/lib/constants.test.js +0 -164
  149. package/lib/current-work.test.js +0 -146
  150. package/lib/database-project-config.test.js +0 -111
  151. package/lib/database.test.js +0 -106
  152. package/lib/decisions-generator.test.js +0 -457
  153. package/lib/decisions-helpers.test.js +0 -310
  154. package/lib/git-coordinator.js +0 -167
  155. package/lib/git.test.js +0 -145
  156. package/lib/migrations/002-default-work-item-modes.test.js +0 -351
  157. package/lib/production-chore-generator.test.js +0 -432
  158. package/lib/production-context-detector.test.js +0 -277
  159. package/lib/production-scenario-appender.test.js +0 -235
  160. package/lib/production-scenario-validator.test.js +0 -246
  161. package/lib/production-standards-reader.test.js +0 -270
  162. package/lib/project-state.test.js +0 -92
  163. package/lib/push-queue.js +0 -417
  164. package/lib/queue-processor.js +0 -74
  165. package/lib/test-helpers.js +0 -202
  166. package/lib/test-helpers.test.js +0 -255
  167. package/prototypes/2025-01-11-production-mode-autonomous.js +0 -119
  168. package/prototypes/2025-01-11-production-mode-collaborative.js +0 -166
  169. package/prototypes/2025-01-11-production-mode-guided.js +0 -217
  170. package/prototypes/2025-01-11-production-mode-smart-context.js +0 -347
  171. package/prototypes/2025-01-11-production-standards-example.md +0 -204
  172. package/prototypes/2025-11-10-backlog-filtering-tree-aware.js +0 -242
  173. package/prototypes/test/index.html +0 -1
  174. package/setup-dist-repo.sh +0 -68
  175. package/test-production-standards-engine.js +0 -130
  176. package/test-results.json +0 -2195
  177. package/test-safety-check.sh +0 -80
  178. package/work-item-tracking-plan.md +0 -199
  179. /package/{.jettypod/devpod.db → jettypod.db} +0 -0
@@ -0,0 +1,698 @@
1
+ # Testing Strategy Audit: JettyPod Skills Workflow
2
+
3
+ **Date**: 2025-11-14
4
+ **Scope**: Feature-planning, Speed-mode, Stable-mode, Production-mode, and standalone chores
5
+ **Focus**: What tests to write when, what tests to run when, efficiency and quality assurance
6
+
7
+ ---
8
+
9
+ ## Executive Summary
10
+
11
+ **Critical Findings:**
12
+
13
+ 1. **Wrong tests at wrong times**: BDD step definitions are created in feature-planning but can't be verified until speed-mode completes implementation
14
+ 2. **No test execution in feature-planning**: Scenarios and step definitions are written but never validated during discovery
15
+ 3. **Speed-mode runs BDD tests correctly** but only for happy path coverage
16
+ 4. **Stable-mode has comprehensive error handling focus** but weak on test strategy specifics
17
+ 5. **Production-mode lacks concrete testing guidance** - mentions validation but no test execution strategy
18
+ 6. **Standalone chore approach (ai-test-writing-requirements.md)** has superior safety patterns but isn't integrated into workflow skills
19
+
20
+ **Impact**: Broken step definitions can go undetected through entire feature-planning phase, wasting developer time in speed-mode when they discover the test infrastructure is broken.
21
+
22
+ ---
23
+
24
+ ## Current State Analysis
25
+
26
+ ### 1. Feature-Planning Skill
27
+
28
+ **What it does with tests:**
29
+ - Creates `.feature` file with BDD scenario (happy path only) ✅
30
+ - Creates `step_definitions/*.steps.js` with Given/When/Then implementations ✅
31
+ - Updates database with scenario_file path ✅
32
+
33
+ **What's missing:**
34
+ - ❌ NO verification that step definitions are syntactically correct
35
+ - ❌ NO smoke test to ensure BDD infrastructure works
36
+ - ❌ NO validation that Given/When/Then steps match between .feature and .steps.js
37
+ - ❌ NO test execution to catch errors early
38
+
39
+ **Quote from skill** (line 109-133):
40
+ ```
41
+ **CRITICAL:** BDD scenarios and step definitions must ALWAYS be created together.
42
+ Never create scenarios without step definitions.
43
+ ```
44
+
45
+ **The problem**: They're created together but never validated together. This is like writing code without compiling it.
46
+
47
+ **Current test timing:**
48
+ - Write: ✅ During feature-planning
49
+ - Run: ❌ Not until speed-mode (potentially days later)
50
+ - Feedback loop: **Broken** - errors discovered after context is lost
51
+
52
+ ---
53
+
54
+ ### 2. Speed-Mode Skill
55
+
56
+ **What it does with tests:**
57
+ - Reads BDD scenario file and step definitions ✅
58
+ - Implements functionality to make happy path pass ✅
59
+ - Runs BDD tests: `npm run test:bdd -- features/[feature-slug].feature` ✅
60
+ - Iterates until tests pass ✅
61
+
62
+ **Testing approach** (lines 240-264):
63
+ ```javascript
64
+ // Run the feature's BDD tests (scenarios + step definitions)
65
+ const { exec } = require('child_process');
66
+ exec('npm run test:bdd -- [feature-file].feature', (err, stdout) => {
67
+ // Check if step definitions pass
68
+ // Step definitions were created during feature discovery
69
+ // Your implementation must make them pass
70
+ });
71
+ ```
72
+
73
+ **What's good:**
74
+ - ✅ Clear test execution loop
75
+ - ✅ Uses BDD tests as acceptance criteria
76
+ - ✅ Iterates until scenarios pass
77
+ - ✅ Tests are run before marking chore complete
78
+
79
+ **What could improve:**
80
+ - ⚠️ No timeout handling for hung tests
81
+ - ⚠️ No guidance on unit vs integration tests
82
+ - ⚠️ Only validates happy path scenarios
83
+
84
+ **Test types written:**
85
+ - BDD acceptance tests (inherited from feature-planning)
86
+ - No explicit unit tests mentioned
87
+ - No integration tests mentioned
88
+
89
+ **Test types run:**
90
+ - BDD tests: ✅ Yes, continuously
91
+ - Unit tests: ⚠️ Not mentioned
92
+ - Integration tests: ⚠️ Not mentioned
93
+
94
+ ---
95
+
96
+ ### 3. Stable-Mode Skill
97
+
98
+ **What it does with tests:**
99
+ - Creates additional BDD scenarios for error handling and edge cases ✅ (lines 68-98)
100
+ - Updates step definitions for new scenarios ✅
101
+ - Runs all BDD tests (happy path + error/edge cases) ✅ (lines 488-553)
102
+ - Iterates with MAX_ITERATIONS safety limit ✅
103
+
104
+ **Testing approach** (lines 462-579):
105
+ ```javascript
106
+ const MAX_ITERATIONS = 10; // Prevent infinite loops
107
+ const TEST_TIMEOUT = 60000; // 60 second timeout per test run
108
+
109
+ while (!scenarioPasses && iteration < MAX_ITERATIONS) {
110
+ iteration++;
111
+ // Modify code
112
+ // Run tests with timeout
113
+ // Check if target scenario passes
114
+ // Verify all scenarios still pass (no regressions)
115
+ }
116
+ ```
117
+
118
+ **What's excellent:**
119
+ - ✅ Comprehensive error handling in test execution
120
+ - ✅ Timeout protection (60s per test run)
121
+ - ✅ Iteration limits prevent infinite loops
122
+ - ✅ Regression checking - ensures new scenarios don't break old ones
123
+ - ✅ Detailed error extraction from test output
124
+
125
+ **What's good:**
126
+ - ✅ Creates error handling scenarios
127
+ - ✅ Creates edge case scenarios
128
+ - ✅ Runs tests continuously during implementation
129
+ - ✅ Validates all scenarios pass before completion
130
+
131
+ **What could improve:**
132
+ - ⚠️ Still focused only on BDD tests
133
+ - ⚠️ No mention of unit tests for error handling logic
134
+ - ⚠️ No guidance on test organization/structure
135
+
136
+ **Test types written:**
137
+ - BDD error handling scenarios ✅
138
+ - BDD edge case scenarios ✅
139
+ - Step definitions for error cases ✅
140
+ - Unit tests for error handling: ❌ Not mentioned
141
+
142
+ **Test types run:**
143
+ - BDD tests: ✅ Yes, with comprehensive error handling
144
+ - Unit tests: ❌ Not mentioned
145
+
146
+ ---
147
+
148
+ ### 4. Production-Mode Skill
149
+
150
+ **What it does with tests:**
151
+ - Detects context (Scenario A/B/C) ✅
152
+ - Validates/generates production scenarios from standards ✅
153
+ - Appends scenarios to .feature file ✅
154
+
155
+ **Testing approach** (lines 295-323):
156
+ ```javascript
157
+ // Example: If chore is about TLS enforcement
158
+ // 1. Read the standard's acceptance criteria
159
+ // 2. Implement code that satisfies the criteria
160
+ // 3. Add tests based on scenario steps
161
+
162
+ console.log('Run: npx cucumber-js to verify scenarios pass');
163
+ ```
164
+
165
+ **What's concerning:**
166
+ - ❌ Vague testing guidance ("Add tests based on scenario steps")
167
+ - ❌ Manual test execution suggestion instead of automated loop
168
+ - ❌ No iteration logic like speed/stable modes
169
+ - ❌ No verification that tests pass before completion
170
+ - ❌ No test timeout handling
171
+ - ❌ No error handling in test execution
172
+
173
+ **What's good:**
174
+ - ✅ Standards-driven scenarios
175
+
176
+ **What's missing:**
177
+ - ❌ NO concrete test execution strategy
178
+ - ❌ NO automated test verification loop
179
+ - ❌ NO guidance on security testing vs functional testing
180
+ - ❌ NO performance test guidance
181
+ - ❌ NO compliance validation testing
182
+
183
+ **Test types written:**
184
+ - Production scenarios (security, scale, compliance) ✅
185
+ - Step definitions for production scenarios: ⚠️ Implied but not explicit
186
+
187
+ **Test types run:**
188
+ - ❌ Not clearly defined
189
+
190
+ ---
191
+
192
+ ### 5. Standalone Chore Approach (ai-test-writing-requirements.md)
193
+
194
+ **What it covers:**
195
+ - Test safety patterns ✅✅✅
196
+ - File tracking for cleanup ✅✅
197
+ - Snapshot and restore patterns ✅✅
198
+ - Test structure with Before/After hooks ✅✅
199
+
200
+ **Key principles** (lines 6-20):
201
+ ```javascript
202
+ // 1. Track Everything You Create
203
+ context.createdFiles = [];
204
+ context.createdDirs = [];
205
+
206
+ // 2. Snapshot and Restore Critical Files
207
+ this.originalSnapshot = {
208
+ packageJson: fs.readFileSync('package.json', 'utf-8'),
209
+ config: fs.readFileSync('.jettypod/config.json', 'utf-8')
210
+ };
211
+
212
+ // 3. Clean Up Test Artifacts
213
+ // Remove all test-created files/directories
214
+ ```
215
+
216
+ **What's excellent:**
217
+ - ✅✅✅ Comprehensive safety patterns
218
+ - ✅✅✅ Protection against test corruption of production code
219
+ - ✅✅ File tracking and cleanup
220
+ - ✅✅ Critical file snapshots
221
+ - ✅✅ Error handling in cleanup (try/catch)
222
+ - ✅ Clear dangerous patterns to avoid
223
+
224
+ **What's unique:**
225
+ - Focuses on test *safety* not test *execution*
226
+ - Protects the codebase from test pollution
227
+ - Assumes tests are being written, provides infrastructure
228
+
229
+ **The gap:**
230
+ - ❓ This approach is NOT integrated into any skill
231
+ - ❓ Skills don't mention Before/After hooks
232
+ - ❓ Skills don't emphasize test safety patterns
233
+ - ❓ No guidance on when to use this approach
234
+
235
+ ---
236
+
237
+ ## Test Timing Analysis
238
+
239
+ ### What Gets Written When
240
+
241
+ | Phase | Test Types Created | Status |
242
+ |-------|-------------------|--------|
243
+ | **Feature-planning** | BDD happy path scenario ✅<br/>Step definitions for happy path ✅ | Created but not validated |
244
+ | **Speed-mode** | (inherits BDD tests from feature-planning) | Validates happy path |
245
+ | **Stable-mode** | BDD error scenarios ✅<br/>BDD edge case scenarios ✅<br/>Step definitions for errors/edges ✅ | Creates and validates |
246
+ | **Production-mode** | BDD production scenarios ✅ (security, scale, compliance)<br/>Step definitions for production ⚠️ | Created but validation unclear |
247
+
248
+ **Missing entirely:**
249
+ - ❌ Unit tests (no skill mentions them)
250
+ - ❌ Integration tests (no skill mentions them)
251
+ - ❌ Performance tests (mentioned in production context but not executed)
252
+ - ❌ Security tests (mentioned in production but no concrete strategy)
253
+
254
+ ---
255
+
256
+ ### What Gets Run When
257
+
258
+ | Phase | Tests Executed | Frequency | Quality |
259
+ |-------|---------------|-----------|---------|
260
+ | **Feature-planning** | ❌ NONE | Never | N/A |
261
+ | **Speed-mode** | BDD happy path ✅ | Continuous loop | Good |
262
+ | **Stable-mode** | BDD happy path ✅<br/>BDD error scenarios ✅<br/>BDD edge cases ✅ | Continuous loop with timeouts | Excellent |
263
+ | **Production-mode** | BDD production scenarios ⚠️ | Manual? Unclear | Poor |
264
+
265
+ **Problems:**
266
+ 1. **Feature-planning writes tests but never runs them** → Broken step definitions discovered later
267
+ 2. **Speed-mode only runs happy path** → Error handling untested until stable
268
+ 3. **Production-mode lacks automated verification** → Manual testing bottleneck
269
+
270
+ ---
271
+
272
+ ## Efficiency Analysis
273
+
274
+ ### Current Workflow Efficiency
275
+
276
+ **Feature-planning:**
277
+ - ✅ Fast: Creates scenarios and step definitions quickly
278
+ - ❌ Risky: No validation = potential time bombs
279
+ - ❌ Rework potential: Broken step definitions discovered in speed-mode
280
+
281
+ **Speed-mode:**
282
+ - ✅ Good: Tight feedback loop with BDD tests
283
+ - ⚠️ Could be better: Only tests happy path
284
+ - ✅ Iterative: Keeps trying until tests pass
285
+
286
+ **Stable-mode:**
287
+ - ✅✅ Excellent: Comprehensive test execution
288
+ - ✅✅ Excellent: Timeout and iteration limits
289
+ - ✅✅ Excellent: Regression checking
290
+ - ⚠️ Could be better: Only BDD tests, no unit tests
291
+
292
+ **Production-mode:**
293
+ - ❌ Poor: Vague test execution
294
+ - ❌ Poor: No automated verification loop
295
+ - ❌ Poor: Manual testing suggestions
296
+
297
+ ---
298
+
299
+ ## Quality Assurance Analysis
300
+
301
+ ### Test Coverage by Mode
302
+
303
+ **Feature-planning:**
304
+ - Functional coverage: ✅ Happy path only (appropriate for discovery)
305
+ - Test infrastructure: ❌ Not validated
306
+ - Feedback timing: ❌ Delayed to speed-mode
307
+
308
+ **Speed-mode:**
309
+ - Functional coverage: ✅ Happy path (appropriate)
310
+ - Error coverage: ❌ None (deferred to stable)
311
+ - Regression coverage: ⚠️ Limited
312
+
313
+ **Stable-mode:**
314
+ - Functional coverage: ✅✅ Complete (happy + errors + edges)
315
+ - Error coverage: ✅✅ Comprehensive
316
+ - Regression coverage: ✅✅ Excellent
317
+ - Edge case coverage: ✅✅ Explicit
318
+ - Test safety: ❌ No mention of ai-test-writing-requirements patterns
319
+
320
+ **Production-mode:**
321
+ - Security coverage: ⚠️ Scenarios exist but validation unclear
322
+ - Performance coverage: ❌ Not mentioned
323
+ - Compliance coverage: ⚠️ Scenarios exist but testing unclear
324
+ - Infrastructure coverage: ❌ Not mentioned
325
+
326
+ ---
327
+
328
+ ## Recommendations
329
+
330
+ ### 1. Add Test Validation to Feature-Planning (HIGH PRIORITY)
331
+
332
+ **Problem**: Step definitions are created but never validated until speed-mode.
333
+
334
+ **Solution**: Add smoke test execution at end of feature-planning:
335
+
336
+ ```javascript
337
+ // After creating .feature and .steps.js files
338
+ console.log('🧪 Validating BDD infrastructure...');
339
+
340
+ try {
341
+ // Run cucumber with dry-run to validate syntax
342
+ const { execSync } = require('child_process');
343
+ execSync('npx cucumber-js --dry-run features/[feature-slug].feature', {
344
+ stdio: 'pipe',
345
+ timeout: 5000
346
+ });
347
+
348
+ console.log('✅ BDD infrastructure validated');
349
+ console.log('✅ Step definitions match scenario steps');
350
+ } catch (err) {
351
+ console.error('❌ BDD infrastructure broken:');
352
+ console.error(err.message);
353
+ console.log('\nFix step definitions before proceeding to implementation.');
354
+ return;
355
+ }
356
+ ```
357
+
358
+ **Benefits:**
359
+ - Catch syntax errors immediately
360
+ - Verify step definitions match scenario steps
361
+ - Ensure BDD infrastructure works before implementation
362
+ - Fast feedback loop (dry-run is fast)
363
+
364
+ **Cost:** ~5 seconds per feature
365
+
366
+ ---
367
+
368
+ ### 2. Integrate ai-test-writing-requirements.md Patterns (MEDIUM PRIORITY)
369
+
370
+ **Problem**: Excellent test safety patterns exist but aren't used in any skill.
371
+
372
+ **Solution**: Reference and require these patterns when creating step definitions:
373
+
374
+ **In feature-planning** (when creating step definitions):
375
+ ```javascript
376
+ // After writing step definitions file, add this guidance:
377
+ console.log(`
378
+ ✅ Step definitions created: ${stepsFile}
379
+
380
+ ⚠️ IMPORTANT: Follow test safety patterns when implementing:
381
+ - Track all created files in this.createdFiles
382
+ - Track all created directories in this.createdDirs
383
+ - Snapshot critical files before modifications
384
+ - Use Before/After hooks for setup/cleanup
385
+ - See: docs/ai-test-writing-requirements.md
386
+ `);
387
+ ```
388
+
389
+ **In speed-mode and stable-mode** (when implementing):
390
+ ```javascript
391
+ // Before starting implementation:
392
+ console.log(`
393
+ 📋 Test Safety Checklist:
394
+ - [ ] All created files tracked for cleanup
395
+ - [ ] All created dirs tracked for cleanup
396
+ - [ ] Critical files (package.json, config) snapshotted
397
+ - [ ] Before/After hooks handle setup/teardown
398
+ - [ ] Try/catch around cleanup operations
399
+ - [ ] No production directories in cleanup paths
400
+
401
+ See: docs/ai-test-writing-requirements.md for patterns
402
+ `);
403
+ ```
404
+
405
+ **Benefits:**
406
+ - Prevents test corruption of production code
407
+ - Standardizes test safety across workflow
408
+ - Reduces "test broke the codebase" incidents
409
+
410
+ ---
411
+
412
+ ### 3. Add Unit Test Guidance to Stable-Mode (MEDIUM PRIORITY)
413
+
414
+ **Problem**: Stable-mode focuses on BDD tests but error handling logic often needs unit tests.
415
+
416
+ **Solution**: Distinguish between BDD integration tests and unit tests for error handling:
417
+
418
+ ```javascript
419
+ // After adding error handling to code
420
+ console.log(`
421
+ 📋 Testing Strategy for Error Handling:
422
+
423
+ 1. BDD Tests (integration level):
424
+ ✅ Created error handling scenarios
425
+ ✅ Testing end-to-end error behavior
426
+
427
+ 2. Unit Tests (recommended for complex error handling):
428
+ - Test error detection logic in isolation
429
+ - Test error message formatting
430
+ - Test error recovery mechanisms
431
+ - Test error logging behavior
432
+
433
+ Example: If you added error handling to validateInput():
434
+ - BDD test: "When I submit invalid input Then I see error message"
435
+ - Unit test: validateInput.test.js with edge cases
436
+
437
+ Create unit tests? (y/n)
438
+ `);
439
+ ```
440
+
441
+ **Benefits:**
442
+ - Better test granularity
443
+ - Faster test execution (unit tests are quick)
444
+ - Better error handling coverage
445
+ - Easier debugging of failures
446
+
447
+ ---
448
+
449
+ ### 4. Add Automated Test Loop to Production-Mode (HIGH PRIORITY)
450
+
451
+ **Problem**: Production-mode suggests manual test execution instead of automated verification.
452
+
453
+ **Solution**: Add the same test execution loop as stable-mode:
454
+
455
+ ```javascript
456
+ // In production-mode Step 3
457
+ const MAX_ITERATIONS = 10;
458
+ const TEST_TIMEOUT = 120000; // 2 minutes for production tests
459
+
460
+ let iteration = 0;
461
+ let scenarioPasses = false;
462
+
463
+ while (!scenarioPasses && iteration < MAX_ITERATIONS) {
464
+ iteration++;
465
+ console.log(`\n🔄 Production Hardening Iteration ${iteration}/${MAX_ITERATIONS}`);
466
+
467
+ // 1. Implement production hardening
468
+ console.log('✍️ Adding production hardening...');
469
+ // ... use Edit tool ...
470
+
471
+ // 2. Run production scenarios with timeout
472
+ console.log('🧪 Running production scenarios...');
473
+
474
+ try {
475
+ const { stdout, stderr } = await execPromise(
476
+ 'npx cucumber-js --tags "@production" features/[feature-slug].feature',
477
+ { timeout: TEST_TIMEOUT, killSignal: 'SIGTERM' }
478
+ );
479
+
480
+ // Check if production scenarios pass
481
+ const productionScenarioPassed = stdout.includes('[scenario-title]') &&
482
+ stdout.includes('✓');
483
+
484
+ if (productionScenarioPassed) {
485
+ console.log('✅ Production scenario passes!');
486
+ scenarioPasses = true;
487
+ } else {
488
+ console.log('❌ Production scenario still failing');
489
+ // Extract failure and iterate
490
+ }
491
+ } catch (testErr) {
492
+ // Handle timeout and errors
493
+ }
494
+ }
495
+ ```
496
+
497
+ **Benefits:**
498
+ - Consistent testing approach across all modes
499
+ - Automated verification before completion
500
+ - Prevents "forgot to test" scenarios
501
+ - Provides same quality guarantees as stable-mode
502
+
503
+ ---
504
+
505
+ ### 5. Add Test Type Guidance to All Skills (LOW PRIORITY)
506
+
507
+ **Problem**: Skills don't distinguish between test types or guidance on when to use what.
508
+
509
+ **Solution**: Add test type decision tree to each skill:
510
+
511
+ ```
512
+ 📋 Test Strategy Decision Tree:
513
+
514
+ When to write BDD tests:
515
+ ✅ Testing complete user workflows
516
+ ✅ Testing integration between components
517
+ ✅ Acceptance criteria from scenarios
518
+ ✅ End-to-end behavior validation
519
+
520
+ When to write Unit tests:
521
+ ✅ Testing isolated functions/methods
522
+ ✅ Testing error handling logic
523
+ ✅ Testing utility functions
524
+ ✅ Testing complex algorithms
525
+ ✅ Fast feedback needed
526
+
527
+ When to write Integration tests:
528
+ ✅ Testing component interactions
529
+ ✅ Testing database operations
530
+ ✅ Testing API integrations
531
+ ✅ Testing file system operations
532
+
533
+ Current skill focus: [BDD tests]
534
+ Recommended additions: [Unit tests for error handling logic]
535
+ ```
536
+
537
+ **Benefits:**
538
+ - Clearer testing strategy
539
+ - Better test organization
540
+ - Appropriate test granularity
541
+ - Faster test execution (more unit tests = faster CI)
542
+
543
+ ---
544
+
545
+ ### 6. Add Performance Testing Guidance to Production-Mode (LOW PRIORITY)
546
+
547
+ **Problem**: Production-mode mentions performance but provides no testing strategy.
548
+
549
+ **Solution**: Add performance testing section:
550
+
551
+ ```javascript
552
+ // In production-mode after functional tests pass
553
+ console.log(`
554
+ 🚀 Performance Validation:
555
+
556
+ Production standards require:
557
+ ${standards.performance.map(s => ` - ${s.requirement}`).join('\n')}
558
+
559
+ Recommended performance tests:
560
+ 1. Load testing: Can system handle expected user volume?
561
+ 2. Stress testing: Where does system break?
562
+ 3. Endurance testing: Does system degrade over time?
563
+ 4. Spike testing: How does system handle traffic spikes?
564
+
565
+ Tools to consider:
566
+ - Apache Bench (ab) for HTTP endpoints
567
+ - Jest with performance timers for function benchmarks
568
+ - Artillery for load testing
569
+ - k6 for modern load testing
570
+
571
+ Create performance tests? (y/n)
572
+ `);
573
+ ```
574
+
575
+ **Benefits:**
576
+ - Explicit performance testing strategy
577
+ - Catches performance regressions
578
+ - Validates production readiness
579
+ - Documents performance expectations
580
+
581
+ ---
582
+
583
+ ## Recommended Implementation Priority
584
+
585
+ ### Phase 1: Quick Wins (Highest ROI)
586
+ 1. ✅ **Add dry-run validation to feature-planning**
587
+ - Cost: 30 minutes to implement
588
+ - Benefit: Catch broken step definitions immediately
589
+ - ROI: Massive - prevents wasted time in speed-mode
590
+
591
+ 2. ✅ **Add automated test loop to production-mode**
592
+ - Cost: 1 hour to implement
593
+ - Benefit: Consistent quality across all modes
594
+ - ROI: High - prevents manual testing bottleneck
595
+
596
+ ### Phase 2: Quality Improvements (High Value)
597
+ 3. ✅ **Integrate ai-test-writing-requirements.md patterns**
598
+ - Cost: 2 hours to update all skills
599
+ - Benefit: Prevent test corruption of codebase
600
+ - ROI: High - prevents "tests broke production" incidents
601
+
602
+ 4. ✅ **Add unit test guidance to stable-mode**
603
+ - Cost: 1 hour to implement
604
+ - Benefit: Better test granularity and coverage
605
+ - ROI: Medium - improves test quality
606
+
607
+ ### Phase 3: Strategic Enhancements (Long-term)
608
+ 5. ⚠️ **Add test type guidance to all skills**
609
+ - Cost: 3 hours to implement
610
+ - Benefit: Better test organization
611
+ - ROI: Medium - improves test architecture
612
+
613
+ 6. ⚠️ **Add performance testing to production-mode**
614
+ - Cost: 4 hours to implement
615
+ - Benefit: Performance regression detection
616
+ - ROI: Medium - depends on performance requirements
617
+
618
+ ---
619
+
620
+ ## Comparative Analysis: Current vs ai-test-writing-requirements.md
621
+
622
+ ### Current Skills Approach
623
+ **Focus**: Test execution and functional coverage
624
+ **Strengths**:
625
+ - Good BDD test execution loops (speed/stable)
626
+ - Clear acceptance criteria
627
+ - Iterative validation
628
+
629
+ **Weaknesses**:
630
+ - No test safety patterns
631
+ - No file tracking/cleanup guidance
632
+ - No snapshot/restore patterns
633
+ - Risk of test corruption
634
+
635
+ ### ai-test-writing-requirements.md Approach
636
+ **Focus**: Test safety and infrastructure
637
+ **Strengths**:
638
+ - Comprehensive safety patterns
639
+ - File tracking and cleanup
640
+ - Snapshot and restore
641
+ - Protection against corruption
642
+
643
+ **Weaknesses**:
644
+ - Doesn't address test execution timing
645
+ - Doesn't address test type selection
646
+ - Not integrated into workflow
647
+
648
+ ### Ideal Hybrid Approach
649
+ **Combine both**:
650
+ 1. Test safety patterns from ai-test-writing-requirements.md
651
+ 2. Test execution loops from speed/stable-mode
652
+ 3. Validation timing from feature-planning (new)
653
+ 4. Test type guidance (new)
654
+
655
+ **Result**: Safe, comprehensive, well-timed testing strategy
656
+
657
+ ---
658
+
659
+ ## Summary: Testing at the Right Time
660
+
661
+ ### Current State Problems
662
+ 1. **Feature-planning**: Writes tests but doesn't validate them
663
+ 2. **Speed-mode**: Only tests happy path
664
+ 3. **Stable-mode**: Great test execution but missing test safety
665
+ 4. **Production-mode**: Weak automated testing
666
+
667
+ ### Recommended State
668
+ 1. **Feature-planning**: Write tests + dry-run validation
669
+ 2. **Speed-mode**: Test happy path + test safety patterns
670
+ 3. **Stable-mode**: Comprehensive testing + unit tests for error handling
671
+ 4. **Production-mode**: Automated test loop + performance testing
672
+
673
+ ### Key Insight from ai-test-writing-requirements.md
674
+
675
+ The standalone chore approach reveals that JettyPod has excellent test safety patterns but they're siloed in a separate document. **The skills need to integrate these patterns** to prevent test pollution while maintaining their good test execution strategies.
676
+
677
+ The ideal workflow:
678
+ 1. Write tests (feature-planning) + validate syntax
679
+ 2. Implement with safety (speed-mode) + test happy path
680
+ 3. Add robustness (stable-mode) + test errors/edges with safety patterns
681
+ 4. Harden for production (production-mode) + automated validation loop
682
+
683
+ ---
684
+
685
+ ## Conclusion
686
+
687
+ **Biggest Gap**: Feature-planning creates tests but doesn't validate them.
688
+
689
+ **Biggest Win**: Stable-mode has excellent test execution with timeouts and iteration limits.
690
+
691
+ **Biggest Opportunity**: Integrate ai-test-writing-requirements.md safety patterns into all skills.
692
+
693
+ **Recommended Next Steps**:
694
+ 1. Add dry-run validation to feature-planning (30 min, massive ROI)
695
+ 2. Add automated test loop to production-mode (1 hour, high ROI)
696
+ 3. Reference ai-test-writing-requirements.md in all skills (2 hours, prevents corruption)
697
+
698
+ This would create a testing strategy that writes the right tests at the right time, runs them efficiently, and ensures both functional quality and codebase safety.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { importAll } = require('../lib/db-import');
4
+
5
+ (async () => {
6
+ try {
7
+ // Import JSON snapshots into databases after checkout
8
+ await importAll();
9
+
10
+ // Exit successfully - checkout should not be blocked
11
+ process.exit(0);
12
+ } catch (err) {
13
+ // Log error but don't block checkout
14
+ console.error('Post-checkout hook warning:', err.message);
15
+ process.exit(0);
16
+ }
17
+ })();