@harness-engineering/cli 1.8.0 → 1.8.1
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/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +2 -2
- package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +5 -7
- package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +2 -2
- package/dist/agents/skills/claude-code/harness-planning/SKILL.md +2 -2
- package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +4 -5
- package/dist/agents/skills/gemini-cli/add-harness-component/SKILL.md +192 -0
- package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/align-documentation/SKILL.md +213 -0
- package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +31 -0
- package/dist/agents/skills/gemini-cli/check-mechanical-constraints/SKILL.md +191 -0
- package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +245 -0
- package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +179 -0
- package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +30 -0
- package/dist/agents/skills/gemini-cli/enforce-architecture/SKILL.md +240 -0
- package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +34 -0
- package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +397 -0
- package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +48 -0
- package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +2 -2
- package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +317 -0
- package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +49 -0
- package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +681 -0
- package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +45 -0
- package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +366 -0
- package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +47 -0
- package/dist/agents/skills/gemini-cli/harness-diagnostics/SKILL.md +318 -0
- package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +50 -0
- package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +382 -0
- package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +51 -0
- package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +268 -0
- package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +31 -0
- package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +167 -0
- package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +47 -0
- package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +288 -0
- package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +30 -0
- package/dist/agents/skills/gemini-cli/harness-parallel-agents/SKILL.md +171 -0
- package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +389 -0
- package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +49 -0
- package/dist/agents/skills/gemini-cli/harness-pre-commit-review/SKILL.md +262 -0
- package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +169 -0
- package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +33 -0
- package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +4 -5
- package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +292 -0
- package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/harness-state-management/SKILL.md +309 -0
- package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +32 -0
- package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +177 -0
- package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +48 -0
- package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +328 -0
- package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +42 -0
- package/dist/agents/skills/gemini-cli/harness-verify/SKILL.md +159 -0
- package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +40 -0
- package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +224 -0
- package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +31 -0
- package/dist/agents/skills/gemini-cli/validate-context-engineering/SKILL.md +150 -0
- package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +31 -0
- package/dist/bin/harness.js +3 -3
- package/dist/{chunk-SJECMKSS.js → chunk-E2RTDBMG.js} +25 -13
- package/dist/{chunk-LNI4T7R6.js → chunk-KJANDVVC.js} +20 -18
- package/dist/{chunk-3JWCBVUZ.js → chunk-RT2LYQHF.js} +1 -1
- package/dist/{dist-NT3GXHQZ.js → dist-CCM3L3UE.js} +1 -1
- package/dist/{dist-BDO5GFEM.js → dist-K6KTTN3I.js} +3 -3
- package/dist/index.js +3 -3
- package/dist/validate-cross-check-ZGKFQY57.js +7 -0
- package/package.json +6 -6
- package/dist/agents/skills/node_modules/.bin/glob +0 -17
- package/dist/agents/skills/node_modules/.bin/vitest +0 -17
- package/dist/agents/skills/node_modules/.bin/yaml +0 -17
- package/dist/templates/advanced/docs/specs/.gitkeep +0 -0
- package/dist/templates/intermediate/docs/specs/.gitkeep +0 -0
- package/dist/validate-cross-check-2OPGCGGU.js +0 -7
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# Harness Diagnostics
|
|
2
|
+
|
|
3
|
+
> Cognitive mode: **diagnostic-investigator**. Classify errors into taxonomy categories and route to deterministic resolution strategies. Evidence first, classification second, action third.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- When an error occurs and the root cause category is unclear
|
|
8
|
+
- When a bug fix attempt failed and you need a structured re-approach
|
|
9
|
+
- When `on_bug_fix` triggers fire and the error does not match a known pattern
|
|
10
|
+
- When you need to decide whether to fix locally or escalate
|
|
11
|
+
- NOT for obvious typos or syntax errors with clear fixes (just fix them)
|
|
12
|
+
- NOT for feature development (use harness-tdd instead)
|
|
13
|
+
- NOT for deep multi-phase debugging (use harness-debugging instead — this skill classifies and routes)
|
|
14
|
+
|
|
15
|
+
## Error Taxonomy
|
|
16
|
+
|
|
17
|
+
Every error falls into one of 7 categories. Each category has distinct signals and a distinct resolution strategy. Misclassification leads to wasted effort — a Logic error treated as Syntax will never be fixed by reading the compiler output.
|
|
18
|
+
|
|
19
|
+
### Category 1: Syntax/Type
|
|
20
|
+
|
|
21
|
+
**Signals:** Compilation failures, type errors, parse errors, import resolution failures, "cannot find name", "expected X but got Y" from the compiler or type checker.
|
|
22
|
+
|
|
23
|
+
**Resolution strategy:** Read the error message. It tells you exactly what is wrong and where. Fix mechanically — match the type, fix the import, correct the syntax. No investigation needed. Run the type checker to confirm.
|
|
24
|
+
|
|
25
|
+
**Time budget:** Under 5 minutes. If it takes longer, you have misclassified.
|
|
26
|
+
|
|
27
|
+
### Category 2: Logic
|
|
28
|
+
|
|
29
|
+
**Signals:** Tests fail with wrong output values, unexpected behavior at runtime, "expected X but received Y" from test assertions, correct types but incorrect results.
|
|
30
|
+
|
|
31
|
+
**Resolution strategy:** Write a failing test FIRST that isolates the incorrect behavior. Then trace the data flow from input to incorrect output. Find the exact line where the actual value diverges from the expected value. Fix that line. Run the test to confirm.
|
|
32
|
+
|
|
33
|
+
**Time budget:** 5-30 minutes. If it takes longer, consider reclassifying as Design.
|
|
34
|
+
|
|
35
|
+
### Category 3: Design
|
|
36
|
+
|
|
37
|
+
**Signals:** Multiple related failures, fixes that break other things, circular dependencies, "everything is tangled", you cannot write a clean test because the code is not testable, the fix requires changing many files.
|
|
38
|
+
|
|
39
|
+
**Resolution strategy:** STOP. Do not attempt to fix locally. This is an architectural issue that requires human judgment. Document the symptoms, the attempted fixes, and the structural problem. Escalate to the human architect with a clear summary and 2-3 options.
|
|
40
|
+
|
|
41
|
+
**Time budget:** 15 minutes maximum for classification and documentation. Do not spend time attempting fixes.
|
|
42
|
+
|
|
43
|
+
### Category 4: Performance
|
|
44
|
+
|
|
45
|
+
**Signals:** Slow responses, timeouts, high memory usage, "heap out of memory", operations that used to be fast are now slow, N+1 query patterns.
|
|
46
|
+
|
|
47
|
+
**Resolution strategy:** Profile FIRST. Do not guess at the bottleneck. Use the appropriate profiling tool for the runtime (browser devtools, `node --prof`, `py-spy`, database `EXPLAIN`). Identify the actual hotspot. Optimize only that hotspot. Measure again to confirm improvement.
|
|
48
|
+
|
|
49
|
+
**Time budget:** 15-60 minutes. Profiling takes time but prevents optimizing the wrong thing.
|
|
50
|
+
|
|
51
|
+
### Category 5: Security
|
|
52
|
+
|
|
53
|
+
**Signals:** Vulnerability scanner findings, injection possibilities, authentication/authorization failures, exposed secrets, CORS issues, unsafe deserialization.
|
|
54
|
+
|
|
55
|
+
**Resolution strategy:** Check OWASP Top 10 for the vulnerability class. Apply the minimal fix that closes the vulnerability without changing unrelated behavior. Do not refactor surrounding code during a security fix — minimize the blast radius. Verify with a test that the vulnerability is closed.
|
|
56
|
+
|
|
57
|
+
**Time budget:** Variable, but the fix itself should be minimal. If the fix requires large changes, reclassify as Design and escalate.
|
|
58
|
+
|
|
59
|
+
### Category 6: Environment
|
|
60
|
+
|
|
61
|
+
**Signals:** "Module not found" at runtime (not compile time), version mismatch errors, "connection refused", works on one machine but not another, Docker/CI failures that pass locally, missing environment variables.
|
|
62
|
+
|
|
63
|
+
**Resolution strategy:** Check versions first — runtime, dependencies, OS. Compare the failing environment to a working environment. Look at: Node/Python/Java version, dependency lock file freshness, environment variables, file permissions, network connectivity. Fix the environment, not the code.
|
|
64
|
+
|
|
65
|
+
**Time budget:** 5-30 minutes. Environment issues are usually fast once you compare configurations.
|
|
66
|
+
|
|
67
|
+
### Category 7: Flaky
|
|
68
|
+
|
|
69
|
+
**Signals:** Test passes sometimes and fails sometimes, "works on retry", timing-dependent failures, failures that disappear when you add logging, race conditions, order-dependent test results.
|
|
70
|
+
|
|
71
|
+
**Resolution strategy:** Isolate the timing dependency. Run the failing test in isolation — does it still flake? Run it 20 times in a loop — what is the failure rate? Look for: shared mutable state between tests, missing `await` on async operations, time-dependent assertions (`setTimeout`, `Date.now()`), external service dependencies without mocking. Fix the non-determinism, do not add retries.
|
|
72
|
+
|
|
73
|
+
**Time budget:** 15-60 minutes. Flaky tests are deceptively hard. If you cannot isolate the timing dependency in 60 minutes, escalate.
|
|
74
|
+
|
|
75
|
+
## Process
|
|
76
|
+
|
|
77
|
+
### Phase 1: CLASSIFY — Collect Evidence and Categorize
|
|
78
|
+
|
|
79
|
+
**This phase must complete before any fix is attempted.**
|
|
80
|
+
|
|
81
|
+
#### Step 1: Run Deterministic Checks (Baseline)
|
|
82
|
+
|
|
83
|
+
Capture the current state before any changes:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Run type checker (adapt to project language)
|
|
87
|
+
npx tsc --noEmit 2>&1 | tail -50
|
|
88
|
+
|
|
89
|
+
# Run test suite
|
|
90
|
+
npm test 2>&1 | tail -100
|
|
91
|
+
|
|
92
|
+
# Record results
|
|
93
|
+
echo "Baseline captured at $(date)" >> .harness/diagnostics/current.md
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Record exact counts: how many type errors, how many test failures, which tests fail.
|
|
97
|
+
|
|
98
|
+
#### Step 2: Read the Complete Error
|
|
99
|
+
|
|
100
|
+
Read the ENTIRE error output. Not the first line. Not the summary. The complete message including:
|
|
101
|
+
|
|
102
|
+
- Error type/code
|
|
103
|
+
- Stack trace (every frame)
|
|
104
|
+
- Warnings that preceded the error
|
|
105
|
+
- Context about what operation was being attempted
|
|
106
|
+
|
|
107
|
+
#### Step 3: Match Signals to Category
|
|
108
|
+
|
|
109
|
+
Compare the error signals against the 7 categories above. Ask:
|
|
110
|
+
|
|
111
|
+
- Is this a compile-time or runtime error? (Compile-time -> likely Syntax/Type)
|
|
112
|
+
- Is the code syntactically valid but producing wrong results? (-> Logic)
|
|
113
|
+
- Does the error involve multiple components or layers? (-> Design)
|
|
114
|
+
- Is it about speed or resource consumption? (-> Performance)
|
|
115
|
+
- Is it about unauthorized access or unsafe data handling? (-> Security)
|
|
116
|
+
- Does it work in one environment but not another? (-> Environment)
|
|
117
|
+
- Does it fail intermittently? (-> Flaky)
|
|
118
|
+
|
|
119
|
+
#### Step 4: State the Classification Explicitly
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
CLASSIFICATION: [Category Name]
|
|
123
|
+
CONFIDENCE: [High/Medium/Low]
|
|
124
|
+
SIGNALS: [List the specific signals that led to this classification]
|
|
125
|
+
ALTERNATIVE: [If confidence is Medium or Low, what other category could it be?]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Gate: Classification must be explicit and written down before proceeding. "I think it's a type error" is not sufficient. State the category, confidence, and signals.**
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### Phase 2: ROUTE — Apply Category-Specific Strategy
|
|
133
|
+
|
|
134
|
+
Follow the resolution strategy for the classified category exactly. Do not mix strategies. Each category has a specific approach because each category has a specific failure mode.
|
|
135
|
+
|
|
136
|
+
If the category is **Design**, STOP HERE. Do not proceed to Phase 3. Document and escalate.
|
|
137
|
+
|
|
138
|
+
For all other categories, execute the resolution strategy as described in the taxonomy above.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### Phase 3: RESOLVE — Execute and Verify
|
|
143
|
+
|
|
144
|
+
#### Step 1: Apply the Fix
|
|
145
|
+
|
|
146
|
+
Implement the fix according to the resolution strategy for the classified category.
|
|
147
|
+
|
|
148
|
+
#### Step 2: Run Deterministic Checks (Verification)
|
|
149
|
+
|
|
150
|
+
Run the same checks from Phase 1 Step 1:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Run type checker
|
|
154
|
+
npx tsc --noEmit 2>&1 | tail -50
|
|
155
|
+
|
|
156
|
+
# Run test suite
|
|
157
|
+
npm test 2>&1 | tail -100
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Compare results to the baseline:
|
|
161
|
+
|
|
162
|
+
- Type errors: must be equal or fewer than baseline
|
|
163
|
+
- Test failures: the target failure must be resolved, no new failures introduced
|
|
164
|
+
- If new failures appeared, the fix is wrong. Revert and re-examine.
|
|
165
|
+
|
|
166
|
+
#### Step 3: Confirm Resolution
|
|
167
|
+
|
|
168
|
+
The error is resolved when:
|
|
169
|
+
|
|
170
|
+
1. The original error no longer occurs
|
|
171
|
+
2. No new errors were introduced
|
|
172
|
+
3. The type checker count is equal or better than baseline
|
|
173
|
+
4. The test suite count is equal or better than baseline
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Phase 4: RECORD — Capture Anti-Patterns (Optional)
|
|
178
|
+
|
|
179
|
+
This phase triggers only when the initial classification was wrong or the first fix attempt failed.
|
|
180
|
+
|
|
181
|
+
#### Step 1: Document What Went Wrong
|
|
182
|
+
|
|
183
|
+
```markdown
|
|
184
|
+
# Diagnostic Record: <brief description>
|
|
185
|
+
|
|
186
|
+
Date: <timestamp>
|
|
187
|
+
Initial Classification: <what you thought it was>
|
|
188
|
+
Actual Classification: <what it turned out to be>
|
|
189
|
+
Misclassification Reason: <why the signals were misleading>
|
|
190
|
+
Resolution: <what actually fixed it>
|
|
191
|
+
Anti-Pattern: <what to watch for next time>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Step 2: Save to Anti-Pattern Log
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Append to diagnostics log
|
|
198
|
+
cat >> .harness/diagnostics/anti-patterns.md << 'ENTRY'
|
|
199
|
+
<the record from Step 1>
|
|
200
|
+
ENTRY
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
This log accumulates over time and helps improve future classifications.
|
|
204
|
+
|
|
205
|
+
## Harness Integration
|
|
206
|
+
|
|
207
|
+
- Follows Principle 7 — runs deterministic checks (typecheck, tests) before and after LLM reasoning
|
|
208
|
+
- Builds on harness-debugging but adds structured classification layer
|
|
209
|
+
- Writes to `.harness/anti-patterns.md` per Group B3 convention
|
|
210
|
+
- Category 3 (Design) escalates to human architect per human-architect model
|
|
211
|
+
|
|
212
|
+
## Success Criteria
|
|
213
|
+
|
|
214
|
+
- [ ] Error is classified into exactly one of the 7 categories
|
|
215
|
+
- [ ] Resolution strategy matches the category playbook
|
|
216
|
+
- [ ] Post-execution checks pass (typecheck + tests)
|
|
217
|
+
- [ ] If initial approach failed, it is recorded in anti-pattern log
|
|
218
|
+
|
|
219
|
+
## Gates
|
|
220
|
+
|
|
221
|
+
- **Classification must be explicit.** You must write down the category, confidence level, and signals before any fix attempt. Implicit classification ("I'll just fix this type error") skips the evidence step and leads to misclassification.
|
|
222
|
+
- **Design category MUST escalate.** If the error is classified as Design, you must stop and escalate to the human. Do not attempt a local fix for an architectural problem. Local fixes for architectural problems create more architectural problems.
|
|
223
|
+
- **Deterministic checks before AND after.** You must run the type checker and test suite both before and after the fix. Without a baseline, you cannot prove the fix helped and did not hurt.
|
|
224
|
+
- **No category mixing.** Follow the resolution strategy for one category. If you find yourself profiling (Performance) while also tracing data flow (Logic), you have not committed to a classification. Pick one.
|
|
225
|
+
- **Reclassify, do not force.** If the resolution strategy is not working, the classification is probably wrong. Go back to Phase 1 and reclassify. Do not force a Logic fix on what turns out to be an Environment issue.
|
|
226
|
+
|
|
227
|
+
## Escalation
|
|
228
|
+
|
|
229
|
+
- **Design errors:** Always escalate. Provide: symptom summary, files affected, 2-3 architectural options if you can identify them.
|
|
230
|
+
- **Confidence is Low:** Escalate if you cannot decide between two categories after examining all signals. Present both possibilities and let the human decide.
|
|
231
|
+
- **Fix introduced new failures:** Revert the fix. Re-examine. If you cannot fix without side effects after 2 attempts, escalate.
|
|
232
|
+
- **Flaky test not isolated in 60 minutes:** The non-determinism source may be outside the codebase (infrastructure, external service). Escalate with your findings.
|
|
233
|
+
- **Security vulnerability with large blast radius:** If the minimal fix requires changing more than 3 files, reclassify as Design and escalate.
|
|
234
|
+
|
|
235
|
+
## Examples
|
|
236
|
+
|
|
237
|
+
### Example 1: Type Error in API Handler
|
|
238
|
+
|
|
239
|
+
**Phase 1 — CLASSIFY:**
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Error: src/handlers/users.ts(42,15): error TS2345:
|
|
243
|
+
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
|
|
244
|
+
|
|
245
|
+
Baseline: 1 type error, 0 test failures.
|
|
246
|
+
|
|
247
|
+
CLASSIFICATION: Syntax/Type
|
|
248
|
+
CONFIDENCE: High
|
|
249
|
+
SIGNALS: Compile-time error, TypeScript error code TS2345, exact file and line provided
|
|
250
|
+
ALTERNATIVE: None — this is unambiguously a type error
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Phase 2 — ROUTE:**
|
|
254
|
+
Following Syntax/Type strategy: read the error, fix mechanically.
|
|
255
|
+
|
|
256
|
+
The function `getUserById(id: string)` is called with `req.params.id` which is `string | undefined`. Add a guard or use non-null assertion after validation.
|
|
257
|
+
|
|
258
|
+
**Phase 3 — RESOLVE:**
|
|
259
|
+
|
|
260
|
+
```typescript
|
|
261
|
+
// Fix: add guard before call
|
|
262
|
+
const id = req.params.id;
|
|
263
|
+
if (!id) {
|
|
264
|
+
return res.status(400).json({ error: 'id parameter is required' });
|
|
265
|
+
}
|
|
266
|
+
const user = await getUserById(id);
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Verification: 0 type errors (was 1), 0 test failures (unchanged). Fix confirmed.
|
|
270
|
+
|
|
271
|
+
### Example 2: Flaky Integration Test
|
|
272
|
+
|
|
273
|
+
**Phase 1 — CLASSIFY:**
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
Error: test/integration/queue.test.ts
|
|
277
|
+
"should process message within timeout"
|
|
278
|
+
Passes 7 out of 10 runs. Fails with: "Timeout — message not processed within 2000ms"
|
|
279
|
+
|
|
280
|
+
Baseline: 0 type errors, 1 flaky test failure (intermittent).
|
|
281
|
+
|
|
282
|
+
CLASSIFICATION: Flaky
|
|
283
|
+
CONFIDENCE: High
|
|
284
|
+
SIGNALS: Intermittent failure, timing-dependent assertion (2000ms timeout),
|
|
285
|
+
passes on retry, failure rate ~30%
|
|
286
|
+
ALTERNATIVE: Could be Environment if CI has different resource constraints,
|
|
287
|
+
but it also flakes locally
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Phase 2 — ROUTE:**
|
|
291
|
+
Following Flaky strategy: isolate the timing dependency.
|
|
292
|
+
|
|
293
|
+
Run in isolation: still flakes (not order-dependent).
|
|
294
|
+
Run 20 times: fails 6/20 times (~30% failure rate, consistent).
|
|
295
|
+
Examine the test: it publishes a message and asserts it is processed within 2000ms.
|
|
296
|
+
Examine the handler: processing involves a database write that sometimes takes >2000ms under load.
|
|
297
|
+
Root cause: the timeout is too tight for the actual processing time, and there is no mechanism to signal completion — the test polls on a timer.
|
|
298
|
+
|
|
299
|
+
**Phase 3 — RESOLVE:**
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
// Before: polling with fixed timeout
|
|
303
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
304
|
+
const result = await db.query('SELECT * FROM processed WHERE id = ?', [msgId]);
|
|
305
|
+
expect(result.rows).toHaveLength(1);
|
|
306
|
+
|
|
307
|
+
// After: event-driven wait with generous timeout
|
|
308
|
+
const result = await waitForCondition(
|
|
309
|
+
() => db.query('SELECT * FROM processed WHERE id = ?', [msgId]).then((r) => r.rows.length > 0),
|
|
310
|
+
{ timeout: 10000, interval: 100 }
|
|
311
|
+
);
|
|
312
|
+
expect(result).toBe(true);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Verification: 0 type errors (unchanged), 20/20 test runs pass. Fix confirmed.
|
|
316
|
+
|
|
317
|
+
**Phase 4 — RECORD:**
|
|
318
|
+
Not needed — initial classification was correct and first fix attempt succeeded.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: harness-diagnostics
|
|
2
|
+
version: "1.0.0"
|
|
3
|
+
description: Classify errors into taxonomy categories and route to resolution strategies
|
|
4
|
+
cognitive_mode: diagnostic-investigator
|
|
5
|
+
triggers:
|
|
6
|
+
- manual
|
|
7
|
+
- on_bug_fix
|
|
8
|
+
platforms:
|
|
9
|
+
- claude-code
|
|
10
|
+
- gemini-cli
|
|
11
|
+
tools:
|
|
12
|
+
- Bash
|
|
13
|
+
- Read
|
|
14
|
+
- Glob
|
|
15
|
+
- Grep
|
|
16
|
+
- Edit
|
|
17
|
+
- Write
|
|
18
|
+
cli:
|
|
19
|
+
command: harness skill run harness-diagnostics
|
|
20
|
+
args:
|
|
21
|
+
- name: path
|
|
22
|
+
description: Project root path
|
|
23
|
+
required: false
|
|
24
|
+
- name: error
|
|
25
|
+
description: Error message or description to diagnose
|
|
26
|
+
required: false
|
|
27
|
+
mcp:
|
|
28
|
+
tool: run_skill
|
|
29
|
+
input:
|
|
30
|
+
skill: harness-diagnostics
|
|
31
|
+
path: string
|
|
32
|
+
type: rigid
|
|
33
|
+
phases:
|
|
34
|
+
- name: classify
|
|
35
|
+
description: Categorize the error into one of 7 taxonomy categories
|
|
36
|
+
required: true
|
|
37
|
+
- name: route
|
|
38
|
+
description: Apply the resolution strategy for the error category
|
|
39
|
+
required: true
|
|
40
|
+
- name: resolve
|
|
41
|
+
description: Execute the resolution and verify the fix
|
|
42
|
+
required: true
|
|
43
|
+
- name: record
|
|
44
|
+
description: Record findings in anti-pattern log if initial approach failed
|
|
45
|
+
required: false
|
|
46
|
+
state:
|
|
47
|
+
persistent: true
|
|
48
|
+
files:
|
|
49
|
+
- .harness/diagnostics/
|
|
50
|
+
depends_on: []
|