flow-comet 1.7.0 → 1.8.0
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/.flow-comet/skills/flow-comet/INSTALLED_VERSION +1 -1
- package/.flow-comet/skills/flow-comet/SKILL.md +16 -14
- package/.flow-comet/skills/flow-comet/reference/commit-discipline.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/decision-points.md +5 -5
- package/.flow-comet/skills/flow-comet/reference/dirty-worktree.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/entry-detail.md +9 -9
- package/.flow-comet/skills/flow-comet/reference/fix-loop.md +4 -4
- package/.flow-comet/skills/flow-comet/reference/init-detection.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/platform-facts.md +2 -2
- package/.flow-comet/skills/flow-comet/reference/post-archive-handoff.md +264 -0
- package/.flow-comet/skills/flow-comet/reference/recovery.md +1 -1
- package/.flow-comet/skills/flow-comet/reference/replan.md +1 -1
- package/.flow-comet/skills/flow-comet/scripts/comet-check.mjs +1 -0
- package/.flow-comet/skills/flow-comet/scripts/comet-hook-guard.mjs +270 -30
- package/.flow-comet/skills/flow-comet/scripts/items/a.mjs +25 -8
- package/.flow-comet/skills/flow-comet/scripts/items/b.mjs +41 -38
- package/.flow-comet/skills/flow-comet/scripts/items/c.mjs +11 -9
- package/.flow-comet/skills/flow-comet/scripts/items/e.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/items/f.mjs +1 -1
- package/.flow-comet/skills/flow-comet/scripts/items/h.mjs +112 -53
- package/.flow-comet/skills/flow-comet/scripts/items/k.mjs +357 -3
- package/.flow-comet/skills/flow-comet/scripts/items/l.mjs +24 -1
- package/.flow-comet/skills/flow-comet/scripts/items/m.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/items/n.mjs +9 -10
- package/.flow-comet/skills/flow-comet/scripts/lib/ac-coverage.mjs +8 -8
- package/.flow-comet/skills/flow-comet/scripts/lib/fix-loop-node.mjs +4 -15
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-evidence-gates.mjs +79 -107
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-gates.mjs +183 -232
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-routing.mjs +91 -14
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-template-fidelity.mjs +20 -32
- package/.flow-comet/skills/flow-comet/scripts/lib/guard-uidesign.mjs +10 -19
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-admin.mjs +27 -17
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-flow.mjs +240 -87
- package/.flow-comet/skills/flow-comet/scripts/lib/state-commands-recovery.mjs +15 -22
- package/.flow-comet/skills/flow-comet/scripts/lib/state-determine.mjs +11 -4
- package/.flow-comet/skills/flow-comet/scripts/lib/state-io.mjs +192 -24
- package/.flow-comet/skills/flow-comet/scripts/lib/state-skillmarkers.mjs +55 -44
- package/.flow-comet/skills/flow-comet/scripts/lib/system-fixtures.mjs +2 -4
- package/.flow-comet/skills/flow-comet/scripts/lib/test-assertions.mjs +0 -3
- package/.flow-comet/skills/flow-comet/scripts/lib/test-fixtures.mjs +191 -17
- package/.flow-comet/skills/flow-comet/scripts/lib/test-helpers.mjs +3 -0
- package/.flow-comet/skills/flow-comet/scripts/lib/text-anchor-checks.mjs +23 -5
- package/.flow-comet/skills/flow-comet/scripts/lib/wave-projection.mjs +10 -11
- package/.flow-comet/skills/flow-comet/scripts/protocol-utils.mjs +40 -3
- package/.flow-comet/skills/flow-comet/scripts/route-node.mjs +12 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/a.mjs +193 -111
- package/.flow-comet/skills/flow-comet/scripts/scenarios/b.mjs +314 -57
- package/.flow-comet/skills/flow-comet/scripts/scenarios/c.mjs +311 -216
- package/.flow-comet/skills/flow-comet/scripts/scenarios/d.mjs +33 -62
- package/.flow-comet/skills/flow-comet/scripts/scenarios/e.mjs +188 -91
- package/.flow-comet/skills/flow-comet/scripts/scenarios/f.mjs +94 -37
- package/.flow-comet/skills/flow-comet/scripts/scenarios/g.mjs +36 -27
- package/.flow-comet/skills/flow-comet/scripts/scenarios/h.mjs +285 -9
- package/.flow-comet/skills/flow-comet/scripts/scenarios/i.mjs +2 -6
- package/.flow-comet/skills/flow-comet/scripts/scenarios/j.mjs +5 -15
- package/.flow-comet/skills/flow-comet/scripts/scenarios/k.mjs +6 -5
- package/.flow-comet/skills/flow-comet/scripts/scenarios/l.mjs +40 -36
- package/.flow-comet/skills/flow-comet/scripts/scenarios/m.mjs +2 -2
- package/.flow-comet/skills/flow-comet/scripts/scenarios/n.mjs +346 -25
- package/.flow-comet/skills/flow-comet/scripts/state-schema.mjs +0 -2
- package/.flow-comet/skills/flow-comet/scripts/workflow-handoff.mjs +41 -54
- package/.flow-comet/skills/flow-comet-archive/SKILL.md +33 -11
- package/.flow-comet/skills/flow-comet-change/SKILL.md +1 -1
- package/.flow-comet/skills/flow-comet-design/SKILL.md +5 -3
- package/.flow-comet/skills/flow-comet-dev/SKILL.md +2 -2
- package/.flow-comet/skills/flow-comet-execute/SKILL.md +11 -11
- package/.flow-comet/skills/flow-comet-integration/SKILL.md +10 -4
- package/.flow-comet/skills/flow-comet-plan/GUIDANCE.md +1 -1
- package/.flow-comet/skills/flow-comet-plan/SKILL.md +8 -8
- package/.flow-comet/skills/flow-comet-review/SKILL.md +8 -8
- package/.flow-comet/skills/flow-comet-subagent-execute/GUIDANCE.md +1 -1
- package/.flow-comet/skills/flow-comet-subagent-execute/SKILL.md +14 -14
- package/.flow-comet/skills/flow-comet-task/SKILL.md +3 -2
- package/.flow-comet/skills/flow-comet-ui-design/SKILL.md +2 -2
- package/.flow-comet/skills/flow-comet-verify/SKILL.md +1 -1
- package/README.md +2 -2
- package/package.json +1 -1
- package/scripts/dsh-bridge.mjs +238 -21
|
@@ -20,6 +20,7 @@ export const ENTRIES = [
|
|
|
20
20
|
run: (dir) => {
|
|
21
21
|
const env = { FLOW_COMET_PROTOCOL: path.join(dir, 'reference', 'workflow-protocol.json') };
|
|
22
22
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
23
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
23
24
|
|
|
24
25
|
// ① 旧绕过路径:Fix 任务仍 pending 时直接 exit review --apply → 新 change BLOCKED + 恢复指引
|
|
25
26
|
const bypass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
@@ -128,6 +129,7 @@ export const ENTRIES = [
|
|
|
128
129
|
const env = { FLOW_COMET_PROTOCOL: path.join(dir, 'reference', 'workflow-protocol.json') };
|
|
129
130
|
const gateMarker = path.join(dir, 'verify-gate-ran.txt');
|
|
130
131
|
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending' });
|
|
132
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
131
133
|
|
|
132
134
|
// ① 旧绕过路径:pending 修复任务时直接 exit verify --apply → BLOCKED,且验证命令未被执行
|
|
133
135
|
const bypass = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
@@ -197,14 +199,14 @@ export const ENTRIES = [
|
|
|
197
199
|
},
|
|
198
200
|
},
|
|
199
201
|
{
|
|
200
|
-
// 越界拦截 + done-but-unclosed 回放 +
|
|
202
|
+
// 越界拦截 + done-but-unclosed 回放 + 旧态同判(真实命令链路):
|
|
201
203
|
// ① 新 change review/pending → BLOCKED + state 不变;
|
|
202
204
|
// ② 事故回放——Fix 任务全 done 但 history 最新 exit execute 签名仍是追加前值
|
|
203
205
|
// (从未重跑 execute 出口)→ 同出口 BLOCKED + state 字节零改写(修复前被错误断言为通过);
|
|
204
206
|
// ③ 正对照——按指引 entry execute + exit execute --apply 真闭合后,review 出口通过;
|
|
205
207
|
// ④⑤ verify 源 pending / done-but-unclosed 同样 BLOCKED 且验证命令不执行,⑥ 闭合后通过;
|
|
206
|
-
// ⑦⑧⑨
|
|
207
|
-
name: 'A23 Fix
|
|
208
|
+
// ⑦⑧⑨ 同一形态(无任何新旧标记字段)同判 BLOCKED、next 归位可达、验证出口真实执行。
|
|
209
|
+
name: 'A23 Fix 越界拦截与旧态容忍:源节点直接 exit 一律 BLOCK 不卡死,next 归位可达(真实命令)',
|
|
208
210
|
run: (dir) => {
|
|
209
211
|
const env = { FLOW_COMET_PROTOCOL: path.join(dir, 'reference', 'workflow-protocol.json') };
|
|
210
212
|
const gateMarker = path.join(dir, 'verify-gate-ran.txt');
|
|
@@ -212,6 +214,7 @@ export const ENTRIES = [
|
|
|
212
214
|
|
|
213
215
|
// ① 新 change review 源 + pending:直接 exit review --apply → BLOCKED + 恢复指引 + state 不变
|
|
214
216
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
217
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
215
218
|
const rBlock = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
216
219
|
assertExit(rBlock, 1);
|
|
217
220
|
assertOut(rBlock, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
@@ -228,6 +231,7 @@ export const ENTRIES = [
|
|
|
228
231
|
// ② 事故回放形态:Fix 任务已全 done,但 history 最新 exit execute 记录的是追加前签名
|
|
229
232
|
//(done 后从未再跑 execute 出口)→ 修复前静默放行,修复后必须 BLOCKED + state 字节零改写
|
|
230
233
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'done' });
|
|
234
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
231
235
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
232
236
|
const doneUnclosed = readStateFile(dir);
|
|
233
237
|
doneUnclosed.history = fixBatchHistoryWithStaleExecuteExit();
|
|
@@ -267,6 +271,7 @@ export const ENTRIES = [
|
|
|
267
271
|
// 直接 exit review BLOCKED;next 归位 subagent-execute;完成委托后第二趟
|
|
268
272
|
// exit subagent-execute --apply 回源 review;源节点出口真实执行并推进 verify。
|
|
269
273
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending', parallelFix: true });
|
|
274
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
270
275
|
const pBypass = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
271
276
|
assertExit(pBypass, 1);
|
|
272
277
|
assertOut(pBypass, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
@@ -316,6 +321,7 @@ export const ENTRIES = [
|
|
|
316
321
|
// ④ 新 change verify 源 + pending:直接 exit verify --apply → BLOCKED,验证命令未执行
|
|
317
322
|
fs.rmSync(gateMarker, { force: true });
|
|
318
323
|
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending' });
|
|
324
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
319
325
|
const vBlock = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
320
326
|
assertExit(vBlock, 1);
|
|
321
327
|
assertOut(vBlock, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
@@ -331,6 +337,7 @@ export const ENTRIES = [
|
|
|
331
337
|
//(原路径会跳过 verify 去 archive)+ 全 done + 最新 execute exit 签名过时 → BLOCKED,验证命令
|
|
332
338
|
// 不执行、state 字节零改写;⑥ 按指引闭合后 exit verify 真实执行验证命令并推进 archive
|
|
333
339
|
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'done' });
|
|
340
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
334
341
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
335
342
|
const verifyDoneUnclosed = readStateFile(dir);
|
|
336
343
|
verifyDoneUnclosed.history = fixBatchHistoryWithStaleExecuteExit();
|
|
@@ -364,21 +371,18 @@ export const ENTRIES = [
|
|
|
364
371
|
throw new Error('闭合后 verify 出口未真实执行 TEST.md 验证命令(副作用文件缺失/内容不符)');
|
|
365
372
|
}
|
|
366
373
|
|
|
367
|
-
// ⑦
|
|
368
|
-
|
|
374
|
+
// ⑦ 同一形态(无任何新旧标记字段)review 源 + pending:同判 BLOCKED(单轨,无渐进放行)
|
|
375
|
+
// (前序 ①~⑥ 已消耗归位轮次;本段测的是「直接 exit 源节点」这一门,先把轮次计数清零)
|
|
376
|
+
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
377
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
369
378
|
const oldExit = runGuard(['exit', 'review', '--apply'], dir, env);
|
|
370
|
-
assertExit(oldExit,
|
|
371
|
-
assertOut(oldExit, '
|
|
372
|
-
assertNotOut(oldExit, '
|
|
373
|
-
assertOut(oldExit, 'ALL CHECKS PASSED');
|
|
374
|
-
assertNodeLine(oldExit, 'execute'); // pending 修复任务使路由继续回 execute(流程未卡死)
|
|
375
|
-
st = readStateFile(dir);
|
|
376
|
-
if (st.currentNode !== 'execute') {
|
|
377
|
-
throw new Error('旧 change 渐进放行后 currentNode 应为 execute,实际 ' + JSON.stringify(st.currentNode));
|
|
378
|
-
}
|
|
379
|
+
assertExit(oldExit, 1);
|
|
380
|
+
assertOut(oldExit, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
381
|
+
assertNotOut(oldExit, 'ALL CHECKS PASSED');
|
|
379
382
|
|
|
380
|
-
// ⑧
|
|
381
|
-
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending'
|
|
383
|
+
// ⑧ 同一形态 next 入口:pending 修复 + 源节点驻留 → next 仍归位 execute(路由不受分级影响)
|
|
384
|
+
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
385
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
382
386
|
const oldNext = runState(['next'], dir, env);
|
|
383
387
|
assertExit(oldNext, 0);
|
|
384
388
|
assertNotOut(oldNext, 'BLOCKED');
|
|
@@ -389,22 +393,19 @@ export const ENTRIES = [
|
|
|
389
393
|
throw new Error('旧 change next 归位后 currentNode 应为 execute,实际 ' + JSON.stringify(st.currentNode));
|
|
390
394
|
}
|
|
391
395
|
|
|
392
|
-
// ⑨
|
|
396
|
+
// ⑨ 同一形态 verify 源 + pending:同判 BLOCKED(单轨),验证命令不执行(拦截早于命令)
|
|
393
397
|
fs.rmSync(gateMarker, { force: true });
|
|
394
|
-
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending'
|
|
398
|
+
writeFixBatchFixture(dir, { kind: 'verify', fixStatus: 'pending' });
|
|
399
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
395
400
|
const oldVerify = runGuard(['exit', 'verify', '--apply'], dir, env);
|
|
396
|
-
assertExit(oldVerify,
|
|
397
|
-
assertOut(oldVerify, '
|
|
398
|
-
assertNotOut(oldVerify, '
|
|
399
|
-
assertOut(oldVerify, 'ALL CHECKS PASSED');
|
|
400
|
-
assertNodeLine(oldVerify, 'execute'); // pending 修复任务使路由继续回 execute
|
|
401
|
-
if (!fs.existsSync(gateMarker) || fs.readFileSync(gateMarker, 'utf8') !== 'GATE-RAN') {
|
|
402
|
-
throw new Error('旧 change verify 出口未真实执行 TEST.md 验证命令(渐进不等于跳过门禁)');
|
|
403
|
-
}
|
|
401
|
+
assertExit(oldVerify, 1);
|
|
402
|
+
assertOut(oldVerify, 'BLOCKED: 存在未归位/未跑出口的 Fix 批次');
|
|
403
|
+
assertNotOut(oldVerify, 'ALL CHECKS PASSED');
|
|
404
404
|
|
|
405
405
|
// ⑩ 多波次真实 Fix:第一波收口后追加第二波;第三趟收口时历史最新签名已等于当前签名、
|
|
406
406
|
// 更早签名仍发散——全量签名扫描不得被最新签名覆盖,仍须保留 FIX-BATCH 锚。
|
|
407
407
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
408
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
408
409
|
assertExit(runState(['next'], dir, env), 0); // 受控归位 execute
|
|
409
410
|
completeFixTaskAndRecord(dir, env); // 第一波:单修复任务 done + 声明/record
|
|
410
411
|
const wave1 = runGuard(['exit', 'execute', '--apply'], dir, env);
|
|
@@ -453,6 +454,7 @@ export const ENTRIES = [
|
|
|
453
454
|
|
|
454
455
|
// ⑪ 源未 entry 的真实 Fix:分类只认历史签名/Fix 结构标记,不依赖 enteredNodes → 仍 FIX-BATCH
|
|
455
456
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
457
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
456
458
|
const noEntryState = readStateFile(dir);
|
|
457
459
|
noEntryState.enteredNodes = (noEntryState.enteredNodes || []).filter((nodeId) => nodeId !== 'review');
|
|
458
460
|
writeState(dir, noEntryState);
|
|
@@ -496,9 +498,9 @@ export const ENTRIES = [
|
|
|
496
498
|
throw new Error('旧态未分类回程应停在 review: ' + JSON.stringify(legacyState.currentNode));
|
|
497
499
|
}
|
|
498
500
|
|
|
499
|
-
// ⑬ 受控归位轮次真实链路(review 源):第 1~3 轮输出「第 n/3 轮」并递增计数;第 4
|
|
500
|
-
//
|
|
501
|
-
// 后放行;verify
|
|
501
|
+
// ⑬ 受控归位轮次真实链路(review 源):第 1~3 轮输出「第 n/3 轮」并递增计数;第 4 轮
|
|
502
|
+
// BLOCK(state 字节零改写、currentNode 保持 review);用户显式授权(嵌套证据)
|
|
503
|
+
// 后放行;verify 失败计数与轮次计数各自独立;同一形态第 4 轮同判 BLOCKED。
|
|
502
504
|
const fixRoundsText = (statuses) => '# TASK\n\n## 任务清单\n\n' + serialTaskBlock('T01', 'done')
|
|
503
505
|
+ '\n\n## Fix 任务(来自 REVIEW / INTEGRATION)\n\n'
|
|
504
506
|
+ statuses.map((s, i) => serialTaskBlock('T-FIX-0' + (i + 1), s)).join('\n') + '\n';
|
|
@@ -542,6 +544,7 @@ export const ENTRIES = [
|
|
|
542
544
|
};
|
|
543
545
|
|
|
544
546
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
547
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
545
548
|
// verify 失败计数先落到 2——后续 4 轮归位都不得触碰该值
|
|
546
549
|
assertExit(runState(['verify-fail'], dir, env), 0);
|
|
547
550
|
const vfTwo = runState(['verify-fail'], dir, env);
|
|
@@ -618,25 +621,25 @@ export const ENTRIES = [
|
|
|
618
621
|
if (readStateFile(dir).fixRoundsByChange?.ch !== 4) {
|
|
619
622
|
throw new Error('verify 失败累计不得改写 Fix 轮次计数: ' + JSON.stringify(readStateFile(dir).fixRoundsByChange));
|
|
620
623
|
}
|
|
621
|
-
//
|
|
622
|
-
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending'
|
|
624
|
+
// 同一形态第 4 轮(无任何新旧标记字段):同判 BLOCKED(单轨,无渐进放行侧),计数不推进
|
|
625
|
+
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'pending' });
|
|
626
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
623
627
|
const oldRoundState = readStateFile(dir);
|
|
624
628
|
oldRoundState.fixRoundsByChange = { ch: 3 };
|
|
625
629
|
writeState(dir, oldRoundState);
|
|
626
630
|
const oldRound4 = runState(['next'], dir, env);
|
|
627
|
-
assertExit(oldRound4,
|
|
628
|
-
assertOut(oldRound4, '
|
|
629
|
-
assertOut(oldRound4, '(第 4/3 轮)');
|
|
630
|
-
assertNotOut(oldRound4, 'BLOCKED');
|
|
631
|
+
assertExit(oldRound4, 1);
|
|
632
|
+
assertOut(oldRound4, 'BLOCKED: Fix 批次受控归位已达 3 轮上限');
|
|
631
633
|
const oldRoundAfter = readStateFile(dir);
|
|
632
|
-
if (oldRoundAfter.
|
|
633
|
-
throw new Error('
|
|
634
|
-
+ JSON.stringify({
|
|
634
|
+
if (oldRoundAfter.fixRoundsByChange?.ch !== 3) {
|
|
635
|
+
throw new Error('BLOCK 不得推进 Fix 轮次计数: '
|
|
636
|
+
+ JSON.stringify({ rounds: oldRoundAfter.fixRoundsByChange }));
|
|
635
637
|
}
|
|
636
638
|
|
|
637
639
|
// ⑭ 签名算法版本可判别(真实命令链路):跨版本(v2 事件 vs 当前 v1)不做同版本比对——
|
|
638
640
|
// 不得把正常回程误判为未闭合 Fix;同版本 legacy 裸 hex 按既有语义参与(②⑤ 已锚)。
|
|
639
641
|
writeFixBatchFixture(dir, { kind: 'review', fixStatus: 'done' });
|
|
642
|
+
{ const s = readStateFile(dir); s.fixRoundsByChange = {}; writeState(dir, s); }
|
|
640
643
|
writeFile(dir, '.specs/' + CHANGE_ID + '/T-FIX-01-SUMMARY.md', execSummaryFixture('T-FIX-01'));
|
|
641
644
|
const versionSkewState = readStateFile(dir);
|
|
642
645
|
versionSkewState.history = [{
|
|
@@ -43,7 +43,6 @@ export const ENTRIES = [
|
|
|
43
43
|
assertNotOut(result, 'HANDOFF WARN');
|
|
44
44
|
// 新 change 提交越界(writeFiles 范围外文件)→ BLOCKED(记录时校验)
|
|
45
45
|
const stForP4 = readStateFile(dir);
|
|
46
|
-
stForP4.newChange = true;
|
|
47
46
|
writeState(dir, stForP4);
|
|
48
47
|
writeFile(dir, 'src/evil.mjs', 'export const evil = 1;\n');
|
|
49
48
|
execFileSync('git', ['add', 'src/evil.mjs'], { cwd: dir });
|
|
@@ -102,7 +101,6 @@ export const ENTRIES = [
|
|
|
102
101
|
// ⑦ 零提交正式语义:write_files 为空 + 显式零提交 → 跳过提交子集校验 + 可审计提示;
|
|
103
102
|
// write_files 非空 + 声称 noCommit → 仍完整提交子集校验(不可借零提交绕过越界检查)
|
|
104
103
|
const stEmpty = readStateFile(dir);
|
|
105
|
-
stEmpty.newChange = true;
|
|
106
104
|
writeState(dir, stEmpty);
|
|
107
105
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', '# TASK\n\n<task id="T05" status="pending"><action>无边界任务</action><write_files></write_files><verify>echo ok</verify></task>\n');
|
|
108
106
|
assertExit(runHandoff(['request', 'T05'], dir), 0);
|
|
@@ -117,7 +115,6 @@ export const ENTRIES = [
|
|
|
117
115
|
assertOut(resZero, '零提交');
|
|
118
116
|
// ⑦b 零提交滥用负例:write_files 非空 + 契约声称 noCommit → 仍完整校验(越界 BLOCK + 矛盾提示)
|
|
119
117
|
const stNonEmpty = readStateFile(dir);
|
|
120
|
-
stNonEmpty.newChange = true;
|
|
121
118
|
writeState(dir, stNonEmpty);
|
|
122
119
|
writeFile(dir, 'src/rogue-zero.mjs', 'export const rogue = 1;\n');
|
|
123
120
|
execFileSync('git', ['add', 'src/rogue-zero.mjs'], { cwd: dir });
|
|
@@ -202,7 +199,6 @@ export const ENTRIES = [
|
|
|
202
199
|
+ '<write_files>.specs/' + CHANGE_ID + '/T12-SUMMARY.md</write_files>'
|
|
203
200
|
+ '<verify>echo ok</verify></task>\n');
|
|
204
201
|
const stIgnored = readStateFile(dir);
|
|
205
|
-
stIgnored.newChange = true;
|
|
206
202
|
writeState(dir, stIgnored);
|
|
207
203
|
const reqIgnored = runHandoff(['request', 'T12'], dir, { FLOW_COMET_PROTOCOL: '' });
|
|
208
204
|
assertExit(reqIgnored, 0);
|
|
@@ -259,7 +255,6 @@ export const ENTRIES = [
|
|
|
259
255
|
const stParallel = readStateFile(dir);
|
|
260
256
|
stParallel.currentNode = 'subagent-execute';
|
|
261
257
|
stParallel.enteredNodes = ['open', 'design', 'plan', 'execute', 'subagent-execute'];
|
|
262
|
-
stParallel.newChange = true;
|
|
263
258
|
writeState(dir, stParallel);
|
|
264
259
|
const parallelEnv = { FLOW_COMET_PROTOCOL: path.join(dir, 'reference', 'workflow-protocol.json') };
|
|
265
260
|
const reqParallel = runHandoff(['request', 'P16', '并行零提交任务委托'], dir, parallelEnv);
|
|
@@ -324,7 +319,6 @@ export const ENTRIES = [
|
|
|
324
319
|
verifyFailures: 0,
|
|
325
320
|
executionMode: 'subagent',
|
|
326
321
|
directOverride: false,
|
|
327
|
-
newChange: true,
|
|
328
322
|
});
|
|
329
323
|
const reqNonGit = runHandoff(['request', 'T16', '--write-files', '.specs/' + CHANGE_ID + '/x.md'], nonGitRoot,
|
|
330
324
|
{ GIT_CEILING_DIRECTORIES: os.tmpdir() });
|
|
@@ -348,7 +342,6 @@ export const ENTRIES = [
|
|
|
348
342
|
verifyFailures: 0,
|
|
349
343
|
executionMode: 'subagent',
|
|
350
344
|
directOverride: false,
|
|
351
|
-
newChange: true,
|
|
352
345
|
});
|
|
353
346
|
writeIntakeArtifacts(dir);
|
|
354
347
|
writeFile(dir, '.specs/' + CHANGE_ID + '/DESIGN.md',
|
|
@@ -586,7 +579,7 @@ export const ENTRIES = [
|
|
|
586
579
|
const boundProtocol = JSON.parse(fs.readFileSync(path.join(dir, 'reference', 'workflow-protocol.json'), 'utf8'));
|
|
587
580
|
boundProtocol.nodes = boundProtocol.nodes.filter((n) => n.id !== 'execute' && n.id !== 'subagent-execute');
|
|
588
581
|
writeFile(dir, 'reference/protocol-bound.json', JSON.stringify(boundProtocol, null, 2) + '\n');
|
|
589
|
-
assertExit(runState(['init', boundChange, '--init-skip', '--protocol', 'reference/protocol-bound.json'], dir), 0);
|
|
582
|
+
assertExit(runState(['init', boundChange, '--init-skip', '--replace', CHANGE_ID, '--reason', '验证 state 协议绑定(真实命令链路)', '--protocol', 'reference/protocol-bound.json'], dir), 0);
|
|
590
583
|
writeFile(dir, '.specs/' + boundChange + '/TASK.md',
|
|
591
584
|
'# TASK\n\n<task id="R01" parallel="false" status="pending"><action>实现 R01</action>'
|
|
592
585
|
+ '<write_files>src/r01.mjs</write_files><verify>node --check src/r01.mjs</verify></task>\n');
|
|
@@ -609,7 +602,9 @@ export const ENTRIES = [
|
|
|
609
602
|
{
|
|
610
603
|
name: 'C2 handoff:红绿证据时间序(先红后绿通过 / 补录拦截)',
|
|
611
604
|
run: (dir) => {
|
|
612
|
-
|
|
605
|
+
const c2State = baseState('subagent-execute');
|
|
606
|
+
c2State.evidence['subagent-execute'] = { handoffRequests: { P01: { description: 'delegate', writeFiles: ['src/p1.mjs'] } } };
|
|
607
|
+
writeState(dir, c2State);
|
|
613
608
|
fs.mkdirSync(path.join(dir, '.specs', CHANGE_ID), { recursive: true });
|
|
614
609
|
// ① 先记录 RED(TDD 红)
|
|
615
610
|
const red = '{"redEvidence":{"command":"node --check src/p1.mjs"}}';
|
|
@@ -629,6 +624,13 @@ export const ENTRIES = [
|
|
|
629
624
|
throw new Error('greenEvidence 未附带 recordedAt: ' + JSON.stringify(rec.greenEvidence));
|
|
630
625
|
}
|
|
631
626
|
// ③ 新任务:先 GREEN 后补 RED → 事后补录拦截
|
|
627
|
+
// 单轨:result 必须有对应 request(未记录的委托不能回传结果)——夹具补同一份事实
|
|
628
|
+
const c2b = readStateFile(dir);
|
|
629
|
+
c2b.evidence['subagent-execute'].handoffRequests = {
|
|
630
|
+
...(c2b.evidence['subagent-execute'].handoffRequests || {}),
|
|
631
|
+
P02: { description: 'delegate', writeFiles: ['src/p2.mjs'] },
|
|
632
|
+
};
|
|
633
|
+
writeState(dir, c2b);
|
|
632
634
|
const greenOnly = '{"greenEvidence":{"command":"node --check src/p2.mjs"}}';
|
|
633
635
|
assertExit(runHandoff(['result', 'P02', greenOnly], dir), 0);
|
|
634
636
|
const backfill = '{"greenEvidence":{"command":"node --check src/p2.mjs"},"redEvidence":{"command":"node --check src/p2.mjs"}}';
|
|
@@ -194,7 +194,7 @@ export const ENTRIES = [
|
|
|
194
194
|
// 对照:同一夹具换成未登记等级的绑定(skill 变体)时零该技能声明照样放行——等级是唯一开关。
|
|
195
195
|
const guardedProtocol = writeCustomProtocol(dir, 'guarded');
|
|
196
196
|
const guardedEnv = { FLOW_COMET_PROTOCOL: guardedProtocol };
|
|
197
|
-
assertExit(runState(['init', 'cp-guard', '--protocol', guardedProtocol], dir), 0);
|
|
197
|
+
assertExit(runState(['init', 'cp-guard', '--replace', 'cp-skill', '--reason', '切换协议夹具(覆盖闸门显式放行)', '--protocol', guardedProtocol], dir), 0);
|
|
198
198
|
assertExit(runState(['skill-load', 'brainstorm', 'flow-comet-tdd'], dir, guardedEnv), 0);
|
|
199
199
|
assertExit(runState(['record', 'brainstorm', '{"summary":"brainstorm done"}'], dir, guardedEnv), 0);
|
|
200
200
|
writeFile(dir, '.specs/cp-guard/notes.md', '# notes\n');
|
|
@@ -212,7 +212,7 @@ export const ENTRIES = [
|
|
|
212
212
|
// 对照:未登记等级的同一绑定 → 只声明别的技能也放行(覆盖判据不在这条路径上生效)
|
|
213
213
|
const plainProtocol = writeCustomProtocol(dir, 'skill');
|
|
214
214
|
const plainEnv = { FLOW_COMET_PROTOCOL: plainProtocol };
|
|
215
|
-
assertExit(runState(['init', 'cp-plain', '--protocol', plainProtocol], dir), 0);
|
|
215
|
+
assertExit(runState(['init', 'cp-plain', '--replace', 'cp-guard', '--reason', '切换协议夹具(覆盖闸门显式放行)', '--protocol', plainProtocol], dir), 0);
|
|
216
216
|
assertExit(runState(['skill-load', 'brainstorm', 'flow-comet-tdd'], dir, plainEnv), 0);
|
|
217
217
|
assertExit(runState(['record', 'brainstorm', '{"summary":"brainstorm done"}'], dir, plainEnv), 0);
|
|
218
218
|
writeFile(dir, '.specs/cp-plain/notes.md', '# notes\n');
|
|
@@ -40,7 +40,7 @@ export const ENTRIES = [
|
|
|
40
40
|
const st1 = readStateFile(dir);
|
|
41
41
|
if (st1.ai_context_doc !== 'none') throw new Error('跳过后 ai_context_doc 应为 none');
|
|
42
42
|
// 下次 init(新 id)尊重既有决策 → 静默
|
|
43
|
-
const second = runState(['init', CHANGE_ID + '-2'], dir);
|
|
43
|
+
const second = runState(['init', CHANGE_ID + '-2', '--replace', CHANGE_ID, '--reason', '验证跳过记忆跨 change 生效'], dir);
|
|
44
44
|
assertExit(second, 0);
|
|
45
45
|
assertNotOut(second, 'INIT-NEEDED');
|
|
46
46
|
assertNotOut(second, 'INIT-HINT');
|
|
@@ -7,7 +7,7 @@ import fs from 'fs';
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { execFileSync, spawnSync } from 'child_process';
|
|
9
9
|
import { createHash } from 'crypto';
|
|
10
|
-
import { assertExit, assertNotOut, assertOut, runGuard, runHandoff, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
|
|
10
|
+
import { assertExit, assertNotOut, assertOut, assertTrue, installSkillTreeCopy, runGuard, runHandoff, runHook, runPrintedCommand, runState, writeFile, writeState } from '../lib/test-helpers.mjs';
|
|
11
11
|
import { archiveRecordJson, CHANGE_ID, assertNodeLine, assertNotNodeLine, completeFixTaskAndRecord, driveThroughDesign, execSummaryFixture, fixBatchReviewDoc, fixBatchTaskText, fullContract, parseStatusOutput, readStateBytes, readStateFile, writeIntakeArtifacts } from '../lib/system-fixtures.mjs';
|
|
12
12
|
|
|
13
13
|
// 同夹具的「段内大写 Z 早于方法名」变体(真实机检标记形态):6 维自查段体首行是含大写 Z 的机检
|
|
@@ -201,6 +201,9 @@ export const ENTRIES = [
|
|
|
201
201
|
// 节点推进到归档(模拟前序节点出口已完成的状态——被测机制是归档出口本身)
|
|
202
202
|
const st0 = readStateFile(dir);
|
|
203
203
|
st0.currentNode = 'archive';
|
|
204
|
+
// 夹具自洽:归档日期必须不早于该 change 的创建日期(位置解析按 createdAt 排掉更早的同名归档
|
|
205
|
+
// 目录——排除不了就 fail-closed)。真实链路里归档发生在创建之后,夹具的固定日期须与之一致。
|
|
206
|
+
st0.createdAt = '2026-08-01T00:00:00.000Z';
|
|
204
207
|
writeState(dir, st0);
|
|
205
208
|
// 归档提名随证据落盘(该 change 无任务 SUMMARY → 扫描 0 份,理由写明无候选入库)
|
|
206
209
|
assertExit(runState(['record', 'archive', archiveRecordJson('archived')], dir), 0);
|
|
@@ -229,6 +232,16 @@ export const ENTRIES = [
|
|
|
229
232
|
const status = runState(['status'], dir);
|
|
230
233
|
assertExit(status, 0);
|
|
231
234
|
assertOut(status, '"status": "no-change"');
|
|
235
|
+
// ⑤ 完成态之后(交接的落点):归档已闭合——写项目文件放行,state 机器文件仍恒拦。
|
|
236
|
+
// 两句成对:前一句证明完成态不再是「处处拦」,后一句证明放行没有把守卫整体关掉。
|
|
237
|
+
const postArchiveWrite = runHook(['before_tool'], dir,
|
|
238
|
+
{ tool_name: 'Write', tool_input: { file_path: path.join(dir, 'docs', 'roadmap', 'KI-arch-demo-01.md') } });
|
|
239
|
+
assertExit(postArchiveWrite, 0);
|
|
240
|
+
assertOut(postArchiveWrite, 'no active workflow');
|
|
241
|
+
const stateWrite = runHook(['before_tool'], dir,
|
|
242
|
+
{ tool_name: 'Write', tool_input: { file_path: path.join(dir, '.flow-comet', 'flow-comet-state.json') } });
|
|
243
|
+
assertExit(stateWrite, 2);
|
|
244
|
+
assertOut(stateWrite, 'state 文件');
|
|
232
245
|
},
|
|
233
246
|
},
|
|
234
247
|
|
|
@@ -246,6 +259,9 @@ export const ENTRIES = [
|
|
|
246
259
|
// 节点推进到归档(模拟前序节点出口已完成的状态)
|
|
247
260
|
const st0 = readStateFile(dir);
|
|
248
261
|
st0.currentNode = 'archive';
|
|
262
|
+
// 夹具自洽:同 H2——归档日期必须不早于该 change 的创建日期(位置解析按 createdAt 排除更早的
|
|
263
|
+
// 同名归档目录)。夹具的固定归档日期须落在创建日期之后。
|
|
264
|
+
st0.createdAt = '2026-08-01T00:00:00.000Z';
|
|
249
265
|
writeState(dir, st0);
|
|
250
266
|
// 归档提名随证据落盘(该 change 无任务 SUMMARY → 扫描 0 份,理由写明无候选入库)
|
|
251
267
|
assertExit(runState(['record', 'archive', archiveRecordJson('archived')], dir), 0);
|
|
@@ -265,53 +281,88 @@ export const ENTRIES = [
|
|
|
265
281
|
},
|
|
266
282
|
|
|
267
283
|
{
|
|
268
|
-
name: 'H4
|
|
284
|
+
name: 'H4 归档:移动后缺声明一律 BLOCKED,手动声明后同一 record 通过,不重建活动目录',
|
|
269
285
|
run: (dir) => {
|
|
270
|
-
//
|
|
271
|
-
//
|
|
272
|
-
|
|
286
|
+
// 自动补写已整体删除(单轨):移动目录后 record 缺声明不再由引擎代记,执行者必须手动声明。
|
|
287
|
+
// 两条不变量:① 归档路径的声明由执行者写入(报文命令可照抄执行);② 任何路径都不得重建
|
|
288
|
+
// 已归档的活动目录。
|
|
289
|
+
assertExit(runState(['init', 'arch-h4'], dir), 0);
|
|
273
290
|
writeFile(dir, 'flow-kit/prompts/0-change.md', '# 阶段 0 · CHANGE\n\n## 角色\n\n你是 Changeer。\n');
|
|
274
291
|
writeFile(dir, 'flow-kit/prompts/7-integration.md', '# 阶段 7 · INTEGRATION\n\n## 角色\n\n你是 Integrationer。\n');
|
|
275
|
-
//
|
|
292
|
+
// 归档前只声明 open(archive 声明留空——构造「移动后缺声明」)
|
|
276
293
|
assertExit(runState(['skill-load', 'open', 'flow-comet-change', '--prompt', 'flow-kit/prompts/0-change.md', '--templates', 'CHANGE.md,REQUIREMENT.md'], dir), 0);
|
|
277
|
-
|
|
278
|
-
//
|
|
294
|
+
// 缺声明报文按**实际查找结果**说话(in-place 扩展):活动目录在场、归档区没有本 change 的目录时,
|
|
295
|
+
// 只点活动路径缺件,不对归档路径下任何结论(旧形态无条件打印「(归档路径也未找到)」)。
|
|
296
|
+
const activeMissing = runState(['record', 'archive',
|
|
297
|
+
'{"summary":"archived","completedChecks":["required-skill:archive.flow-comet-integration"]}'], dir);
|
|
298
|
+
assertExit(activeMissing, 1);
|
|
299
|
+
assertOut(activeMissing, '缺少对应声明标记 .specs/arch-h4/.skill-loads/archive-flow-comet-integration.json');
|
|
300
|
+
assertNotOut(activeMissing, '归档路径也未找到');
|
|
301
|
+
assertNotOut(activeMissing, '已归档');
|
|
279
302
|
const st0 = readStateFile(dir);
|
|
280
303
|
st0.currentNode = 'archive';
|
|
304
|
+
st0.enteredNodes = ['open', 'archive'];
|
|
305
|
+
// 夹具自洽:归档日期必须不早于该 change 的创建日期(位置解析按 createdAt 排掉更早的同名归档
|
|
306
|
+
// 目录——排除不了就 fail-closed)。真实链路里归档发生在创建之后,夹具的固定日期须与之一致。
|
|
307
|
+
st0.createdAt = '2026-08-01T00:00:00.000Z';
|
|
308
|
+
// 字段退役后的状态形态(init 不再写 newChange):旧状态带该字段一律被忽略,
|
|
309
|
+
// 这里显式去掉它构造「无字段」形态——删除是幂等的,字段退役后本行自然成为 no-op。
|
|
281
310
|
writeState(dir, st0);
|
|
282
311
|
// 移动目录到归档(真实归档流程:先移动后 record/exit)
|
|
312
|
+
const archiveDir = path.join(dir, '.specs', 'archive', '2026-08-14-arch-h4');
|
|
283
313
|
fs.mkdirSync(path.join(dir, '.specs', 'archive'), { recursive: true });
|
|
284
|
-
fs.renameSync(path.join(dir, '.specs', 'arch-
|
|
285
|
-
//
|
|
314
|
+
fs.renameSync(path.join(dir, '.specs', 'arch-h4'), archiveDir);
|
|
315
|
+
// ① 移动后 record 缺 archive 声明 → BLOCKED(唯一等级;自动补写已删除),报文给可照抄的命令
|
|
286
316
|
const rec = runState(['record', 'archive', '{"summary":"archived"}'], dir);
|
|
287
|
-
assertExit(rec,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
317
|
+
assertExit(rec, 1);
|
|
318
|
+
assertOut(rec, 'BLOCKED');
|
|
319
|
+
assertOut(rec, '缺少技能加载声明标记');
|
|
320
|
+
// 缺声明报文的第二态(in-place 扩展):目录已随归档搬走、归档路径里也没有该标记 —— 报文如实
|
|
321
|
+
// 说出真实路径(哪里找过、哪里也没有),不再固定打印「(归档路径也未找到)」。
|
|
322
|
+
const movedMissing = runState(['record', 'archive',
|
|
323
|
+
'{"summary":"archived","completedChecks":["required-skill:archive.flow-comet-integration"]}'], dir);
|
|
324
|
+
assertExit(movedMissing, 1);
|
|
325
|
+
assertOut(movedMissing, '缺少对应声明标记 .specs/arch-h4/.skill-loads/archive-flow-comet-integration.json');
|
|
326
|
+
assertOut(movedMissing, '已归档到 .specs/archive/2026-08-14-arch-h4');
|
|
327
|
+
assertNotOut(movedMissing, '归档路径也未找到');
|
|
328
|
+
const declareLine = (rec.output.match(/^\s*(node "[^"]+" skill-load archive flow-comet-integration[^\n]+)$/m) || [])[1];
|
|
329
|
+
assertTrue(typeof declareLine === 'string', 'BLOCKED 报文应给出可照抄的 archive 声明命令:\n' + rec.output);
|
|
330
|
+
// ② 不得重建已归档的活动目录,也不得代记任何标记(归档路径不得出现 archive-*.json)
|
|
331
|
+
if (fs.existsSync(path.join(dir, '.specs', 'arch-h4'))) {
|
|
332
|
+
throw new Error('record 在归档后重建了活动目录(残留): .specs/arch-h4/');
|
|
333
|
+
}
|
|
334
|
+
const archiveLoads = path.join(archiveDir, '.skill-loads');
|
|
335
|
+
const autoWritten = fs.existsSync(archiveLoads)
|
|
336
|
+
? fs.readdirSync(archiveLoads).filter((f) => f.startsWith('archive-'))
|
|
337
|
+
: [];
|
|
338
|
+
if (autoWritten.length > 0) {
|
|
339
|
+
throw new Error('record 在缺声明时自动补写了标记(自动补写应已删除): ' + autoWritten.join(', '));
|
|
340
|
+
}
|
|
341
|
+
// ③ 移动后照抄报文命令(真实执行打印文本)直接声明 archive 技能——标记落**归档路径**(解析到的
|
|
342
|
+
// 目录),同一 record 通过,活动目录不重建。这是单轨的直连链路:身份只看状态、位置由解析器
|
|
343
|
+
// 给出,不再需要「先把目录移回活动位置→声明→再移回归档」那两步(该绕道已随单轨删除)。
|
|
344
|
+
installSkillTreeCopy(dir, path.join('.claude', 'skills'));
|
|
345
|
+
const declared = runPrintedCommand(declareLine, dir, { FLOW_COMET_RUN_ROOT: dir, FLOW_COMET_PROTOCOL: '' });
|
|
346
|
+
assertTrue(declared.status === 0,
|
|
347
|
+
'照抄的声明命令跑不通\n 命令: ' + declareLine + '\n exit ' + declared.status + '\n' + declared.output);
|
|
348
|
+
// 报告说出真实落点(归档目录),不是活动路径的相对形态
|
|
349
|
+
assertOut(declared, 'SKILL-LOAD: archive flow-comet-integration → .specs/archive/2026-08-14-arch-h4/.skill-loads/archive-flow-comet-integration.json');
|
|
350
|
+
const markerInArchive = path.join(archiveDir, '.skill-loads', 'archive-flow-comet-integration.json');
|
|
294
351
|
if (!fs.existsSync(markerInArchive)) {
|
|
295
|
-
throw new Error('
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
// 变体:归档后 skill-load 报错须引导 record 自动补路径(真实会话实证:归档后手动声明
|
|
311
|
-
// 不可行,消息须指明 M5 自动补仍可写归档路径标记)
|
|
312
|
-
const slArchive = runState(['skill-load', 'archive', 'flow-comet-integration'], dir);
|
|
313
|
-
assertExit(slArchive, 1);
|
|
314
|
-
assertOut(slArchive, 'record 自动补写');
|
|
352
|
+
throw new Error('归档路径缺执行者声明的标记: ' + markerInArchive);
|
|
353
|
+
}
|
|
354
|
+
if (fs.existsSync(path.join(dir, '.specs', 'arch-h4'))) {
|
|
355
|
+
throw new Error('声明命令在归档后重建了活动目录(残留): .specs/arch-h4/');
|
|
356
|
+
}
|
|
357
|
+
const recPass = runState(['record', 'archive', '{"summary":"archived"}'], dir);
|
|
358
|
+
assertExit(recPass, 0);
|
|
359
|
+
assertOut(recPass, 'EVIDENCE: archive');
|
|
360
|
+
if (fs.existsSync(path.join(dir, '.specs', 'arch-h4'))) {
|
|
361
|
+
throw new Error('record 在归档后重建了活动目录(残留): .specs/arch-h4/');
|
|
362
|
+
}
|
|
363
|
+
// ④ 出口的声明覆盖门认归档路径的标记——不再点名缺声明(出口其余判据不在本格范围内)
|
|
364
|
+
const exitRes = runGuard(['exit', 'archive'], dir);
|
|
365
|
+
assertNotOut(exitRes, '缺协议声明标记');
|
|
315
366
|
},
|
|
316
367
|
},
|
|
317
368
|
|
|
@@ -705,21 +756,18 @@ export const ENTRIES = [
|
|
|
705
756
|
// depends_on 后复签通过(同一通道,不做校验豁免)。
|
|
706
757
|
const parallelIds = ['P01', 'P02', 'P03', 'P04'];
|
|
707
758
|
const oldChangeState = readStateFile(dir);
|
|
708
|
-
delete oldChangeState.newChange;
|
|
709
759
|
writeState(dir, oldChangeState);
|
|
710
760
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
|
|
711
761
|
replanTaskText({ parallelPending: ['P01'], crossTaskPair: 'no-deps' }));
|
|
712
|
-
const crossWarn = runState(['replan', '计划缺陷重校 1
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
assertOut(crossWarn, '
|
|
762
|
+
const crossWarn = runState(['replan', '计划缺陷重校 1(无字段状态)', '--authorized-by', '用户裁决'], dir);
|
|
763
|
+
// 单轨:replan 不做校验豁免——同文件跨任务族一律 BLOCKED 且状态零改写
|
|
764
|
+
assertExit(crossWarn, 1);
|
|
765
|
+
assertOut(crossWarn, 'BLOCKED: TASK.md 同文件跨任务且无依赖路径');
|
|
716
766
|
assertOut(crossWarn, 'X1×X2(src/shared-cross.mjs)');
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
throw new Error('旧 change 形态应照常重签并写入第 1 条 replan-applied 事件');
|
|
767
|
+
if (replanEventsOf(readStateFile(dir)).length !== 0) {
|
|
768
|
+
throw new Error('BLOCK 不得写入 replan-applied 事件');
|
|
720
769
|
}
|
|
721
770
|
const afterWarnState = readStateFile(dir);
|
|
722
|
-
afterWarnState.newChange = true;
|
|
723
771
|
writeState(dir, afterWarnState);
|
|
724
772
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
|
|
725
773
|
replanTaskText({ parallelPending: ['P01', 'P02'], crossTaskPair: 'no-deps' }));
|
|
@@ -732,10 +780,10 @@ export const ENTRIES = [
|
|
|
732
780
|
assertOut(crossBlocked, '补显式 depends_on 或合并为一个任务');
|
|
733
781
|
assertNotOut(crossBlocked, 'REPLAN:');
|
|
734
782
|
if (!readStateBytes(dir).equals(crossBytes)) throw new Error('replan 第三族 BLOCK 改写了 state 字节');
|
|
735
|
-
if (replanBackupFiles(dir).length !==
|
|
736
|
-
throw new Error('replan 第三族 BLOCK
|
|
783
|
+
if (replanBackupFiles(dir).length !== 0) {
|
|
784
|
+
throw new Error('replan 第三族 BLOCK 不得新增备份(单轨:无成功重签即无备份): ' + JSON.stringify(replanBackupFiles(dir)));
|
|
737
785
|
}
|
|
738
|
-
if (replanEventsOf(readStateFile(dir)).length !==
|
|
786
|
+
if (replanEventsOf(readStateFile(dir)).length !== 0) {
|
|
739
787
|
throw new Error('replan 第三族 BLOCK 不得写入 replan-applied 事件');
|
|
740
788
|
}
|
|
741
789
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md',
|
|
@@ -743,21 +791,32 @@ export const ENTRIES = [
|
|
|
743
791
|
const crossRecovered = runState(['replan', '计划缺陷重校 2(已补 depends_on)', '--authorized-by', '用户裁决'], dir);
|
|
744
792
|
assertExit(crossRecovered, 0);
|
|
745
793
|
assertOut(crossRecovered, 'REPLAN');
|
|
746
|
-
if (replanEventsOf(readStateFile(dir)).length !==
|
|
747
|
-
throw new Error('补显式 depends_on 后复签应写入第
|
|
794
|
+
if (replanEventsOf(readStateFile(dir)).length !== 1) {
|
|
795
|
+
throw new Error('补显式 depends_on 后复签应写入第 1 条 replan-applied 事件');
|
|
748
796
|
}
|
|
749
|
-
// 第
|
|
797
|
+
// 第 2 轮:常规修订(轮次按 change 从事件累计)
|
|
750
798
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', replanTaskText({ parallelPending: parallelIds.slice(0, 3) }));
|
|
751
799
|
const thirdRound = runState(['replan', '计划缺陷重校 3', '--authorized-by', '用户裁决'], dir);
|
|
752
800
|
assertExit(thirdRound, 0);
|
|
753
801
|
assertOut(thirdRound, 'REPLAN');
|
|
802
|
+
if (replanEventsOf(readStateFile(dir)).length !== 2) {
|
|
803
|
+
throw new Error('第 2 轮后 replan-applied 事件数应为 2');
|
|
804
|
+
}
|
|
805
|
+
if (replanBackupFiles(dir).length !== 2) {
|
|
806
|
+
throw new Error('两轮应产生两份备份: ' + JSON.stringify(replanBackupFiles(dir)));
|
|
807
|
+
}
|
|
808
|
+
// 第 3 轮(上限内的最后一轮)成功
|
|
809
|
+
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', replanTaskText({ parallelPending: parallelIds.slice(0, 2) }));
|
|
810
|
+
const thirdRoundB = runState(['replan', '计划缺陷重校 3b', '--authorized-by', '用户裁决'], dir);
|
|
811
|
+
assertExit(thirdRoundB, 0);
|
|
812
|
+
assertOut(thirdRoundB, 'REPLAN');
|
|
754
813
|
if (replanEventsOf(readStateFile(dir)).length !== 3) {
|
|
755
814
|
throw new Error('第 3 轮后 replan-applied 事件数应为 3');
|
|
756
815
|
}
|
|
757
816
|
if (replanBackupFiles(dir).length !== 3) {
|
|
758
817
|
throw new Error('三轮应产生三份备份: ' + JSON.stringify(replanBackupFiles(dir)));
|
|
759
818
|
}
|
|
760
|
-
// ③ 第 4 次 → BLOCK +
|
|
819
|
+
// ③ 第 4 次 → BLOCK + 人工裁决指引 + state 字节零改写
|
|
761
820
|
writeFile(dir, '.specs/' + CHANGE_ID + '/TASK.md', replanTaskText({ parallelPending: parallelIds }));
|
|
762
821
|
const beforeFourth = readStateBytes(dir);
|
|
763
822
|
const fourth = runState(['replan', '计划缺陷重校(上限后未授权)', '--authorized-by', '用户裁决'], dir);
|