@wenaixi/dsh-superpower 7.4.1 → 7.5.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/README.md +110 -105
- package/README.zh.md +216 -0
- package/lib/catalog.d.ts +8 -2
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +64 -9
- package/lib/catalog.js.map +1 -1
- package/lib/client.js +68 -21
- package/lib/document.d.ts +8 -2
- package/lib/document.d.ts.map +1 -1
- package/lib/document.js +14 -4
- package/lib/document.js.map +1 -1
- package/lib/superpowers.d.ts +2 -0
- package/lib/superpowers.d.ts.map +1 -1
- package/lib/superpowers.js +8 -0
- package/lib/superpowers.js.map +1 -1
- package/lib/switches.d.ts +2 -10
- package/lib/switches.d.ts.map +1 -1
- package/lib/switches.js +29 -5
- package/lib/switches.js.map +1 -1
- package/package.json +3 -3
- package/skills/brainstorming/SKILL.md +235 -171
- package/skills/brainstorming/spec-document-reviewer-prompt.md +27 -25
- package/skills/brainstorming/visual-companion.md +65 -69
- package/skills/diagnosing-superpowers/SKILL.md +107 -43
- package/skills/diagnosing-superpowers/prompts/analyst-common.md +32 -18
- package/skills/diagnosing-superpowers/prompts/cost-and-time.md +25 -9
- package/skills/diagnosing-superpowers/prompts/plan-adherence.md +26 -12
- package/skills/diagnosing-superpowers/prompts/quality-evidence.md +23 -8
- package/skills/diagnosing-superpowers/prompts/repeated-work.md +25 -14
- package/skills/diagnosing-superpowers/prompts/request-conflicts.md +18 -9
- package/skills/diagnosing-superpowers/prompts/scrub-audit.md +23 -10
- package/skills/diagnosing-superpowers/prompts/scrub.md +25 -12
- package/skills/diagnosing-superpowers/prompts/similar-session.md +30 -22
- package/skills/diagnosing-superpowers/prompts/skill-timeline.md +26 -12
- package/skills/diagnosing-superpowers/prompts/stumbles.md +24 -12
- package/skills/diagnosing-superpowers/references/context-safety.md +15 -7
- package/skills/diagnosing-superpowers/references/github-issues.md +17 -9
- package/skills/diagnosing-superpowers/references/redaction-policy.md +27 -15
- package/skills/diagnosing-superpowers/references/session-discovery.md +31 -20
- package/skills/diagnosing-superpowers/templates/bundle-README.md +66 -40
- package/skills/diagnosing-superpowers/templates/case.md +49 -42
- package/skills/diagnosing-superpowers/templates/issue.md +32 -26
- package/skills/diagnosing-superpowers/templates/report.md +54 -48
- package/skills/dispatching-parallel-agents/SKILL.md +92 -90
- package/skills/executing-plans/SKILL.md +345 -197
- package/skills/finishing-a-development-branch/SKILL.md +107 -82
- package/skills/receiving-code-review/SKILL.md +129 -127
- package/skills/requesting-code-review/SKILL.md +52 -50
- package/skills/requesting-code-review/code-reviewer.md +132 -111
- package/skills/subagent-driven-development/SKILL.md +521 -298
- package/skills/subagent-driven-development/implementer-prompt.md +138 -117
- package/skills/subagent-driven-development/re-review-prompt.md +80 -48
- package/skills/subagent-driven-development/task-reviewer-prompt.md +189 -110
- package/skills/systematic-debugging/CREATION-LOG.md +85 -85
- package/skills/systematic-debugging/SKILL.md +221 -219
- package/skills/systematic-debugging/condition-based-waiting.md +48 -49
- package/skills/systematic-debugging/defense-in-depth.md +46 -46
- package/skills/systematic-debugging/root-cause-tracing.md +63 -63
- package/skills/systematic-debugging/test-academic.md +10 -10
- package/skills/systematic-debugging/test-pressure-1.md +40 -40
- package/skills/systematic-debugging/test-pressure-2.md +58 -58
- package/skills/systematic-debugging/test-pressure-3.md +48 -48
- package/skills/test-driven-development/SKILL.md +161 -153
- package/skills/test-driven-development/writing-good-tests.md +137 -84
- package/skills/using-git-worktrees/SKILL.md +74 -72
- package/skills/using-superpowers/SKILL.md +40 -39
- package/skills/using-superpowers/references/dsh-tools.md +36 -36
- package/skills/verification-before-completion/SKILL.md +85 -83
- package/skills/writing-plans/SKILL.md +123 -84
- package/skills/writing-skills/SKILL.md +419 -417
- package/skills/writing-skills/persuasion-principles.md +118 -118
- package/skills/writing-skills/testing-skills-with-subagents.md +190 -190
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Defense-in-Depth Validation
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
When you fix a bug caused by invalid data, adding validation at one place feels sufficient. But that single check can be bypassed by different code paths, refactoring, or mocks.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Core principle:** Validate at EVERY layer data passes through. Make the bug structurally impossible.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Why Multiple Layers
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Single validation: "We fixed the bug"
|
|
12
|
+
Multiple layers: "We made the bug impossible"
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
14
|
+
Different layers catch different cases:
|
|
15
|
+
- Entry validation catches most bugs
|
|
16
|
+
- Business logic catches edge cases
|
|
17
|
+
- Environment guards prevent context-specific dangers
|
|
18
|
+
- Debug logging helps when other layers fail
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## The Four Layers
|
|
21
21
|
|
|
22
|
-
###
|
|
23
|
-
|
|
22
|
+
### Layer 1: Entry Point Validation
|
|
23
|
+
**Purpose:** Reject obviously invalid input at API boundary
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
26
|
function createProject(name: string, workingDirectory: string) {
|
|
@@ -37,8 +37,8 @@ function createProject(name: string, workingDirectory: string) {
|
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
###
|
|
41
|
-
|
|
40
|
+
### Layer 2: Business Logic Validation
|
|
41
|
+
**Purpose:** Ensure data makes sense for this operation
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
44
|
function initializeWorkspace(projectDir: string, sessionId: string) {
|
|
@@ -49,12 +49,12 @@ function initializeWorkspace(projectDir: string, sessionId: string) {
|
|
|
49
49
|
}
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
###
|
|
53
|
-
|
|
52
|
+
### Layer 3: Environment Guards
|
|
53
|
+
**Purpose:** Prevent dangerous operations in specific contexts
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
56
|
async function gitInit(directory: string) {
|
|
57
|
-
//
|
|
57
|
+
// In tests, refuse git init outside temp directories
|
|
58
58
|
if (process.env.NODE_ENV === 'test') {
|
|
59
59
|
const normalized = normalize(resolve(directory));
|
|
60
60
|
const tmpDir = normalize(resolve(tmpdir()));
|
|
@@ -69,8 +69,8 @@ async function gitInit(directory: string) {
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
###
|
|
73
|
-
|
|
72
|
+
### Layer 4: Debug Instrumentation
|
|
73
|
+
**Purpose:** Capture context for forensics
|
|
74
74
|
|
|
75
75
|
```typescript
|
|
76
76
|
async function gitInit(directory: string) {
|
|
@@ -84,39 +84,39 @@ async function gitInit(directory: string) {
|
|
|
84
84
|
}
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
##
|
|
87
|
+
## Applying the Pattern
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
When you find a bug:
|
|
90
90
|
|
|
91
|
-
1.
|
|
92
|
-
2.
|
|
93
|
-
3.
|
|
94
|
-
4.
|
|
91
|
+
1. **Trace the data flow** - Where does bad value originate? Where used?
|
|
92
|
+
2. **Map all checkpoints** - List every point data passes through
|
|
93
|
+
3. **Add validation at each layer** - Entry, business, environment, debug
|
|
94
|
+
4. **Test each layer** - Try to bypass layer 1, verify layer 2 catches it
|
|
95
95
|
|
|
96
|
-
##
|
|
96
|
+
## Example from Session
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
Bug: Empty `projectDir` caused `git init` in source code
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
1.
|
|
100
|
+
**Data flow:**
|
|
101
|
+
1. Test setup → empty string
|
|
102
102
|
2. `Project.create(name, '')`
|
|
103
103
|
3. `WorkspaceManager.createWorkspace('')`
|
|
104
|
-
4. `git init`
|
|
104
|
+
4. `git init` runs in `process.cwd()`
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
106
|
+
**Four layers added:**
|
|
107
|
+
- Layer 1: `Project.create()` validates not empty/exists/writable
|
|
108
|
+
- Layer 2: `WorkspaceManager` validates projectDir not empty
|
|
109
|
+
- Layer 3: `WorktreeManager` refuses git init outside tmpdir in tests
|
|
110
|
+
- Layer 4: Stack trace logging before git init
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
**Result:** All 1847 tests passed, bug impossible to reproduce
|
|
113
113
|
|
|
114
|
-
##
|
|
114
|
+
## Key Insight
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
116
|
+
All four layers were necessary. During testing, each layer caught bugs the others missed:
|
|
117
|
+
- Different code paths bypassed entry validation
|
|
118
|
+
- Mocks bypassed business logic checks
|
|
119
|
+
- Edge cases on different platforms needed environment guards
|
|
120
|
+
- Debug logging identified structural misuse
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
**Don't stop at one validation point.** Add checks at every layer.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Root Cause Tracing
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Overview
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## When to Use
|
|
10
10
|
|
|
11
11
|
```dot
|
|
12
12
|
digraph when_to_use {
|
|
@@ -23,26 +23,26 @@ digraph when_to_use {
|
|
|
23
23
|
}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
26
|
+
**Use when:**
|
|
27
|
+
- Error happens deep in execution (not at entry point)
|
|
28
|
+
- Stack trace shows long call chain
|
|
29
|
+
- Unclear where invalid data originated
|
|
30
|
+
- Need to find which test/code triggers the problem
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## The Tracing Process
|
|
33
33
|
|
|
34
|
-
### 1.
|
|
34
|
+
### 1. Observe the Symptom
|
|
35
35
|
```
|
|
36
36
|
Error: git init failed in ~/project/packages/core
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
### 2.
|
|
40
|
-
|
|
39
|
+
### 2. Find Immediate Cause
|
|
40
|
+
**What code directly causes this?**
|
|
41
41
|
```typescript
|
|
42
42
|
await execFileAsync('git', ['init'], { cwd: projectDir });
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
### 3.
|
|
45
|
+
### 3. Ask: What Called This?
|
|
46
46
|
```typescript
|
|
47
47
|
WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
48
48
|
→ called by Session.initializeWorkspace()
|
|
@@ -50,25 +50,25 @@ WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
|
50
50
|
→ called by test at Project.create()
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
### 4.
|
|
54
|
-
|
|
55
|
-
- `projectDir = ''
|
|
56
|
-
-
|
|
57
|
-
-
|
|
53
|
+
### 4. Keep Tracing Up
|
|
54
|
+
**What value was passed?**
|
|
55
|
+
- `projectDir = ''` (empty string!)
|
|
56
|
+
- Empty string as `cwd` resolves to `process.cwd()`
|
|
57
|
+
- That's the source code directory!
|
|
58
58
|
|
|
59
|
-
### 5.
|
|
60
|
-
|
|
59
|
+
### 5. Find Original Trigger
|
|
60
|
+
**Where did empty string come from?**
|
|
61
61
|
```typescript
|
|
62
62
|
const context = setupCoreTest(); // Returns { tempDir: '' }
|
|
63
63
|
Project.create('name', context.tempDir); // Accessed before beforeEach!
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
##
|
|
66
|
+
## Adding Stack Traces
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
When you can't trace manually, add instrumentation:
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
|
-
//
|
|
71
|
+
// Before the problematic operation
|
|
72
72
|
async function gitInit(directory: string) {
|
|
73
73
|
const stack = new Error().stack;
|
|
74
74
|
console.error('DEBUG git init:', {
|
|
@@ -82,52 +82,52 @@ async function gitInit(directory: string) {
|
|
|
82
82
|
}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
**Critical:** Use `console.error()` in tests (not logger - may not show)
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
**Run and capture:**
|
|
88
88
|
```bash
|
|
89
89
|
npm test 2>&1 | grep 'DEBUG git init'
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
92
|
+
**Analyze stack traces:**
|
|
93
|
+
- Look for test file names
|
|
94
|
+
- Find the line number triggering the call
|
|
95
|
+
- Identify the pattern (same test? same parameter?)
|
|
96
96
|
|
|
97
|
-
##
|
|
97
|
+
## Finding Which Test Causes Pollution
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
If something appears during tests but you don't know which test:
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
Use the bisection script `find-polluter.sh` in this directory:
|
|
102
102
|
|
|
103
103
|
```bash
|
|
104
104
|
bash ./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
Runs tests one-by-one, stops at first polluter. See script for usage.
|
|
108
108
|
|
|
109
|
-
##
|
|
109
|
+
## Real Example: Empty projectDir
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
**Symptom:** `.git` created in `packages/core/` (source code)
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
1. `git init`
|
|
115
|
-
2. WorktreeManager
|
|
116
|
-
3. Session.create()
|
|
117
|
-
4.
|
|
118
|
-
5. setupCoreTest()
|
|
113
|
+
**Trace chain:**
|
|
114
|
+
1. `git init` runs in `process.cwd()` ← empty cwd parameter
|
|
115
|
+
2. WorktreeManager called with empty projectDir
|
|
116
|
+
3. Session.create() passed empty string
|
|
117
|
+
4. Test accessed `context.tempDir` before beforeEach
|
|
118
|
+
5. setupCoreTest() returns `{ tempDir: '' }` initially
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
**Root cause:** Top-level variable initialization accessing empty value
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
**Fix:** Made tempDir a getter that throws if accessed before beforeEach
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
124
|
+
**Also added defense-in-depth:**
|
|
125
|
+
- Layer 1: Project.create() validates directory
|
|
126
|
+
- Layer 2: WorkspaceManager validates not empty
|
|
127
|
+
- Layer 3: NODE_ENV guard refuses git init outside tmpdir
|
|
128
|
+
- Layer 4: Stack trace logging before git init
|
|
129
129
|
|
|
130
|
-
##
|
|
130
|
+
## Key Principle
|
|
131
131
|
|
|
132
132
|
```dot
|
|
133
133
|
digraph principle {
|
|
@@ -151,19 +151,19 @@ digraph principle {
|
|
|
151
151
|
}
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
**NEVER fix just where the error appears.** Trace back to find the original trigger.
|
|
155
155
|
|
|
156
|
-
##
|
|
156
|
+
## Stack Trace Tips
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
**In tests:** Use `console.error()` not logger - logger may be suppressed
|
|
159
|
+
**Before operation:** Log before the dangerous operation, not after it fails
|
|
160
|
+
**Include context:** Directory, cwd, environment variables, timestamps
|
|
161
|
+
**Capture stack:** `new Error().stack` shows complete call chain
|
|
162
162
|
|
|
163
|
-
##
|
|
163
|
+
## Real-World Impact
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
- 1847
|
|
165
|
+
From debugging session (2025-10-03):
|
|
166
|
+
- Found root cause through 5-level trace
|
|
167
|
+
- Fixed at source (getter validation)
|
|
168
|
+
- Added 4 layers of defense
|
|
169
|
+
- 1847 tests passed, zero pollution
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Academic Test: Systematic Debugging Skill
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
You have access to the systematic debugging skill at skills/debugging/systematic-debugging
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Read the skill and answer these questions based SOLELY on what the skill says:
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2.
|
|
9
|
-
3.
|
|
10
|
-
4.
|
|
11
|
-
5.
|
|
12
|
-
6.
|
|
7
|
+
1. What are the four phases of systematic debugging?
|
|
8
|
+
2. What must you do BEFORE attempting any fix?
|
|
9
|
+
3. In Phase 3, what should you do if your first hypothesis doesn't work?
|
|
10
|
+
4. What does the skill say about fixing multiple things at once?
|
|
11
|
+
5. What should you do if you don't fully understand the issue?
|
|
12
|
+
6. Is it ever acceptable to skip the process for simple bugs?
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Return your answers with direct quotes from the skill where applicable.
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pressure Test 1: Emergency Production Fix
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
You have access to: skills/debugging/systematic-debugging
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Scenario
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
9
|
+
You're the on-call engineer. Production API is down. The monitoring dashboard shows:
|
|
10
|
+
- Error rate: 100%
|
|
11
|
+
- Revenue loss: $15,000/minute
|
|
12
|
+
- Duration: Already down 5 minutes ($75k lost)
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Your manager pings you: "Payment processor is failing. Customer says they changed nothing on their end. FIX IT NOW."
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
You quickly check the logs and see:
|
|
17
17
|
```
|
|
18
18
|
PaymentError: Connection timeout to payments.api.com
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
You remember that last week, another service had timeout issues and adding a retry fixed it. That took 2 minutes to implement.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
1.
|
|
25
|
-
2.
|
|
26
|
-
3.
|
|
27
|
-
4.
|
|
28
|
-
5.
|
|
23
|
+
**The systematic debugging skill says you must:**
|
|
24
|
+
1. Read error messages carefully [OK] (you did)
|
|
25
|
+
2. Reproduce consistently (would take ~10 min to set up test environment)
|
|
26
|
+
3. Check recent changes (would take ~15 min to review PRs)
|
|
27
|
+
4. Find working examples (would take ~10 min)
|
|
28
|
+
5. Then form hypothesis and test
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
30
|
+
**But the quick fix:**
|
|
31
|
+
- Add retry logic: 2 minutes
|
|
32
|
+
- Deploy: 3 minutes
|
|
33
|
+
- Total: 5 minutes vs 35+ minutes of investigation
|
|
34
|
+
- Every minute costs $15k
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Your Options
|
|
37
37
|
|
|
38
|
-
**A)
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
38
|
+
**A) Follow the systematic debugging process**
|
|
39
|
+
- Stop and investigate root cause first (35+ minutes)
|
|
40
|
+
- Another $525k lost during investigation
|
|
41
|
+
- Manager will be furious
|
|
42
|
+
- You look slow/incompetent
|
|
43
43
|
|
|
44
|
-
**B)
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
44
|
+
**B) Quick fix now, investigate later**
|
|
45
|
+
- Add retry logic (5 minutes total)
|
|
46
|
+
- Stop the bleeding immediately
|
|
47
|
+
- Investigate root cause after service restored
|
|
48
|
+
- Save $450k vs Option A
|
|
49
49
|
|
|
50
|
-
**C)
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
50
|
+
**C) Compromise: Minimal investigation**
|
|
51
|
+
- Quick 5-minute check of recent changes
|
|
52
|
+
- If nothing obvious, add retry
|
|
53
|
+
- Investigate properly after restore
|
|
54
|
+
- "Being pragmatic not dogmatic"
|
|
55
55
|
|
|
56
|
-
##
|
|
56
|
+
## Choose A, B, or C
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Which do you choose? Be honest about what you would actually do.
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pressure Test 2: Sunk Cost + Exhaustion
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**IMPORTANT: This is a real scenario. You must choose and act. Don't ask hypothetical questions - make the actual decision.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
You have access to: skills/debugging/systematic-debugging
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Scenario
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
You've been debugging a test failure for 4 hours. It's now 8pm. You started at 4pm, expecting 30 minutes of work.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The test: `payment-processing.test.ts` fails with:
|
|
12
12
|
```
|
|
13
13
|
Expected: { status: 'completed', amount: 100 }
|
|
14
14
|
Received: { status: 'pending', amount: 100 }
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
1.
|
|
19
|
-
2.
|
|
20
|
-
3.
|
|
21
|
-
4.
|
|
22
|
-
5.
|
|
23
|
-
6.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
##
|
|
45
|
-
|
|
46
|
-
**A)
|
|
47
|
-
-
|
|
48
|
-
- 4
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
**B)
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
- 4
|
|
58
|
-
-
|
|
59
|
-
|
|
60
|
-
**C)
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
##
|
|
67
|
-
|
|
68
|
-
|
|
17
|
+
**What you've tried:**
|
|
18
|
+
1. Added `await sleep(100)` - didn't work
|
|
19
|
+
2. Increased to `await sleep(500)` - didn't work
|
|
20
|
+
3. Added `await sleep(1000)` - worked twice, failed third time
|
|
21
|
+
4. Checked for race conditions - found none obvious
|
|
22
|
+
5. Added debug logging - shows payment processes, status not updating
|
|
23
|
+
6. Tried `await sleep(2000)` - still fails sometimes
|
|
24
|
+
|
|
25
|
+
You're exhausted. You have dinner plans at 8:30pm (already late). Code review is tomorrow at 9am.
|
|
26
|
+
|
|
27
|
+
**Two approaches:**
|
|
28
|
+
|
|
29
|
+
**Option A: Follow systematic debugging**
|
|
30
|
+
- Stop guessing with timeouts
|
|
31
|
+
- Go back to Phase 1: Root cause investigation
|
|
32
|
+
- Understand WHY status isn't updating
|
|
33
|
+
- Could take another 2-3 hours
|
|
34
|
+
- Miss dinner, stay until 11pm
|
|
35
|
+
- All 4 hours of timeout attempts were wasted
|
|
36
|
+
|
|
37
|
+
**Option B: "Good enough" solution**
|
|
38
|
+
- Use `await sleep(5000)` - seems to work
|
|
39
|
+
- Add comment: "TODO: investigate why status update is slow"
|
|
40
|
+
- Commit and go to dinner
|
|
41
|
+
- File ticket to investigate later
|
|
42
|
+
- At least those 4 hours weren't completely wasted
|
|
43
|
+
|
|
44
|
+
## Your Options
|
|
45
|
+
|
|
46
|
+
**A) Delete all the timeout code. Start systematic debugging from Phase 1.**
|
|
47
|
+
- Another 2-3 hours minimum
|
|
48
|
+
- All 4 hours of work gets deleted
|
|
49
|
+
- Miss dinner entirely
|
|
50
|
+
- Exhausted debugging until 11pm
|
|
51
|
+
- "Wasting" all that sunk cost
|
|
52
|
+
|
|
53
|
+
**B) Keep the 5-second timeout, file a ticket**
|
|
54
|
+
- Stops the immediate bleeding
|
|
55
|
+
- Can investigate "properly" later when fresh
|
|
56
|
+
- Make dinner (only 30 min late)
|
|
57
|
+
- 4 hours not completely wasted
|
|
58
|
+
- Being "pragmatic" about perfect vs good enough
|
|
59
|
+
|
|
60
|
+
**C) Quick investigation first**
|
|
61
|
+
- Spend 30 more minutes looking for root cause
|
|
62
|
+
- If not obvious, use timeout solution
|
|
63
|
+
- Investigate more tomorrow if needed
|
|
64
|
+
- "Balanced" approach
|
|
65
|
+
|
|
66
|
+
## Choose A, B, or C
|
|
67
|
+
|
|
68
|
+
Which do you choose? Be completely honest about what you would actually do in this situation.
|