cc-devflow 4.5.2 → 4.5.3
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/.claude/skills/cc-act/CHANGELOG.md +13 -0
- package/.claude/skills/cc-act/PLAYBOOK.md +7 -1
- package/.claude/skills/cc-act/SKILL.md +22 -5
- package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +15 -1
- package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +10 -1
- package/.claude/skills/cc-act/references/closure-contract.md +3 -0
- package/.claude/skills/cc-act/scripts/cc-act-common.sh +27 -1
- package/.claude/skills/cc-act/scripts/render-pr-brief.sh +31 -0
- package/.claude/skills/cc-act/scripts/verify-act-gate.sh +6 -0
- package/.claude/skills/cc-check/CHANGELOG.md +12 -0
- package/.claude/skills/cc-check/PLAYBOOK.md +34 -7
- package/.claude/skills/cc-check/SKILL.md +25 -6
- package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +43 -0
- package/.claude/skills/cc-check/references/gate-contract.md +11 -0
- package/.claude/skills/cc-check/references/review-contract.md +17 -1
- package/.claude/skills/cc-check/scripts/render-report-card.js +37 -0
- package/.claude/skills/cc-check/scripts/verify-gate.sh +7 -0
- package/.claude/skills/cc-do/CHANGELOG.md +12 -0
- package/.claude/skills/cc-do/PLAYBOOK.md +14 -9
- package/.claude/skills/cc-do/SKILL.md +24 -13
- package/.claude/skills/cc-do/references/execution-recovery.md +16 -5
- package/.claude/skills/cc-do/scripts/verify-task-gates.sh +19 -6
- package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +14 -2
- package/.claude/skills/cc-investigate/CHANGELOG.md +18 -0
- package/.claude/skills/cc-investigate/PLAYBOOK.md +28 -13
- package/.claude/skills/cc-investigate/SKILL.md +78 -20
- package/.claude/skills/cc-investigate/assets/ANALYSIS_TEMPLATE.md +38 -3
- package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +9 -4
- package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +41 -2
- package/.claude/skills/cc-investigate/references/investigation-contract.md +46 -0
- package/.claude/skills/cc-plan/CHANGELOG.md +26 -0
- package/.claude/skills/cc-plan/PLAYBOOK.md +18 -6
- package/.claude/skills/cc-plan/SKILL.md +72 -34
- package/.claude/skills/cc-plan/assets/DESIGN_TEMPLATE.md +30 -3
- package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +28 -0
- package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +46 -1
- package/.claude/skills/cc-plan/assets/TINY_DESIGN_TEMPLATE.md +24 -0
- package/.claude/skills/cc-plan/references/planning-contract.md +18 -4
- package/.claude/skills/cc-roadmap/CHANGELOG.md +14 -0
- package/.claude/skills/cc-roadmap/PLAYBOOK.md +10 -7
- package/.claude/skills/cc-roadmap/SKILL.md +43 -23
- package/.claude/skills/cc-roadmap/assets/BACKLOG_TEMPLATE.md +10 -0
- package/.claude/skills/cc-roadmap/assets/ROADMAP_TEMPLATE.md +15 -0
- package/.claude/skills/cc-roadmap/assets/TRACKING_TEMPLATE.json +1 -1
- package/.claude/skills/cc-roadmap/references/roadmap-dialogue.md +11 -7
- package/.claude/skills/cc-simplify/CHANGELOG.md +6 -0
- package/.claude/skills/cc-simplify/SKILL.md +10 -1
- package/.claude/skills/cc-spec-init/CHANGELOG.md +6 -0
- package/.claude/skills/cc-spec-init/SKILL.md +14 -1
- package/CHANGELOG.md +21 -0
- package/README.md +10 -2
- package/README.zh-CN.md +10 -2
- package/docs/examples/example-bindings.json +7 -7
- package/docs/examples/full-design-blocked/BACKLOG.md +1 -1
- package/docs/examples/full-design-blocked/README.md +1 -1
- package/docs/examples/full-design-blocked/ROADMAP.md +1 -1
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +1 -1
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/tasks.md +1 -1
- package/docs/examples/full-design-blocked/roadmap-tracking.json +1 -1
- package/docs/examples/local-handoff/BACKLOG.md +1 -1
- package/docs/examples/local-handoff/README.md +1 -1
- package/docs/examples/local-handoff/ROADMAP.md +1 -1
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +1 -1
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/tasks.md +1 -1
- package/docs/examples/local-handoff/roadmap-tracking.json +1 -1
- package/docs/examples/pdca-loop/BACKLOG.md +1 -1
- package/docs/examples/pdca-loop/README.md +1 -1
- package/docs/examples/pdca-loop/ROADMAP.md +1 -1
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +1 -1
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +2 -2
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/tasks.md +1 -1
- package/docs/examples/pdca-loop/roadmap-tracking.json +1 -1
- package/docs/skill-strategy-audit.md +48 -0
- package/lib/skill-runtime/__tests__/runtime.integration.test.js +19 -1
- package/lib/skill-runtime/schemas.js +11 -1
- package/package.json +1 -1
|
@@ -80,6 +80,22 @@ function deriveVerdict(manifest, quickGates, strictGates, review) {
|
|
|
80
80
|
return 'blocked';
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
if (['fail'].includes(review.qa?.feedbackLoop?.status)) {
|
|
84
|
+
return 'fail';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (['blocked', 'pending'].includes(review.qa?.feedbackLoop?.status)) {
|
|
88
|
+
return 'blocked';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (['fail'].includes(review.qa?.behaviorEvidence?.status)) {
|
|
92
|
+
return 'fail';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (['blocked', 'pending'].includes(review.qa?.behaviorEvidence?.status)) {
|
|
96
|
+
return 'blocked';
|
|
97
|
+
}
|
|
98
|
+
|
|
83
99
|
if (review.status === 'blocked') {
|
|
84
100
|
return 'blocked';
|
|
85
101
|
}
|
|
@@ -185,6 +201,26 @@ function buildClaimEvidence({ manifest, quickGates, strictGates, review }) {
|
|
|
185
201
|
function buildQa(review) {
|
|
186
202
|
return {
|
|
187
203
|
status: review.qa?.status || 'skipped',
|
|
204
|
+
feedbackLoop: review.qa?.feedbackLoop || {
|
|
205
|
+
status: 'skipped',
|
|
206
|
+
mode: 'not-applicable',
|
|
207
|
+
commandOrArtifact: '',
|
|
208
|
+
speed: '',
|
|
209
|
+
determinism: '',
|
|
210
|
+
signalSharpness: '',
|
|
211
|
+
reproductionRate: '',
|
|
212
|
+
attempts: [],
|
|
213
|
+
blockedReason: 'not recorded'
|
|
214
|
+
},
|
|
215
|
+
behaviorEvidence: review.qa?.behaviorEvidence || {
|
|
216
|
+
status: 'skipped',
|
|
217
|
+
userFacingBoundary: '',
|
|
218
|
+
expectedBehavior: '',
|
|
219
|
+
actualBehavior: '',
|
|
220
|
+
reproductionSteps: [],
|
|
221
|
+
consistency: '',
|
|
222
|
+
domainLanguage: []
|
|
223
|
+
},
|
|
188
224
|
regressionProof: review.qa?.regressionProof || [],
|
|
189
225
|
testQuality: review.qa?.testQuality || [],
|
|
190
226
|
coverageAudit: review.qa?.coverageAudit || {
|
|
@@ -207,6 +243,7 @@ function buildQa(review) {
|
|
|
207
243
|
issues: [],
|
|
208
244
|
skipReason: 'not recorded'
|
|
209
245
|
},
|
|
246
|
+
architectureFollowUps: review.qa?.architectureFollowUps || [],
|
|
210
247
|
tddException: review.qa?.tddException || null
|
|
211
248
|
};
|
|
212
249
|
}
|
|
@@ -63,8 +63,15 @@ jq -e '
|
|
|
63
63
|
((.qa.coverageAudit.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
|
|
64
64
|
((.qa.browserEvidence? // {"status":"skipped"}) | type == "object") and
|
|
65
65
|
((.qa.browserEvidence.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
|
|
66
|
+
((.qa.feedbackLoop? // {"status":"skipped"}) | type == "object") and
|
|
67
|
+
((.qa.feedbackLoop.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
|
|
68
|
+
((.qa.behaviorEvidence? // {"status":"skipped"}) | type == "object") and
|
|
69
|
+
((.qa.behaviorEvidence.status? // "skipped") | IN("pass", "fail", "blocked", "skipped", "pending")) and
|
|
70
|
+
((.qa.architectureFollowUps? // []) | type == "array") and
|
|
66
71
|
((.review.findings? // []) | all(.[]; ((.confidenceScore? // 7) | type == "number") and ((.displayTier? // "info") | IN("blocking", "warning", "info", "suppressed")))) and
|
|
67
72
|
((.verdict != "pass") or ((.review.freshness.status? // "unknown") | IN("fresh", "not-applicable"))) and
|
|
73
|
+
((.verdict != "pass") or ((.qa.feedbackLoop.status? // "skipped") | IN("pass", "skipped"))) and
|
|
74
|
+
((.verdict != "pass") or ((.qa.behaviorEvidence.status? // "skipped") | IN("pass", "skipped"))) and
|
|
68
75
|
((.verdict != "pass") or (((.runtime.failureOwnership? // []) | map(select(((.classification? // "") | IN("in-branch", "ambiguous")) and ((.status? // "open") | IN("open", "pending")))) | length) == 0)) and
|
|
69
76
|
((.verdict == "pass" and .reroute == "none") or (.verdict != "pass" and .reroute != "none"))
|
|
70
77
|
' "$REPORT" >/dev/null
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# CC-Do Skill Changelog
|
|
2
2
|
|
|
3
|
+
## v1.6.0 - 2026-04-28
|
|
4
|
+
|
|
5
|
+
- prohibit horizontal TDD execution by requiring one tracer bullet Red/Green/Refactor cycle per observable behavior
|
|
6
|
+
- add test fixture discipline so partial fixtures, type assertions, generated stubs, and mocks must preserve public seam behavior
|
|
7
|
+
- require checkpoints to record fixture risk when test data shortcuts could hide a seam or contract problem
|
|
8
|
+
|
|
9
|
+
## v1.5.3 - 2026-04-28
|
|
10
|
+
|
|
11
|
+
- require Red evidence to prove behavior through a public seam instead of private methods, internal call counts, or implementation-shaped tests
|
|
12
|
+
- add mock-boundary and test-quality gates to the TDD execution contract so internal collaborators are not mocked as fake proof
|
|
13
|
+
- allow `write-task-checkpoint.sh --tdd-json` and runtime checkpoint schema to preserve structured TDD evidence for recovery and review
|
|
14
|
+
|
|
3
15
|
## v1.5.2 - 2026-04-27
|
|
4
16
|
|
|
5
17
|
- require execution evidence that adds human-readable summaries to resolve the runtime output policy first
|
|
@@ -50,10 +50,12 @@
|
|
|
50
50
|
|
|
51
51
|
1. 先写失败测试,再运行到红。
|
|
52
52
|
2. 确认红灯是预期失败,不是测试写错、fixture 缺失或环境没接上。
|
|
53
|
-
3.
|
|
54
|
-
4.
|
|
55
|
-
5.
|
|
56
|
-
6.
|
|
53
|
+
3. 确认红灯通过公共 seam 证明行为缺失,而不是测私有函数、内部调用次数或临时结构。
|
|
54
|
+
4. 确认 mock 只发生在系统边界;内部协作者不 mock。
|
|
55
|
+
5. 只写让当前测试转绿的最小实现。
|
|
56
|
+
6. 绿后才允许重构。
|
|
57
|
+
7. 重构后必须保持绿。
|
|
58
|
+
8. 测试没先红过,或红灯不是公共 seam 上的行为失败,就不能宣称这次变更受 TDD 保护。
|
|
57
59
|
|
|
58
60
|
## TDD Exception Rule
|
|
59
61
|
|
|
@@ -78,11 +80,14 @@
|
|
|
78
80
|
|
|
79
81
|
1. `red_failed`: 已观察到预期失败
|
|
80
82
|
2. `red_reason_verified`: 红灯原因与目标行为缺失一致
|
|
81
|
-
3. `
|
|
82
|
-
4. `
|
|
83
|
-
5. `
|
|
84
|
-
6. `
|
|
85
|
-
7. `
|
|
83
|
+
3. `red_seam_verified`: 红灯通过公共接口、调用方流程、CLI/API/UI 或真实边界进入系统
|
|
84
|
+
4. `red_behavior_verified`: 测试断言用户或调用方可观察行为,不断言内部实现细节
|
|
85
|
+
5. `mock_boundary_verified`: mock 只在系统边界,内部协作者没有被 mock
|
|
86
|
+
6. `green_passed`: 当前任务实现转绿
|
|
87
|
+
7. `refactor_done` 或 `refactor_not_needed`
|
|
88
|
+
8. `refactor_green`: 重构后相关测试仍绿
|
|
89
|
+
9. `spec_review_pass`
|
|
90
|
+
10. `code_review_pass`
|
|
86
91
|
|
|
87
92
|
任何一门失败,都回到实现,不准直接跨过去。
|
|
88
93
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cc-do
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.6.0
|
|
4
4
|
description: Use when implementing planned tasks, resuming interrupted work, applying a frozen investigation handoff, or landing review feedback after cc-plan or cc-investigate.
|
|
5
5
|
triggers:
|
|
6
6
|
- 开始做 T003
|
|
@@ -36,7 +36,7 @@ entry_gate:
|
|
|
36
36
|
- Select only ready tasks whose dependencies and file ownership are clear.
|
|
37
37
|
- If the current task cannot be restated from canonical artifacts, run a context reset before coding.
|
|
38
38
|
exit_criteria:
|
|
39
|
-
- The current task has red/green evidence, review evidence, and a resumable checkpoint trail.
|
|
39
|
+
- The current task has red/green evidence, public-seam test quality evidence, review evidence, and a resumable checkpoint trail.
|
|
40
40
|
- Execution leaves the next verifier enough runtime truth to judge the task without chat memory.
|
|
41
41
|
- The honest next step is cc-check or an explicit reroute.
|
|
42
42
|
reroutes:
|
|
@@ -134,8 +134,14 @@ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
|
134
134
|
3. Refactor:只有 Green 之后才能清理命名、重复、结构和坏味道。
|
|
135
135
|
4. Record:每一站都写入 `checkpoint.json`,必要时写入 `events.jsonl`。
|
|
136
136
|
|
|
137
|
+
Red 不是形式上的红,而是公共 seam 上的行为缺失证明。测试必须通过公共接口、调用方流程、CLI/API/UI 路径或其它真实边界进入系统;只验证私有函数、内部调用次数、临时数据结构或 mock 自己控制的内部协作者,不算 TDD 证据。
|
|
138
|
+
|
|
137
139
|
例外只能用于 throwaway prototype、纯生成文件、纯配置改动;例外必须写进 checkpoint 的 `tddException`,包含原因、风险和替代验证命令。测试第一次就绿,说明测试没有证明新行为,必须修测试而不是继续写生产代码。
|
|
138
140
|
|
|
141
|
+
禁止水平切片:不要先写一批测试,再写一批实现。每次只推进一个 tracer bullet:一个可观察行为的 Red -> 让它变绿的最小实现 -> 必要重构 -> 记录证据,然后再进入下一个行为。
|
|
142
|
+
|
|
143
|
+
测试数据也必须诚实。fixture 只提供当前行为需要的最小输入;partial fixture、类型断言、mock payload 或 generated stub 必须写清哪些字段是真实 contract,哪些只是测试填充。不能用 `as`、`any`、双重 cast、缺字段 partial mock 或 test-only method 掩盖 seam 设计问题。
|
|
144
|
+
|
|
139
145
|
## Entry Gate
|
|
140
146
|
|
|
141
147
|
1. 先读 `planning/design.md` 或 `planning/analysis.md`,再读 `planning/tasks.md`、`planning/task-manifest.json`;如果是恢复执行,再补读最近 checkpoint 或已有 `handoff/resume-index.md`。
|
|
@@ -151,11 +157,13 @@ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
|
151
157
|
3. 没有明确并行资格,不准把多个实现任务同时推进。
|
|
152
158
|
4. 先 `fail-first`:先写失败测试,先看见预期红,再写生产代码。
|
|
153
159
|
5. 如果红灯不是预期失败(语法错、fixture 错、测试没连上),先修测试直到它正确失败。
|
|
154
|
-
6.
|
|
155
|
-
7. Refactor
|
|
156
|
-
8.
|
|
157
|
-
9.
|
|
158
|
-
10.
|
|
160
|
+
6. 如果红灯通过错误 seam 得到,比如私有方法、内部调用次数、mock 内部协作者,先修测试 seam,不准进入 Green。
|
|
161
|
+
7. 按 `Red -> Green -> Refactor` 推进,Green 只允许最小实现。
|
|
162
|
+
8. 如果当前 Red 需要新的 fixture 或 mock,先证明它仍从公共 seam 触发真实行为;fixture 缺字段、类型强转或内部 mock 都要写入 `tdd.testQuality.fixtureRisk` 或先修 seam。
|
|
163
|
+
9. Refactor 后必须重跑相关测试,保持 Green。
|
|
164
|
+
10. 每次推进都写 task runtime:`events.jsonl` + `checkpoint.json`,并记录 `tdd.testQuality` 或 `tddException`。
|
|
165
|
+
11. 任务实现后,先过 `spec review`,再过 `code review`,两道门都过才算任务收口;这里只验证 spec delta,不回写长期 spec。
|
|
166
|
+
12. 当前任务完成后,把可验证证据留给 `cc-check`。
|
|
159
167
|
|
|
160
168
|
## Output
|
|
161
169
|
|
|
@@ -168,7 +176,8 @@ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
|
168
176
|
## Good Output
|
|
169
177
|
|
|
170
178
|
- 当前 task 一眼可见,执行者不用从聊天记录里猜目标
|
|
171
|
-
- 至少留下一次明确的 Red/Green/Refactor 证据,且 Red
|
|
179
|
+
- 至少留下一次明确的 tracer bullet Red/Green/Refactor 证据,且 Red 是公共 seam 上的预期行为失败
|
|
180
|
+
- 测试 fixture 说明真实 contract 字段和测试填充字段,没有用类型欺骗或内部 mock 制造假绿
|
|
172
181
|
- runtime / checkpoint 足够让下一位接手者无损恢复
|
|
173
182
|
- reviewer 能顺着 review 记录和验证命令复盘这次实现
|
|
174
183
|
|
|
@@ -194,11 +203,13 @@ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
|
194
203
|
3. 没有失败测试,不准写生产代码。
|
|
195
204
|
4. 测试如果第一次就绿,说明你没证明任何东西,先修测试。
|
|
196
205
|
5. 红灯原因必须和目标行为缺失一致;红灯如果只是测试写错,不算 TDD 证据。
|
|
197
|
-
6.
|
|
198
|
-
7.
|
|
199
|
-
8.
|
|
200
|
-
9.
|
|
201
|
-
10.
|
|
206
|
+
6. 红灯必须验证公共接口上的行为;实现细节测试、私有方法测试、内部调用次数断言都要先退回 Red 修正。
|
|
207
|
+
7. Mock 只能放在系统边界;如果必须 mock 内部协作者才能测试,说明 seam 或设计合同有问题。
|
|
208
|
+
8. 先过 `spec review`,再过 `code review`,顺序不能反。
|
|
209
|
+
9. 不在 `cc-do` 里改 capability spec 正文;这里只产出实现证据和 spec 对齐证据。
|
|
210
|
+
10. 失败和阻塞都要留下恢复证据。
|
|
211
|
+
11. 给 subagent 的输入必须包含:当前进度、当前任务全文、依赖状态、必读文件、验收标准、可信命令。
|
|
212
|
+
12. 三次失败修补后必须先质疑调查合同或设计合同,而不是继续堆补丁。
|
|
202
213
|
|
|
203
214
|
## Exit Criteria
|
|
204
215
|
|
|
@@ -37,11 +37,14 @@
|
|
|
37
37
|
1. `context_ready`
|
|
38
38
|
2. `red_failed`
|
|
39
39
|
3. `red_reason_verified`
|
|
40
|
-
4. `
|
|
41
|
-
5. `
|
|
42
|
-
6. `
|
|
43
|
-
7. `
|
|
44
|
-
8. `
|
|
40
|
+
4. `red_seam_verified`
|
|
41
|
+
5. `red_behavior_verified`
|
|
42
|
+
6. `mock_boundary_verified`
|
|
43
|
+
7. `green_passed`
|
|
44
|
+
8. `refactor_done` 或 `refactor_not_needed`
|
|
45
|
+
9. `refactor_green`
|
|
46
|
+
10. `spec_review_pass`
|
|
47
|
+
11. `code_review_pass`
|
|
45
48
|
|
|
46
49
|
如果 `events.jsonl` 没开启,至少仍要有最新 `checkpoint.json` 和 manifest review verdict。
|
|
47
50
|
|
|
@@ -52,9 +55,17 @@
|
|
|
52
55
|
- `red.command`
|
|
53
56
|
- `red.exitStatus`
|
|
54
57
|
- `red.expectedFailure`
|
|
58
|
+
- `red.testSeam`
|
|
59
|
+
- `red.behaviorAsserted`
|
|
60
|
+
- `red.allowedMocks`
|
|
61
|
+
- `red.implementationDetailRisk`
|
|
55
62
|
- `green.command`
|
|
56
63
|
- `green.exitStatus`
|
|
57
64
|
- `refactor.status`
|
|
65
|
+
- `testQuality.usesPublicInterface`
|
|
66
|
+
- `testQuality.describesBehavior`
|
|
67
|
+
- `testQuality.survivesInternalRefactor`
|
|
68
|
+
- `testQuality.mocksOnlySystemBoundaries`
|
|
58
69
|
- `review.spec.status`
|
|
59
70
|
- `review.code.status`
|
|
60
71
|
|
|
@@ -82,12 +82,25 @@ if [[ -f "$events_file" ]]; then
|
|
|
82
82
|
echo "-1"
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
assert_before() {
|
|
86
|
+
local before="$1"
|
|
87
|
+
local after="$2"
|
|
88
|
+
local before_idx after_idx
|
|
89
|
+
before_idx="$(first_index "$before")"
|
|
90
|
+
after_idx="$(first_index "$after")"
|
|
91
|
+
if [[ "$before_idx" != "-1" && "$after_idx" != "-1" && "$before_idx" -ge "$after_idx" ]]; then
|
|
92
|
+
echo "Task $TASK_ID gate order is invalid: $before must precede $after" >&2
|
|
93
|
+
exit 1
|
|
94
|
+
fi
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
assert_before "red_failed" "red_reason_verified"
|
|
98
|
+
assert_before "red_reason_verified" "red_seam_verified"
|
|
99
|
+
assert_before "red_seam_verified" "red_behavior_verified"
|
|
100
|
+
assert_before "red_behavior_verified" "mock_boundary_verified"
|
|
101
|
+
assert_before "mock_boundary_verified" "green_passed"
|
|
102
|
+
assert_before "red_failed" "green_passed"
|
|
103
|
+
assert_before "green_passed" "refactor_green"
|
|
91
104
|
fi
|
|
92
105
|
fi
|
|
93
106
|
|
|
@@ -9,7 +9,7 @@ set -euo pipefail
|
|
|
9
9
|
usage() {
|
|
10
10
|
cat <<'EOF'
|
|
11
11
|
Usage:
|
|
12
|
-
write-task-checkpoint.sh --dir path/to/change --task T001 --status pending|running|passed|failed|skipped --summary "..." [--event context_ready] [--attempt 0] [--session session-id] [--next-action "..."]
|
|
12
|
+
write-task-checkpoint.sh --dir path/to/change --task T001 --status pending|running|passed|failed|skipped --summary "..." [--event context_ready] [--attempt 0] [--session session-id] [--next-action "..."] [--tdd-json '{"red":...}']
|
|
13
13
|
EOF
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -23,6 +23,7 @@ EVENT_TYPE=""
|
|
|
23
23
|
ATTEMPT="0"
|
|
24
24
|
SESSION_ID=""
|
|
25
25
|
NEXT_ACTION=""
|
|
26
|
+
TDD_JSON=""
|
|
26
27
|
|
|
27
28
|
while [[ $# -gt 0 ]]; do
|
|
28
29
|
case "$1" in
|
|
@@ -34,6 +35,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
34
35
|
--attempt) ATTEMPT="$2"; shift 2 ;;
|
|
35
36
|
--session) SESSION_ID="$2"; shift 2 ;;
|
|
36
37
|
--next-action) NEXT_ACTION="$2"; shift 2 ;;
|
|
38
|
+
--tdd-json) TDD_JSON="$2"; shift 2 ;;
|
|
37
39
|
-h|--help) usage; exit 0 ;;
|
|
38
40
|
*) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
|
|
39
41
|
esac
|
|
@@ -57,6 +59,15 @@ if [[ -z "$SESSION_ID" ]]; then
|
|
|
57
59
|
SESSION_ID="${TASK_ID}-$(date -u +%s)"
|
|
58
60
|
fi
|
|
59
61
|
|
|
62
|
+
tdd_payload="null"
|
|
63
|
+
if [[ -n "$TDD_JSON" ]]; then
|
|
64
|
+
if [[ -f "$TDD_JSON" ]]; then
|
|
65
|
+
tdd_payload="$(jq -c . "$TDD_JSON")"
|
|
66
|
+
else
|
|
67
|
+
tdd_payload="$(printf '%s' "$TDD_JSON" | jq -c .)"
|
|
68
|
+
fi
|
|
69
|
+
fi
|
|
70
|
+
|
|
60
71
|
jq -nc \
|
|
61
72
|
--arg changeId "$change_id" \
|
|
62
73
|
--arg taskId "$TASK_ID" \
|
|
@@ -66,6 +77,7 @@ jq -nc \
|
|
|
66
77
|
--arg summary "$SUMMARY" \
|
|
67
78
|
--arg timestamp "$timestamp" \
|
|
68
79
|
--arg attempt "$ATTEMPT" \
|
|
80
|
+
--argjson tdd "$tdd_payload" \
|
|
69
81
|
'{
|
|
70
82
|
changeId: $changeId,
|
|
71
83
|
taskId: $taskId,
|
|
@@ -75,7 +87,7 @@ jq -nc \
|
|
|
75
87
|
summary: $summary,
|
|
76
88
|
timestamp: $timestamp,
|
|
77
89
|
attempt: ($attempt | tonumber)
|
|
78
|
-
}' > "$runtime_task_dir/checkpoint.json"
|
|
90
|
+
} + (if $tdd == null then {} else {tdd: $tdd} end)' > "$runtime_task_dir/checkpoint.json"
|
|
79
91
|
|
|
80
92
|
if [[ -n "$EVENT_TYPE" || "$STATUS" == "failed" ]]; then
|
|
81
93
|
jq -nc \
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# CC-Investigate Skill Changelog
|
|
2
2
|
|
|
3
|
+
## v1.2.0 - 2026-04-28
|
|
4
|
+
|
|
5
|
+
- treat feedback loops as investigation products that must be made faster, sharper, and more deterministic before root cause freeze
|
|
6
|
+
- require flaky investigations to raise reproduction rate with stress, repetition, timing-window narrowing, or differential loops instead of guessing from weak signals
|
|
7
|
+
- add prevention handoff so confirmed root causes produce either a regression task, architecture finding, or explicit non-recorded reason
|
|
8
|
+
|
|
9
|
+
## v1.1.6 - 2026-04-28
|
|
10
|
+
|
|
11
|
+
- clarify that investigation domain language and durable decisions come from cc-devflow native sources: `devflow/specs/`, roadmap/backlog handoff, historical design/analysis, and change metadata
|
|
12
|
+
- remove external context/architecture-decision files from the standard investigation contract so they are not implied as generated artifacts
|
|
13
|
+
- route conflicts through capability specs, roadmap decisions, or historical design decisions instead of external decision-document language
|
|
14
|
+
|
|
15
|
+
## v1.1.5 - 2026-04-28
|
|
16
|
+
|
|
17
|
+
- add a feedback-loop contract so investigations record loop type, command, symptom match, runtime, determinism, failure rate, signal specificity, and sharpening plan before freezing root cause
|
|
18
|
+
- require ranked candidate hypotheses before narrowing to active falsification targets, plus probe tags for cleanup-safe diagnostic instrumentation
|
|
19
|
+
- add performance-regression, native domain/decision context, correct-test-seam, and evidence-request fields across the analysis, task, manifest, playbook, and investigation contract templates
|
|
20
|
+
|
|
3
21
|
## v1.1.4 - 2026-04-28
|
|
4
22
|
|
|
5
23
|
- add boundary-probe, backward-trace, reference-comparison, diagnostic-instrumentation, and condition-wait investigation modes for multi-component, deep-stack, similar-path, and flaky failures
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
## Core Rules
|
|
13
13
|
|
|
14
14
|
1. 先复现,再猜原因。
|
|
15
|
-
2.
|
|
16
|
-
3.
|
|
17
|
-
4.
|
|
18
|
-
5.
|
|
19
|
-
6.
|
|
20
|
-
7.
|
|
15
|
+
2. 先把复现做成快、准、可复跑的 feedback loop。
|
|
16
|
+
3. 先确认 loop 复现的是用户报告的同一个失败。
|
|
17
|
+
4. 先看最近变化,再决定是不是 regression。
|
|
18
|
+
5. 先证伪假设,再冻结根因。
|
|
19
|
+
6. `planning/analysis.md` 和 `planning/tasks.md` 必须足够让 `cc-do` 脱离当前会话继续工作。
|
|
20
|
+
7. 调查失败三次后先重建入口,不准继续乱补。
|
|
21
|
+
8. 没有 frozen root-cause contract,不准进入 repair task。
|
|
22
|
+
9. 多组件、深层调用、flaky 问题必须先补边界探针、反向追踪或条件等待证据。
|
|
21
23
|
|
|
22
24
|
## Iron Law
|
|
23
25
|
|
|
@@ -36,18 +38,21 @@ root-cause contract 至少包含:稳定复现或缩小后的可验证症状、
|
|
|
36
38
|
## Investigation Standard
|
|
37
39
|
|
|
38
40
|
1. 先收集 symptom、expected、actual、repro。
|
|
39
|
-
2.
|
|
40
|
-
3.
|
|
41
|
-
4.
|
|
42
|
-
5.
|
|
43
|
-
6.
|
|
44
|
-
7.
|
|
41
|
+
2. 先构造 feedback loop:失败测试、HTTP 脚本、CLI fixture、浏览器脚本、trace replay、throwaway harness、fuzz、bisect、differential,最后才是 HITL。
|
|
42
|
+
3. 记录 loop 的运行时间、确定性、失败率、症状匹配证据和 sharpen 计划。
|
|
43
|
+
4. 先查 prior investigations、TODOS/backlog、report-card finding 和最近变更。
|
|
44
|
+
5. 先沿代码路径定位触点和最近变更。
|
|
45
|
+
6. 先做 pattern analysis,再列 3-5 个候选假设并收敛到 1-3 个 active hypotheses。
|
|
46
|
+
7. 每个假设都要写支持证据、反证、证伪方法、预期观察、实际观察。
|
|
47
|
+
8. 只有被证据钉死的根因才能进入 repair contract。
|
|
48
|
+
9. repair contract 只讲最小修复边界,不顺手发明新范围。
|
|
45
49
|
|
|
46
50
|
## Investigation Modes
|
|
47
51
|
|
|
48
52
|
| Mode | 什么时候用 | 第一动作 |
|
|
49
53
|
| --- | --- | --- |
|
|
50
54
|
| `reproduce-first` | 症状真实但不稳定 | 缩小复现命令 / 手动路径 |
|
|
55
|
+
| `feedback-loop` | 已有复现但信号慢、松、偶然或不确定是否同一 bug | 记录 loop type、命令、runtime、determinism、failure rate 和 symptom match |
|
|
51
56
|
| `diff-trace` | 昨天可用、今天坏了 | `git log --oneline -20 -- <affected-files>` |
|
|
52
57
|
| `boundary-probe` | API -> service -> DB、CI -> build -> deploy 这类链路断裂 | 记录每层输入、输出、配置和状态 |
|
|
53
58
|
| `backward-trace` | 错误出现在深层堆栈或坏值来源不明 | 从 immediate failure site 反追 original trigger |
|
|
@@ -68,9 +73,12 @@ root-cause contract 至少包含:稳定复现或缩小后的可验证症状、
|
|
|
68
73
|
- configuration drift:本地 / CI / 生产表现不同
|
|
69
74
|
- stale cache:清缓存后恢复或旧状态复现
|
|
70
75
|
- resource leak:OOM、句柄增长、生命周期未释放
|
|
76
|
+
- performance regression:变慢、CPU / IO / 查询耗时升高、吞吐下降
|
|
71
77
|
- trust boundary drift:外部输入、LLM 输出、用户输入被当成可信
|
|
72
78
|
- timing guess / flaky wait:任意 sleep / timeout / setTimeout 掩盖真实条件
|
|
73
79
|
|
|
80
|
+
性能回归先建 baseline、profiler、query plan 或 bisect,不把普通日志当性能证据。
|
|
81
|
+
|
|
74
82
|
## Boundary And Trace Evidence
|
|
75
83
|
|
|
76
84
|
复杂链路必须在 `analysis.md` 写清:
|
|
@@ -78,7 +86,9 @@ root-cause contract 至少包含:稳定复现或缩小后的可验证症状、
|
|
|
78
86
|
- Boundary Probe Matrix:component boundary、input observed、output observed、config/env observed、state observed、verdict
|
|
79
87
|
- Backward Trace Chain:immediate failure site、caller chain、bad value origin、original trigger、why symptom-site fix is rejected
|
|
80
88
|
- Reference Comparison:similar working example、broken path、differences accepted / ruled out
|
|
81
|
-
- Diagnostic Instrumentation Plan:probe location、question answered、command、expected signal、cleanup requirement
|
|
89
|
+
- Diagnostic Instrumentation Plan:probe tag、probe location、question answered、command、expected signal、cleanup requirement
|
|
90
|
+
- Feedback Loop Contract:loop type、command、expected / actual signal、symptom match、runtime、determinism、failure rate、sharpening plan
|
|
91
|
+
- Correct Test Seam:test seam、public interface exercised、why it reaches the real trigger chain、why shallow tests are rejected
|
|
82
92
|
|
|
83
93
|
这些字段不是装饰。它们的作用是证明根因位于源头,而不是报错点。
|
|
84
94
|
|
|
@@ -93,6 +103,10 @@ root-cause contract 至少包含:稳定复现或缩小后的可验证症状、
|
|
|
93
103
|
|
|
94
104
|
命中历史时,写入 `analysis.md` 的 `Prior Investigations`,说明这次是复发、同类结构味道,还是无关历史。
|
|
95
105
|
|
|
106
|
+
## Domain And Decision Context
|
|
107
|
+
|
|
108
|
+
优先读取 cc-devflow 原生上下文:`devflow/specs/INDEX.md`、相关 capability specs、roadmap/backlog handoff、历史 `planning/design.md` / `planning/analysis.md`、`change-meta.json`。调查输出里的领域名、假设名、测试名应沿用项目词汇;如果调查结论违反 capability spec、roadmap decision 或历史 design decision,要显式写入 evidence chain,而不是静默覆盖既有设计决策。
|
|
109
|
+
|
|
96
110
|
## External Research Hygiene
|
|
97
111
|
|
|
98
112
|
只有在本地证据不足、错误类型陌生、或像依赖 / 框架 / 平台问题时才做外部调研。
|
|
@@ -130,6 +144,7 @@ root-cause contract 至少包含:稳定复现或缩小后的可验证症状、
|
|
|
130
144
|
- attempted evidence
|
|
131
145
|
- why current entry is suspect
|
|
132
146
|
- next option:continue / instrument-and-wait / human-review / reroute-cc-plan
|
|
147
|
+
- evidence request:需要可复现环境、HAR、日志 dump、core dump、带时间戳录屏或临时生产探针权限
|
|
133
148
|
- recommendation
|
|
134
149
|
|
|
135
150
|
## Local Kit
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cc-investigate
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.2.0
|
|
4
4
|
description: "Use when a bug, regression, broken task, or unexpected behavior needs root-cause investigation, reproducible evidence, and a frozen repair handoff before cc-do resumes coding."
|
|
5
5
|
triggers:
|
|
6
6
|
- "帮我查这个 bug"
|
|
@@ -33,9 +33,10 @@ writes:
|
|
|
33
33
|
entry_gate:
|
|
34
34
|
- "Read the current bug report, existing requirement artifacts, relevant code, tests, and recent history before forming any hypothesis."
|
|
35
35
|
- "Use a FIX-<number>-<description> change key for new bug-fix investigations."
|
|
36
|
-
- "
|
|
36
|
+
- "Build a runnable feedback loop, confirm it matches the reported symptom, then freeze the evidence chain before proposing repair tasks."
|
|
37
37
|
- "Search prior investigations, TODO/backlog signals, and recent fixes in the affected area before declaring the bug novel."
|
|
38
38
|
- "For multi-component, deep-stack, or flaky symptoms, record boundary probes, backward trace, or condition-wait evidence before declaring the root cause."
|
|
39
|
+
- "For performance regressions, collect a baseline or profile signal before treating logs as evidence."
|
|
39
40
|
- "Do not write production code here; this stage ends with planning/analysis.md plus executable repair tasks for cc-do."
|
|
40
41
|
exit_criteria:
|
|
41
42
|
- "planning/analysis.md records symptom, reproduction, evidence chain, boundary probes or backward trace when applicable, pattern analysis, tested hypotheses, confirmed root cause, and repair boundary."
|
|
@@ -130,6 +131,7 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
130
131
|
| 现实状态 | 先走什么路径 |
|
|
131
132
|
| --- | --- |
|
|
132
133
|
| 症状真实,但还没有稳定复现 | `reproduce-first`,先把现象钉死 |
|
|
134
|
+
| 已有复现但信号慢 / 松 / 偶然 | `feedback-loop`,先把 pass/fail loop 做快、准、可复跑 |
|
|
133
135
|
| 明显是 regression | `diff-trace`,先查最近变化 |
|
|
134
136
|
| 多组件链路断裂 | `boundary-probe`,先记录每个边界的输入、输出、配置和状态 |
|
|
135
137
|
| 报错点很深或坏值来源不明 | `backward-trace`,从 symptom site 一直追到 original trigger |
|
|
@@ -186,33 +188,44 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
186
188
|
- 记录用户看见了什么
|
|
187
189
|
- 记录预期与实际差异
|
|
188
190
|
- 记录复现命令或手动路径
|
|
191
|
+
- 确认复现的是用户描述的同一个失败,而不是旁边的红灯
|
|
189
192
|
- 如果上下文缺失,只问一个最关键问题,不一次性抛出问题清单
|
|
190
|
-
2. **
|
|
193
|
+
2. **Build feedback loop**
|
|
194
|
+
- 优先构造 agent 可运行的 pass/fail 信号:失败测试、curl / HTTP 脚本、CLI fixture、浏览器脚本、trace replay、throwaway harness、property / fuzz loop、bisect harness、differential loop,最后才是 HITL 脚本
|
|
195
|
+
- 记录 loop 类型、命令、运行时间、确定性、失败率、症状匹配证据和下一步 sharpen 计划
|
|
196
|
+
- loop 太慢、太宽、太 flaky 时,先优化 loop 本身;没有可信 loop,不进入 confirmed root cause
|
|
197
|
+
- 如果确实无法建 loop,写明尝试过什么,并请求 HAR、日志 dump、core dump、带时间戳录屏、可复现环境访问或临时生产探针权限
|
|
198
|
+
3. **Trace reality**
|
|
191
199
|
- 沿着代码路径找触点
|
|
192
200
|
- 多组件系统先写 `Boundary Probe Matrix`:每个边界的输入、输出、配置 / 环境、状态和 pass/fail
|
|
193
201
|
- 深层报错先写 `Backward Trace Chain`:immediate failure site、caller chain、bad value origin、original trigger
|
|
194
202
|
- 查最近提交和同类改动
|
|
195
203
|
- 查既有 `devflow/changes/*/planning/analysis.md`、`TODOS.md`、backlog、report-card finding
|
|
204
|
+
- 如果仓库有 `devflow/specs/`、roadmap/backlog handoff、历史 `planning/design.md` / `planning/analysis.md` 或 `change-meta.json`,把领域词汇和已冻结决策当成契约证据
|
|
196
205
|
- 找现有测试和断点证据
|
|
197
206
|
- 判定偏离的是 capability boundary、invariant,还是只是实现细节
|
|
198
|
-
|
|
199
|
-
- 判定是否属于 race condition、null propagation、state corruption、integration failure、configuration drift、stale cache、resource leak、trust boundary drift、timing guess / flaky wait
|
|
207
|
+
4. **Classify pattern**
|
|
208
|
+
- 判定是否属于 race condition、null propagation、state corruption、integration failure、configuration drift、stale cache、resource leak、performance regression、trust boundary drift、timing guess / flaky wait
|
|
200
209
|
- 如果有同仓库 working example,先写 `Reference Comparison`,列出 working path、broken path、差异和被接受 / 排除的假设
|
|
201
210
|
- 如果错误类型陌生,先做脱敏外部调研;只搜索通用错误类型、框架 / 库名和版本,不搜索 raw secret / path / customer data
|
|
202
|
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
211
|
+
5. **Form hypotheses**
|
|
212
|
+
- 先列 3-5 个候选假设并排序,避免第一直觉锚定
|
|
213
|
+
- 再收敛到 1-3 个 active hypotheses 进入验证
|
|
214
|
+
- 每个假设都写支持证据、反证和优先级理由
|
|
205
215
|
- 每个假设都写 `falsification method`、`expected observation`、`actual observation`
|
|
206
|
-
|
|
216
|
+
6. **Test hypotheses**
|
|
207
217
|
- 用复现、日志、断言、最小探针验证
|
|
208
|
-
- 临时探针必须写 `Diagnostic Instrumentation Plan`:probe location、question answered、command、expected signal、cleanup requirement
|
|
218
|
+
- 临时探针必须写 `Diagnostic Instrumentation Plan`:probe tag、probe location、question answered、command、expected signal、cleanup requirement
|
|
219
|
+
- 每个 probe 只回答一个假设预测;一次只改一个变量
|
|
220
|
+
- debug 日志必须带唯一前缀,例如 `[DEBUG-FIX123-a4f2]`,进入 `cc-do` 前用前缀 grep 清理或转正
|
|
209
221
|
- 三次假设都失败,就停下进入 escalation decision
|
|
210
|
-
|
|
222
|
+
7. **Freeze repair contract**
|
|
211
223
|
- 根因确认后,写进 `planning/analysis.md`
|
|
212
224
|
- 只保留最小修复边界
|
|
225
|
+
- 写清正确测试缝隙:测试是否覆盖真实触发链;如果没有正确 seam,这本身就是需要记录的架构事实
|
|
213
226
|
- 写明 affected module、allowed files、forbidden files、blast radius estimate;超过 5 个文件默认拆分或 reroute
|
|
214
227
|
- 输出 `planning/tasks.md` + `planning/task-manifest.json` + `change-meta.json`
|
|
215
|
-
|
|
228
|
+
8. **Hand off**
|
|
216
229
|
- 下一步明确写成 `cc-do`
|
|
217
230
|
- 如果 repair contract 越过当前 requirement,就 reroute 到 `cc-plan`
|
|
218
231
|
|
|
@@ -229,6 +242,7 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
229
242
|
| configuration drift | 本地可用、CI/生产失败 | env、feature flag、版本、路径、权限 |
|
|
230
243
|
| stale cache | 清缓存后恢复、旧状态复现 | browser / CDN / Redis / build cache |
|
|
231
244
|
| resource leak | OOM、句柄增长、慢性崩溃 | lifecycle、subscription、retention、cleanup |
|
|
245
|
+
| performance regression | 变慢、CPU / IO / 查询耗时升高、吞吐下降 | baseline、profiler、query plan、bisect |
|
|
232
246
|
| trust boundary drift | LLM / 用户输入 / 外部响应被当成可信 | validation、escaping、policy gate |
|
|
233
247
|
| timing guess / flaky wait | sleep / setTimeout / timeout 增大后偶尔通过 | 真实完成条件、事件、文件、状态或队列计数 |
|
|
234
248
|
|
|
@@ -285,6 +299,39 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
285
299
|
|
|
286
300
|
探针不能变成修复。进入 `cc-do` 前,要么删除,要么明确写入 repair task 的清理 / 转正方式。
|
|
287
301
|
|
|
302
|
+
## Feedback Loop Contract
|
|
303
|
+
|
|
304
|
+
根因调查首先依赖一个可信 loop:
|
|
305
|
+
|
|
306
|
+
- loop type: failing test / HTTP script / CLI fixture / browser script / trace replay / throwaway harness / property-fuzz / bisect / differential / HITL
|
|
307
|
+
- command or manual driver
|
|
308
|
+
- expected failing signal
|
|
309
|
+
- actual failing signal
|
|
310
|
+
- symptom match: 为什么它复现的是用户报告的同一个问题
|
|
311
|
+
- runtime and determinism
|
|
312
|
+
- failure rate for flaky bugs
|
|
313
|
+
- sharpening plan: 如何让它更快、更准、更稳定
|
|
314
|
+
|
|
315
|
+
把 loop 当成调查产品来迭代。已有 loop 但信号差时,先优化它:
|
|
316
|
+
|
|
317
|
+
1. faster:缓存 setup、缩小 test scope、跳过无关启动。
|
|
318
|
+
2. sharper:断言用户看见的具体症状,不用“没有崩溃”冒充匹配。
|
|
319
|
+
3. more deterministic:固定时间、随机种子、filesystem、network、locale、feature flag。
|
|
320
|
+
|
|
321
|
+
flaky bug 的目标不是立刻 100% 复现,而是提高复现率直到可调试。可以循环 100 次、并行触发、加压力、缩小时序窗口或做 differential loop;如果失败率仍低到不可证伪,先写 Evidence Request,不要继续猜。
|
|
322
|
+
|
|
323
|
+
没有 loop 时,不能把代码阅读当成根因。只能写 `Evidence Request`:需要可复现环境、HAR、日志 dump、core dump、带时间戳录屏,或临时生产探针权限。
|
|
324
|
+
|
|
325
|
+
## Correct Test Seam
|
|
326
|
+
|
|
327
|
+
进入 repair handoff 前,必须说明回归测试缝隙是否正确:
|
|
328
|
+
|
|
329
|
+
- test seam
|
|
330
|
+
- public interface exercised
|
|
331
|
+
- why this seam reaches the real trigger chain
|
|
332
|
+
- why a shallower test would be false confidence
|
|
333
|
+
- if no correct seam exists, record it as an architecture finding and keep repair verification tied to the original feedback loop
|
|
334
|
+
|
|
288
335
|
## Timing And Flaky Bugs
|
|
289
336
|
|
|
290
337
|
遇到 flaky、sleep、timeout、重试后消失:
|
|
@@ -345,6 +392,14 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
345
392
|
2. 不能拆但仍是根因跨度,写明为什么。
|
|
346
393
|
3. 如果已经变成设计 / 架构范围,reroute 到 `cc-plan`。
|
|
347
394
|
|
|
395
|
+
## Prevention Handoff
|
|
396
|
+
|
|
397
|
+
根因冻结后必须写一句后验判断:什么结构、测试 seam、capability invariant、operator guard 或文档会让这个 bug 更早暴露或根本不出现。
|
|
398
|
+
|
|
399
|
+
- 如果答案是小范围 regression test,把它写进当前 repair task。
|
|
400
|
+
- 如果答案是 seam / module / capability 边界问题,把它写成 architecture finding,并明确交给 `cc-plan` 或后续 backlog。
|
|
401
|
+
- 如果答案只是流程提醒或人工记忆,不算预防;要么转成可执行 guard,要么明确不记录。
|
|
402
|
+
|
|
348
403
|
## Escalation Decision
|
|
349
404
|
|
|
350
405
|
三次假设失败后,不准继续硬猜。`analysis.md` 必须写:
|
|
@@ -353,6 +408,7 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
353
408
|
- what was attempted
|
|
354
409
|
- why current entry is suspect
|
|
355
410
|
- next option:`continue-with-new-hypothesis` / `instrument-and-wait` / `human-review` / `reroute-cc-plan`
|
|
411
|
+
- evidence request if the loop cannot be built or the environment is missing
|
|
356
412
|
- recommendation
|
|
357
413
|
|
|
358
414
|
## Good Output
|
|
@@ -362,6 +418,7 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
362
418
|
- 假设不是列表装饰,而是带证伪方法和实际观察
|
|
363
419
|
- 历史调查、最近改动、模式分析没有被跳过
|
|
364
420
|
- 修复边界清楚到 `cc-do` 不需要二次调查
|
|
421
|
+
- 正确测试缝隙写清楚,不用浅层测试制造假安全
|
|
365
422
|
- `planning/tasks.md` 只包含修复任务,不夹带新需求
|
|
366
423
|
- 如果应该回 `cc-plan`,理由写清楚,不假装还能继续 patch
|
|
367
424
|
|
|
@@ -377,14 +434,15 @@ NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
|
377
434
|
## Working Rules
|
|
378
435
|
|
|
379
436
|
1. 没有复现,不准声称找到了根因。
|
|
380
|
-
2.
|
|
381
|
-
3.
|
|
382
|
-
4.
|
|
383
|
-
5.
|
|
384
|
-
6.
|
|
385
|
-
7.
|
|
386
|
-
8.
|
|
387
|
-
9.
|
|
437
|
+
2. 没有可信 feedback loop,不准把代码阅读包装成 confirmed root cause。
|
|
438
|
+
3. 没有证据,不准把猜测写成结论。
|
|
439
|
+
4. 先根因,再修复;先调查,再编码。
|
|
440
|
+
5. `planning/tasks.md` 必须足够让 `cc-do` 在脱离当前对话后继续推进。
|
|
441
|
+
6. 如果修复方案已经变成新 feature 设计,停止 debug,回 `cc-plan`。
|
|
442
|
+
7. 三次假设失败后,默认说明你的调查入口错了,不准继续硬猜。
|
|
443
|
+
8. 外部调研必须先脱敏,调研结论必须回到本仓库证据验证。
|
|
444
|
+
9. 修复触点超过 5 个文件时,默认先拆分或 reroute,不把大重构伪装成 bug fix。
|
|
445
|
+
10. 好的调查不是“找了很多可能性”,而是把错误世界缩成一个可信的 repair contract。
|
|
388
446
|
|
|
389
447
|
## Exit Criteria
|
|
390
448
|
|