3.7 KiB
C0-002 reconcile_generated_state
状态:done
计划:BLENDER_WASM_CORRECTIVE_TASK_PLAN
阶段:P0
Gate:G0
依赖:C0-001
lifecycleStatus:done
blockedBy:resolved in corrective staging by authorized current-worktree re-sign
writeScope:staged_generated_state
queueMutationAllowed:false
目标
以 manifest/status/task-context 为证据源,恢复 completion registry、next-task plan、task
catalog 和 task index 的可重复生成关系。正式文件只做 dry-run 比较;候选输出必须放在
tests/golden/corrective/C0-002/staged/,不能覆盖旧 queue 或旧生成物。
实施要求
新增 repository tool(建议路径:tools/web/reconcile-corrective-state.mjs),必须:
- 接收明确的 evidence root,不接收任意 guessed task number;
- 逐 task 校验 manifest、status、task-context 和 artifact hashes;
- 只将全部证据完整且 status 为
done的任务加入 completion registry; - 生成顺序固定为 completion registry -> plan -> index -> task card;
- 每个输出先写临时文件,校验成功后原子替换;
- 任一步失败时保留原文件并返回非零退出码;
- 输出 machine-readable summary,不输出完整 next-task-plan;summary 必须包含
inputDigest、issueSummary、registryComparison和repairPlan。 --write仅允许写入显式--output-root,且该路径必须位于 corrective evidence 根目录;- 输出必须带
sourceHashes、inputTaskCount、candidateActiveTask和queueMutation:false。
必须拒绝
- manifest
done但 status/context 缺失; - parent
nextTask不指向 task; - artifact hash drift;
- 多个 active task;
- 手工传入 offset、nextTask 或 completion 状态;
- 只存在 desktop negative evidence 的任务被加入 feature completion。
验收
node tools/web/reconcile-corrective-state.mjs --evidence-root tests/golden --dry-run --report tests/golden/corrective/C0-002/dry-run.json
node tools/web/reconcile-corrective-state.mjs --evidence-root tests/golden --write --output-root tests/golden/corrective/C0-002/staged --report tests/golden/corrective/C0-002/write.json
jq -e '.inputDigest and (.queueMutation == false) and (.repairPlan.approvalRequired == true)' tests/golden/corrective/C0-002/dry-run.json
jq -e '.inputDigest and (.queueMutation == false) and (.writeOutcome == "NO_FILES_WRITTEN")' tests/golden/corrective/C0-002/write.json
jq -s -e '.[0].inputDigest == .[1].inputDigest' tests/golden/corrective/C0-002/dry-run.json tests/golden/corrective/C0-002/write.json
test ! -e tests/golden/corrective/C0-002/staged/completion-registry.candidate.json
node tools/web/check-blender-next-task-plan.mjs
node tools/web/check-task-index.mjs
npm --prefix web run test:task-context
npm --prefix web run test:context-governance
node tools/web/check-context-governance.mjs
git diff --check
--dry-run 和 --write 的 inputDigest 必须一致;完整 JSON 因 mode 和 writeOutcome
不同而不要求 byte-identical。--write 不得更新
docs/EXECUTION_QUEUE.md、parent manifest 或正式 plan/index/catalog;queue 更新是 C6-003
的独立 gate。
输出
tests/golden/corrective/C0-002/reconcile-report.jsontests/golden/corrective/C0-002/reconcile-command.logtests/golden/corrective/C0-002/dry-run.json和write.json的inputDigest对比issueSummary、registryComparison和repairPlan- 生成文件的 SHA-256 清单
tests/golden/corrective/C0-002/staged/下的候选文件(不得直接复制回正式路径)
失败边界
任何生成不确定性、hash 漂移或 queue mismatch 都保持 C0-002 in_progress,清理本次
staged candidate 后不开始 C1;不得手工编辑生成物以“通过” gate。