opencode-swarm-plugin 0.22.0 → 0.23.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/.turbo/turbo-build.log +9 -0
- package/CHANGELOG.md +20 -0
- package/README.md +109 -429
- package/dist/agent-mail.d.ts +480 -0
- package/dist/agent-mail.d.ts.map +1 -0
- package/dist/anti-patterns.d.ts +257 -0
- package/dist/anti-patterns.d.ts.map +1 -0
- package/dist/beads.d.ts +377 -0
- package/dist/beads.d.ts.map +1 -0
- package/dist/eval-capture.d.ts +206 -0
- package/dist/eval-capture.d.ts.map +1 -0
- package/dist/index.d.ts +1299 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +498 -4246
- package/dist/learning.d.ts +670 -0
- package/dist/learning.d.ts.map +1 -0
- package/dist/mandate-promotion.d.ts +93 -0
- package/dist/mandate-promotion.d.ts.map +1 -0
- package/dist/mandate-storage.d.ts +209 -0
- package/dist/mandate-storage.d.ts.map +1 -0
- package/dist/mandates.d.ts +230 -0
- package/dist/mandates.d.ts.map +1 -0
- package/dist/output-guardrails.d.ts +125 -0
- package/dist/output-guardrails.d.ts.map +1 -0
- package/dist/pattern-maturity.d.ts +246 -0
- package/dist/pattern-maturity.d.ts.map +1 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +493 -4241
- package/dist/rate-limiter.d.ts +218 -0
- package/dist/rate-limiter.d.ts.map +1 -0
- package/dist/repo-crawl.d.ts +146 -0
- package/dist/repo-crawl.d.ts.map +1 -0
- package/dist/schemas/bead.d.ts +255 -0
- package/dist/schemas/bead.d.ts.map +1 -0
- package/dist/schemas/evaluation.d.ts +161 -0
- package/dist/schemas/evaluation.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +34 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/mandate.d.ts +336 -0
- package/dist/schemas/mandate.d.ts.map +1 -0
- package/dist/schemas/swarm-context.d.ts +131 -0
- package/dist/schemas/swarm-context.d.ts.map +1 -0
- package/dist/schemas/task.d.ts +188 -0
- package/dist/schemas/task.d.ts.map +1 -0
- package/dist/skills.d.ts +471 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/storage.d.ts +260 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/structured.d.ts +196 -0
- package/dist/structured.d.ts.map +1 -0
- package/dist/swarm-decompose.d.ts +201 -0
- package/dist/swarm-decompose.d.ts.map +1 -0
- package/dist/swarm-mail.d.ts +240 -0
- package/dist/swarm-mail.d.ts.map +1 -0
- package/dist/swarm-orchestrate.d.ts +708 -0
- package/dist/swarm-orchestrate.d.ts.map +1 -0
- package/dist/swarm-prompts.d.ts +292 -0
- package/dist/swarm-prompts.d.ts.map +1 -0
- package/dist/swarm-strategies.d.ts +100 -0
- package/dist/swarm-strategies.d.ts.map +1 -0
- package/dist/swarm.d.ts +455 -0
- package/dist/swarm.d.ts.map +1 -0
- package/dist/tool-availability.d.ts +91 -0
- package/dist/tool-availability.d.ts.map +1 -0
- package/docs/planning/ADR-001-monorepo-structure.md +171 -0
- package/docs/planning/ADR-002-package-extraction.md +393 -0
- package/docs/planning/ADR-003-performance-improvements.md +451 -0
- package/docs/planning/ADR-004-message-queue-features.md +187 -0
- package/docs/planning/ADR-005-devtools-observability.md +202 -0
- package/docs/planning/ROADMAP.md +368 -0
- package/package.json +13 -24
- package/src/agent-mail.ts +1 -1
- package/src/beads.ts +1 -2
- package/src/index.ts +2 -2
- package/src/learning.integration.test.ts +66 -11
- package/src/mandate-storage.test.ts +3 -3
- package/src/storage.ts +78 -10
- package/src/swarm-mail.ts +3 -3
- package/src/swarm-orchestrate.ts +7 -7
- package/src/tool-availability.ts +1 -1
- package/tsconfig.json +1 -1
- package/.beads/.local_version +0 -1
- package/.beads/README.md +0 -81
- package/.beads/analysis/skill-architecture-meta-skills.md +0 -1562
- package/.beads/config.yaml +0 -62
- package/.beads/issues.jsonl +0 -2197
- package/.beads/metadata.json +0 -4
- package/.gitattributes +0 -3
- package/.github/workflows/ci.yml +0 -30
- package/.github/workflows/opencode.yml +0 -31
- package/.opencode/skills/tdd/SKILL.md +0 -182
- package/INTEGRATION_EXAMPLE.md +0 -66
- package/VERIFICATION_QUALITY_PATTERNS.md +0 -565
- package/bun.lock +0 -286
- package/dist/pglite.data +0 -0
- package/dist/pglite.wasm +0 -0
- package/src/streams/agent-mail.test.ts +0 -777
- package/src/streams/agent-mail.ts +0 -535
- package/src/streams/debug.test.ts +0 -500
- package/src/streams/debug.ts +0 -727
- package/src/streams/effect/ask.integration.test.ts +0 -314
- package/src/streams/effect/ask.ts +0 -202
- package/src/streams/effect/cursor.integration.test.ts +0 -418
- package/src/streams/effect/cursor.ts +0 -288
- package/src/streams/effect/deferred.test.ts +0 -357
- package/src/streams/effect/deferred.ts +0 -445
- package/src/streams/effect/index.ts +0 -17
- package/src/streams/effect/layers.ts +0 -73
- package/src/streams/effect/lock.test.ts +0 -385
- package/src/streams/effect/lock.ts +0 -399
- package/src/streams/effect/mailbox.test.ts +0 -260
- package/src/streams/effect/mailbox.ts +0 -318
- package/src/streams/events.test.ts +0 -924
- package/src/streams/events.ts +0 -329
- package/src/streams/index.test.ts +0 -229
- package/src/streams/index.ts +0 -578
- package/src/streams/migrations.test.ts +0 -359
- package/src/streams/migrations.ts +0 -362
- package/src/streams/projections.test.ts +0 -611
- package/src/streams/projections.ts +0 -504
- package/src/streams/store.integration.test.ts +0 -658
- package/src/streams/store.ts +0 -1075
- package/src/streams/swarm-mail.ts +0 -552
- package/test-bug-fixes.ts +0 -86
- package/vitest.integration.config.ts +0 -19
- package/vitest.integration.setup.ts +0 -48
- package/workflow-integration-analysis.md +0 -876
|
@@ -1,565 +0,0 @@
|
|
|
1
|
-
# Verification & Quality Assurance Patterns
|
|
2
|
-
|
|
3
|
-
**Extracted from:** obra/superpowers repo skills
|
|
4
|
-
**Analysis for:** opencode-swarm-plugin quality philosophy integration
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## I. Core Principles (The Philosophy)
|
|
9
|
-
|
|
10
|
-
1. **Evidence Before Claims, Always**
|
|
11
|
-
- Claiming work is complete without verification is dishonesty, not efficiency
|
|
12
|
-
- Confidence ≠ evidence
|
|
13
|
-
- No shortcuts for verification
|
|
14
|
-
- Partial verification proves nothing
|
|
15
|
-
|
|
16
|
-
2. **Root Cause Over Symptoms**
|
|
17
|
-
- ALWAYS find root cause before attempting fixes
|
|
18
|
-
- Symptom fixes are failure
|
|
19
|
-
- Trace backward through call chain until you find original trigger
|
|
20
|
-
- 95% of "no root cause" cases are incomplete investigation
|
|
21
|
-
|
|
22
|
-
3. **Systematic Over Random**
|
|
23
|
-
- Random fixes waste time and create new bugs
|
|
24
|
-
- Quick patches mask underlying issues
|
|
25
|
-
- Systematic debugging is FASTER than guess-and-check thrashing
|
|
26
|
-
- Process is fast for simple bugs too
|
|
27
|
-
|
|
28
|
-
4. **Defense In Depth**
|
|
29
|
-
- Single validation: "We fixed the bug"
|
|
30
|
-
- Multiple layers: "We made the bug structurally impossible"
|
|
31
|
-
- Validate at EVERY layer data passes through
|
|
32
|
-
- Different layers catch different cases
|
|
33
|
-
|
|
34
|
-
5. **Question Architecture After 3 Failures**
|
|
35
|
-
- If 3+ fixes failed, you have an architectural problem, not a bug
|
|
36
|
-
- Pattern indicates fundamental unsoundness, not failed hypothesis
|
|
37
|
-
- STOP and discuss with human before attempting more fixes
|
|
38
|
-
- "Sticking with it through sheer inertia" is not engineering
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## II. The Iron Laws (Non-Negotiable)
|
|
43
|
-
|
|
44
|
-
### Law 1: NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
If you haven't run the verification command in THIS message,
|
|
48
|
-
you cannot claim it passes.
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Violating the letter of this rule is violating the spirit of this rule.**
|
|
52
|
-
|
|
53
|
-
### Law 2: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
If you haven't completed Phase 1 (Root Cause Investigation),
|
|
57
|
-
you cannot propose fixes.
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
**Violating the letter of this process is violating the spirit of debugging.**
|
|
61
|
-
|
|
62
|
-
### Law 3: NEVER FIX JUST WHERE ERROR APPEARS
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
Trace backward through the call chain until you find the original trigger.
|
|
66
|
-
Then fix at the source.
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Symptom fixes mask underlying issues.**
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## III. Decision Frameworks
|
|
74
|
-
|
|
75
|
-
### A. The Gate Function (Verification)
|
|
76
|
-
|
|
77
|
-
**BEFORE claiming ANY status or expressing satisfaction:**
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
1. IDENTIFY: What command proves this claim?
|
|
81
|
-
2. RUN: Execute the FULL command (fresh, complete)
|
|
82
|
-
3. READ: Full output, check exit code, count failures
|
|
83
|
-
4. VERIFY: Does output confirm the claim?
|
|
84
|
-
- If NO: State actual status with evidence
|
|
85
|
-
- If YES: State claim WITH evidence
|
|
86
|
-
5. ONLY THEN: Make the claim
|
|
87
|
-
|
|
88
|
-
Skip any step = lying, not verifying
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### B. The Four-Phase Debugging Framework
|
|
92
|
-
|
|
93
|
-
**Complete each phase before proceeding to the next:**
|
|
94
|
-
|
|
95
|
-
| Phase | Key Activities | Success Criteria | Skip = Failure |
|
|
96
|
-
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------- | ------------------------------------------ |
|
|
97
|
-
| **1. Root Cause** | Read errors completely, reproduce consistently, check recent changes, gather evidence at component boundaries, trace data flow | Understand WHAT and WHY | Proposing fixes without investigation |
|
|
98
|
-
| **2. Pattern Analysis** | Find working examples, compare against references, identify differences, understand dependencies | Identify what's different between working and broken | Skimming references, assuming similarities |
|
|
99
|
-
| **3. Hypothesis** | Form single specific hypothesis, test minimally (one variable), verify before continuing | Confirmed hypothesis or new hypothesis formed | Multiple changes at once, vague theories |
|
|
100
|
-
| **4. Implementation** | Create failing test, implement single fix, verify, count attempts | Bug resolved with tests passing | Fixing without test, bundled refactoring |
|
|
101
|
-
|
|
102
|
-
**Special Rule - Phase 4.5:**
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
IF 3+ fixes have failed:
|
|
106
|
-
STOP → Question the architecture
|
|
107
|
-
DON'T attempt Fix #4
|
|
108
|
-
Discuss with human partner
|
|
109
|
-
|
|
110
|
-
This is NOT a failed hypothesis.
|
|
111
|
-
This is a WRONG ARCHITECTURE.
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### C. Defense-in-Depth Layers
|
|
115
|
-
|
|
116
|
-
**When fixing any bug caused by invalid data:**
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
1. Map the data flow - Where does value originate? Where is it used?
|
|
120
|
-
2. Identify all checkpoints - List every point data passes through
|
|
121
|
-
3. Add validation at each layer:
|
|
122
|
-
- Layer 1: Entry Point Validation (API boundary)
|
|
123
|
-
- Layer 2: Business Logic Validation (operation-specific)
|
|
124
|
-
- Layer 3: Environment Guards (context-specific safety)
|
|
125
|
-
- Layer 4: Debug Instrumentation (forensic evidence)
|
|
126
|
-
4. Test each layer independently
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
**Key Insight:** All four layers are necessary. Different code paths bypass different checks.
|
|
130
|
-
|
|
131
|
-
### D. Root Cause Tracing Process
|
|
132
|
-
|
|
133
|
-
**When error appears deep in call stack:**
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
1. Observe the symptom (what failed, where)
|
|
137
|
-
2. Find immediate cause (what code directly triggered it)
|
|
138
|
-
3. Ask: What called this? (trace one level up)
|
|
139
|
-
4. Keep tracing up (find what value was passed)
|
|
140
|
-
5. Find original trigger (where did bad value originate)
|
|
141
|
-
6. Fix at source (NOT at symptom point)
|
|
142
|
-
7. Add defense-in-depth (validate at every layer)
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
**When manual tracing fails:**
|
|
146
|
-
|
|
147
|
-
- Add stack trace instrumentation before problematic operation
|
|
148
|
-
- Use `console.error()` in tests (not logger - may be suppressed)
|
|
149
|
-
- Include context: directory, cwd, environment, timestamps
|
|
150
|
-
- Capture: `new Error().stack` shows complete call chain
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
## IV. Anti-Patterns and Red Flags
|
|
155
|
-
|
|
156
|
-
### A. Verification Red Flags (STOP IMMEDIATELY)
|
|
157
|
-
|
|
158
|
-
**Language that indicates violation:**
|
|
159
|
-
|
|
160
|
-
- Using "should", "probably", "seems to"
|
|
161
|
-
- Expressing satisfaction before verification ("Great!", "Perfect!", "Done!")
|
|
162
|
-
- About to commit/push/PR without verification
|
|
163
|
-
- Trusting agent success reports
|
|
164
|
-
- Relying on partial verification
|
|
165
|
-
- Thinking "just this once"
|
|
166
|
-
- Tired and wanting work over
|
|
167
|
-
- **ANY wording implying success without having run verification**
|
|
168
|
-
|
|
169
|
-
**The rule applies to:**
|
|
170
|
-
|
|
171
|
-
- Exact phrases
|
|
172
|
-
- Paraphrases and synonyms
|
|
173
|
-
- Implications of success
|
|
174
|
-
- ANY communication suggesting completion/correctness
|
|
175
|
-
|
|
176
|
-
### B. Debugging Red Flags (RETURN TO PHASE 1)
|
|
177
|
-
|
|
178
|
-
**If you catch yourself thinking:**
|
|
179
|
-
|
|
180
|
-
- "Quick fix for now, investigate later"
|
|
181
|
-
- "Just try changing X and see if it works"
|
|
182
|
-
- "Add multiple changes, run tests"
|
|
183
|
-
- "Skip the test, I'll manually verify"
|
|
184
|
-
- "It's probably X, let me fix that"
|
|
185
|
-
- "I don't fully understand but this might work"
|
|
186
|
-
- "Pattern says X but I'll adapt it differently"
|
|
187
|
-
- "Here are the main problems: [lists fixes without investigation]"
|
|
188
|
-
- Proposing solutions before tracing data flow
|
|
189
|
-
- **"One more fix attempt" (when already tried 2+)**
|
|
190
|
-
- **Each fix reveals new problem in different place**
|
|
191
|
-
|
|
192
|
-
### C. Human Partner Signals You're Doing It Wrong
|
|
193
|
-
|
|
194
|
-
**Watch for these redirections:**
|
|
195
|
-
|
|
196
|
-
- "Is that not happening?" → You assumed without verifying
|
|
197
|
-
- "Will it show us...?" → You should have added evidence gathering
|
|
198
|
-
- "Stop guessing" → You're proposing fixes without understanding
|
|
199
|
-
- "Ultrathink this" → Question fundamentals, not just symptoms
|
|
200
|
-
- "We're stuck?" (frustrated) → Your approach isn't working
|
|
201
|
-
|
|
202
|
-
**When you see these:** STOP. Return to Phase 1.
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## V. Common Failures Table
|
|
207
|
-
|
|
208
|
-
### A. What Requires What (Verification)
|
|
209
|
-
|
|
210
|
-
| Claim | Requires | Not Sufficient |
|
|
211
|
-
| --------------------- | ------------------------------- | ------------------------------ |
|
|
212
|
-
| Tests pass | Test command output: 0 failures | Previous run, "should pass" |
|
|
213
|
-
| Linter clean | Linter output: 0 errors | Partial check, extrapolation |
|
|
214
|
-
| Build succeeds | Build command: exit 0 | Linter passing, logs look good |
|
|
215
|
-
| Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
|
|
216
|
-
| Regression test works | Red-green cycle verified | Test passes once |
|
|
217
|
-
| Agent completed | VCS diff shows changes | Agent reports "success" |
|
|
218
|
-
| Requirements met | Line-by-line checklist | Tests passing |
|
|
219
|
-
|
|
220
|
-
### B. Common Rationalizations (Debugging)
|
|
221
|
-
|
|
222
|
-
| Excuse | Reality |
|
|
223
|
-
| -------------------------------------------- | ----------------------------------------------------------------------- |
|
|
224
|
-
| "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
|
|
225
|
-
| "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
|
|
226
|
-
| "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
|
|
227
|
-
| "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
|
|
228
|
-
| "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
|
|
229
|
-
| "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. |
|
|
230
|
-
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
|
|
231
|
-
| "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question pattern, don't fix again. |
|
|
232
|
-
|
|
233
|
-
### C. Common Rationalizations (Verification)
|
|
234
|
-
|
|
235
|
-
| Excuse | Reality |
|
|
236
|
-
| --------------------------------------- | ---------------------- |
|
|
237
|
-
| "Should work now" | RUN the verification |
|
|
238
|
-
| "I'm confident" | Confidence ≠ evidence |
|
|
239
|
-
| "Just this once" | No exceptions |
|
|
240
|
-
| "Linter passed" | Linter ≠ compiler |
|
|
241
|
-
| "Agent said success" | Verify independently |
|
|
242
|
-
| "I'm tired" | Exhaustion ≠ excuse |
|
|
243
|
-
| "Partial check is enough" | Partial proves nothing |
|
|
244
|
-
| "Different words so rule doesn't apply" | Spirit over letter |
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## VI. Key Patterns and Templates
|
|
249
|
-
|
|
250
|
-
### A. Verification Patterns
|
|
251
|
-
|
|
252
|
-
**Tests:**
|
|
253
|
-
|
|
254
|
-
```
|
|
255
|
-
✅ [Run test command] [See: 34/34 pass] "All tests pass"
|
|
256
|
-
❌ "Should pass now" / "Looks correct"
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
**Regression tests (TDD Red-Green):**
|
|
260
|
-
|
|
261
|
-
```
|
|
262
|
-
✅ Write → Run (pass) → Revert fix → Run (MUST FAIL) → Restore → Run (pass)
|
|
263
|
-
❌ "I've written a regression test" (without red-green verification)
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
**Build:**
|
|
267
|
-
|
|
268
|
-
```
|
|
269
|
-
✅ [Run build] [See: exit 0] "Build passes"
|
|
270
|
-
❌ "Linter passed" (linter doesn't check compilation)
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**Requirements:**
|
|
274
|
-
|
|
275
|
-
```
|
|
276
|
-
✅ Re-read plan → Create checklist → Verify each → Report gaps or completion
|
|
277
|
-
❌ "Tests pass, phase complete"
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
**Agent delegation:**
|
|
281
|
-
|
|
282
|
-
```
|
|
283
|
-
✅ Agent reports success → Check VCS diff → Verify changes → Report actual state
|
|
284
|
-
❌ Trust agent report
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### B. Multi-Component Evidence Gathering
|
|
288
|
-
|
|
289
|
-
**WHEN system has multiple components (CI → build → signing, API → service → database):**
|
|
290
|
-
|
|
291
|
-
**BEFORE proposing fixes, add diagnostic instrumentation:**
|
|
292
|
-
|
|
293
|
-
```
|
|
294
|
-
For EACH component boundary:
|
|
295
|
-
- Log what data enters component
|
|
296
|
-
- Log what data exits component
|
|
297
|
-
- Verify environment/config propagation
|
|
298
|
-
- Check state at each layer
|
|
299
|
-
|
|
300
|
-
Run once to gather evidence showing WHERE it breaks
|
|
301
|
-
THEN analyze evidence to identify failing component
|
|
302
|
-
THEN investigate that specific component
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
**Example (multi-layer system):**
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
# Layer 1: Workflow
|
|
309
|
-
echo "=== Secrets available in workflow: ==="
|
|
310
|
-
echo "IDENTITY: ${IDENTITY:+SET}${IDENTITY:-UNSET}"
|
|
311
|
-
|
|
312
|
-
# Layer 2: Build script
|
|
313
|
-
echo "=== Env vars in build script: ==="
|
|
314
|
-
env | grep IDENTITY || echo "IDENTITY not in environment"
|
|
315
|
-
|
|
316
|
-
# Layer 3: Signing script
|
|
317
|
-
echo "=== Keychain state: ==="
|
|
318
|
-
security list-keychains
|
|
319
|
-
security find-identity -v
|
|
320
|
-
|
|
321
|
-
# Layer 4: Actual signing
|
|
322
|
-
codesign --sign "$IDENTITY" --verbose=4 "$APP"
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
**This reveals:** Which layer fails (secrets → workflow ✓, workflow → build ✗)
|
|
326
|
-
|
|
327
|
-
### C. Defense-in-Depth Template
|
|
328
|
-
|
|
329
|
-
**Example: Empty projectDir bug prevention**
|
|
330
|
-
|
|
331
|
-
```typescript
|
|
332
|
-
// Layer 1: Entry Point Validation
|
|
333
|
-
function createProject(name: string, workingDirectory: string) {
|
|
334
|
-
if (!workingDirectory || workingDirectory.trim() === "") {
|
|
335
|
-
throw new Error("workingDirectory cannot be empty");
|
|
336
|
-
}
|
|
337
|
-
if (!existsSync(workingDirectory)) {
|
|
338
|
-
throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
|
|
339
|
-
}
|
|
340
|
-
if (!statSync(workingDirectory).isDirectory()) {
|
|
341
|
-
throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
|
|
342
|
-
}
|
|
343
|
-
// ... proceed
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// Layer 2: Business Logic Validation
|
|
347
|
-
function initializeWorkspace(projectDir: string, sessionId: string) {
|
|
348
|
-
if (!projectDir) {
|
|
349
|
-
throw new Error("projectDir required for workspace initialization");
|
|
350
|
-
}
|
|
351
|
-
// ... proceed
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// Layer 3: Environment Guards
|
|
355
|
-
async function gitInit(directory: string) {
|
|
356
|
-
if (process.env.NODE_ENV === "test") {
|
|
357
|
-
const normalized = normalize(resolve(directory));
|
|
358
|
-
const tmpDir = normalize(resolve(tmpdir()));
|
|
359
|
-
if (!normalized.startsWith(tmpDir)) {
|
|
360
|
-
throw new Error(
|
|
361
|
-
`Refusing git init outside temp dir during tests: ${directory}`,
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
// ... proceed
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
// Layer 4: Debug Instrumentation
|
|
369
|
-
async function gitInit(directory: string) {
|
|
370
|
-
const stack = new Error().stack;
|
|
371
|
-
logger.debug("About to git init", {
|
|
372
|
-
directory,
|
|
373
|
-
cwd: process.cwd(),
|
|
374
|
-
stack,
|
|
375
|
-
});
|
|
376
|
-
// ... proceed
|
|
377
|
-
}
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
**Result:** Bug impossible to reproduce. All 1847 tests passed.
|
|
381
|
-
|
|
382
|
-
---
|
|
383
|
-
|
|
384
|
-
## VII. When To Apply (Triggers)
|
|
385
|
-
|
|
386
|
-
### Verification-Before-Completion Triggers
|
|
387
|
-
|
|
388
|
-
**ALWAYS before:**
|
|
389
|
-
|
|
390
|
-
- ANY variation of success/completion claims
|
|
391
|
-
- ANY expression of satisfaction
|
|
392
|
-
- ANY positive statement about work state
|
|
393
|
-
- Committing, PR creation, task completion
|
|
394
|
-
- Moving to next task
|
|
395
|
-
- Delegating to agents
|
|
396
|
-
|
|
397
|
-
### Systematic-Debugging Triggers
|
|
398
|
-
|
|
399
|
-
**Use for ANY technical issue:**
|
|
400
|
-
|
|
401
|
-
- Test failures
|
|
402
|
-
- Bugs in production
|
|
403
|
-
- Unexpected behavior
|
|
404
|
-
- Performance problems
|
|
405
|
-
- Build failures
|
|
406
|
-
- Integration issues
|
|
407
|
-
|
|
408
|
-
**Use ESPECIALLY when:**
|
|
409
|
-
|
|
410
|
-
- Under time pressure (emergencies make guessing tempting)
|
|
411
|
-
- "Just one quick fix" seems obvious
|
|
412
|
-
- You've already tried multiple fixes
|
|
413
|
-
- Previous fix didn't work
|
|
414
|
-
- You don't fully understand the issue
|
|
415
|
-
|
|
416
|
-
**Don't skip when:**
|
|
417
|
-
|
|
418
|
-
- Issue seems simple (simple bugs have root causes too)
|
|
419
|
-
- You're in a hurry (rushing guarantees rework)
|
|
420
|
-
- Manager wants it fixed NOW (systematic is faster than thrashing)
|
|
421
|
-
|
|
422
|
-
### Defense-in-Depth Triggers
|
|
423
|
-
|
|
424
|
-
**When to apply:**
|
|
425
|
-
|
|
426
|
-
- Any bug caused by invalid data
|
|
427
|
-
- After finding root cause (complement to systematic debugging)
|
|
428
|
-
- Before claiming bug is "impossible" to reproduce
|
|
429
|
-
|
|
430
|
-
### Root-Cause-Tracing Triggers
|
|
431
|
-
|
|
432
|
-
**Use when:**
|
|
433
|
-
|
|
434
|
-
- Error happens deep in execution (not at entry point)
|
|
435
|
-
- Stack trace shows long call chain
|
|
436
|
-
- Unclear where invalid data originated
|
|
437
|
-
- Need to find which test/code triggers the problem
|
|
438
|
-
|
|
439
|
-
---
|
|
440
|
-
|
|
441
|
-
## VIII. Key Quotes Worth Preserving
|
|
442
|
-
|
|
443
|
-
### On Verification
|
|
444
|
-
|
|
445
|
-
> "Claiming work is complete without verification is dishonesty, not efficiency."
|
|
446
|
-
|
|
447
|
-
> "Skip any step = lying, not verifying."
|
|
448
|
-
|
|
449
|
-
> "No shortcuts for verification. Run the command. Read the output. THEN claim the result. This is non-negotiable."
|
|
450
|
-
|
|
451
|
-
> "Violating the letter of this rule is violating the spirit of this rule."
|
|
452
|
-
|
|
453
|
-
### On Debugging
|
|
454
|
-
|
|
455
|
-
> "Random fixes waste time and create new bugs. Quick patches mask underlying issues."
|
|
456
|
-
|
|
457
|
-
> "Systematic debugging is FASTER than guess-and-check thrashing."
|
|
458
|
-
|
|
459
|
-
> "Seeing symptoms ≠ understanding root cause."
|
|
460
|
-
|
|
461
|
-
> "3+ failures = architectural problem. Question pattern, don't fix again."
|
|
462
|
-
|
|
463
|
-
> "This is NOT a failed hypothesis. This is a WRONG ARCHITECTURE."
|
|
464
|
-
|
|
465
|
-
### On Defense-in-Depth
|
|
466
|
-
|
|
467
|
-
> "Single validation: 'We fixed the bug'. Multiple layers: 'We made the bug structurally impossible.'"
|
|
468
|
-
|
|
469
|
-
> "All four layers were necessary. During testing, each layer caught bugs the others missed."
|
|
470
|
-
|
|
471
|
-
> "Don't stop at one validation point. Add checks at every layer."
|
|
472
|
-
|
|
473
|
-
### On Root Cause Tracing
|
|
474
|
-
|
|
475
|
-
> "Trace backward through the call chain until you find the original trigger, then fix at the source."
|
|
476
|
-
|
|
477
|
-
> "NEVER fix just where the error appears."
|
|
478
|
-
|
|
479
|
-
> "95% of 'no root cause' cases are incomplete investigation."
|
|
480
|
-
|
|
481
|
-
---
|
|
482
|
-
|
|
483
|
-
## IX. Real-World Impact (Evidence)
|
|
484
|
-
|
|
485
|
-
### From Verification Skills:
|
|
486
|
-
|
|
487
|
-
- "I don't believe you" - trust broken
|
|
488
|
-
- Undefined functions shipped - would crash
|
|
489
|
-
- Missing requirements shipped - incomplete features
|
|
490
|
-
- Time wasted on false completion → redirect → rework
|
|
491
|
-
- Violates: "Honesty is a core value. If you lie, you'll be replaced."
|
|
492
|
-
|
|
493
|
-
### From Systematic Debugging:
|
|
494
|
-
|
|
495
|
-
- Systematic approach: 15-30 minutes to fix
|
|
496
|
-
- Random fixes approach: 2-3 hours of thrashing
|
|
497
|
-
- First-time fix rate: 95% vs 40%
|
|
498
|
-
- New bugs introduced: Near zero vs common
|
|
499
|
-
|
|
500
|
-
### From Root Cause Tracing:
|
|
501
|
-
|
|
502
|
-
- Found root cause through 5-level trace
|
|
503
|
-
- Fixed at source (getter validation)
|
|
504
|
-
- Added 4 layers of defense
|
|
505
|
-
- 1847 tests passed, zero pollution
|
|
506
|
-
|
|
507
|
-
---
|
|
508
|
-
|
|
509
|
-
## X. Integration with Other Skills
|
|
510
|
-
|
|
511
|
-
### Required Sub-Skills
|
|
512
|
-
|
|
513
|
-
**Systematic Debugging requires:**
|
|
514
|
-
|
|
515
|
-
- `root-cause-tracing` - REQUIRED when error is deep in call stack (Phase 1, Step 5)
|
|
516
|
-
- `test-driven-development` - REQUIRED for creating failing test case (Phase 4, Step 1)
|
|
517
|
-
|
|
518
|
-
**Root Cause Tracing complements:**
|
|
519
|
-
|
|
520
|
-
- `defense-in-depth` - Add validation at multiple layers after finding root cause
|
|
521
|
-
|
|
522
|
-
### Complementary Skills
|
|
523
|
-
|
|
524
|
-
**After applying these patterns:**
|
|
525
|
-
|
|
526
|
-
- `defense-in-depth` - Add validation at multiple layers after finding root cause
|
|
527
|
-
- `condition-based-waiting` - Replace arbitrary timeouts identified in Phase 2
|
|
528
|
-
- `verification-before-completion` - Verify fix worked before claiming success
|
|
529
|
-
|
|
530
|
-
---
|
|
531
|
-
|
|
532
|
-
## XI. Architecture Question Criteria
|
|
533
|
-
|
|
534
|
-
**Pattern indicating architectural problem (not bug):**
|
|
535
|
-
|
|
536
|
-
- Each fix reveals new shared state/coupling/problem in different place
|
|
537
|
-
- Fixes require "massive refactoring" to implement
|
|
538
|
-
- Each fix creates new symptoms elsewhere
|
|
539
|
-
- 3+ fixes have failed
|
|
540
|
-
|
|
541
|
-
**When this happens:**
|
|
542
|
-
|
|
543
|
-
1. STOP attempting more fixes
|
|
544
|
-
2. Question fundamentals:
|
|
545
|
-
- Is this pattern fundamentally sound?
|
|
546
|
-
- Are we "sticking with it through sheer inertia"?
|
|
547
|
-
- Should we refactor architecture vs. continue fixing symptoms?
|
|
548
|
-
3. Discuss with human partner before proceeding
|
|
549
|
-
4. This is NOT a failed hypothesis - this is a wrong architecture
|
|
550
|
-
|
|
551
|
-
---
|
|
552
|
-
|
|
553
|
-
## XII. The Bottom Line
|
|
554
|
-
|
|
555
|
-
**No shortcuts for verification.**
|
|
556
|
-
Run the command. Read the output. THEN claim the result.
|
|
557
|
-
This is non-negotiable.
|
|
558
|
-
|
|
559
|
-
**No fixes without understanding.**
|
|
560
|
-
Find the root cause. Test your hypothesis. Fix at the source.
|
|
561
|
-
Add defense at every layer.
|
|
562
|
-
|
|
563
|
-
**Question architecture early.**
|
|
564
|
-
If 3+ fixes failed, it's not the fix - it's the foundation.
|
|
565
|
-
Stop digging. Start designing.
|