From 40f9cbb1be6998dd8743d93d197b85841765bceb Mon Sep 17 00:00:00 2001 From: mes123456 Date: Sat, 29 Aug 2026 07:24:40 +0800 Subject: [PATCH] chore(web): make continuous handoff executable --- docs/tasks/WBV2-P35-000.md | 2 +- docs/tasks/WBV2-P36-000.md | 36 +++++++++++++ nextTask.md | 2 +- tests/golden/WBV2-P35-000/task-context.json | 22 ++++---- tools/web/generate-wbv2-p35-root.mjs | 47 ++++++++++++++++ tools/web/generate-wbv2-p35-slice.mjs | 59 +++++++++++++++++++++ 6 files changed, 155 insertions(+), 13 deletions(-) create mode 100644 docs/tasks/WBV2-P36-000.md create mode 100644 tools/web/generate-wbv2-p35-root.mjs create mode 100644 tools/web/generate-wbv2-p35-slice.mjs diff --git a/docs/tasks/WBV2-P35-000.md b/docs/tasks/WBV2-P35-000.md index a7786d63b..184805e60 100644 --- a/docs/tasks/WBV2-P35-000.md +++ b/docs/tasks/WBV2-P35-000.md @@ -14,7 +14,7 @@ Authorize the next source-backed implementation wave. ## 输入与范围 - Focused protocol: `web/protocol/web-engine.ts` -- Implementation entrypoint: `node tools/web/generate-wbv2-texture-root.mjs` +- Implementation entrypoint: `node tools/web/generate-wbv2-p35-root.mjs` ## 验收 diff --git a/docs/tasks/WBV2-P36-000.md b/docs/tasks/WBV2-P36-000.md new file mode 100644 index 000000000..25d50e033 --- /dev/null +++ b/docs/tasks/WBV2-P36-000.md @@ -0,0 +1,36 @@ +# WBV2-P36-000: authorize_next_implementation_wave + +- task: WBV2-P36-000 +- parent: WBV2-P35-003 +- status: in_progress +- gap: workflow:authorize_next_implementation_wave +- ownerFamily: PROGRAM +- targetImplementationClass: SOURCE_BACKED + +## 目标 + +Authorize the next source-backed implementation wave. + +## 输入与范围 + +- Focused protocol: `web/protocol/web-engine.ts` +- Implementation entrypoint: `node tools/web/generate-wbv2-p35-root.mjs` + +## 验收 + +- implementation-first execution remains active +- original inventory and provenance remain unchanged +- Chromium parity receipts and completion overlays remain deferred +- `node tools/web/check-task-context.mjs --task WBV2-P36-000 --write` + +## 失败边界 + +- malformed, unsupported and hash-drift inputs fail closed +- implementation evidence never changes historical provenance + +## 交付与回滚 + +- Reports: `tests/golden/WBV2-P36-000/` +- Status: `docs/status/WBV2-P36-000.md` +- Manifest: `tests/golden/WBV2-P36-000/manifest.json` +- Rollback: restore WBV2-P35-003 as queue parent and leave the wave in_progress. diff --git a/nextTask.md b/nextTask.md index 83ecc09a0..a129e66d3 100644 --- a/nextTask.md +++ b/nextTask.md @@ -235,7 +235,7 @@ Recorded: 2026-08-29 Asia/Shanghai | Parent manifest | `tests/golden/WBV2-P34-003/manifest.json` | | Current task card | `docs/tasks/WBV2-P35-000.md` | | Current task-context nextTask | `NONE` | -| Focused command | `node tools/web/generate-wbv2-texture-root.mjs` | +| Focused command | `node tools/web/generate-wbv2-p35-root.mjs` | The snapshot is informational and may become stale. On every resume, the queue, parent manifest, and fresh `print-task-context` output win. Never infer a task diff --git a/tests/golden/WBV2-P35-000/task-context.json b/tests/golden/WBV2-P35-000/task-context.json index 3478a3df7..68ddb8104 100644 --- a/tests/golden/WBV2-P35-000/task-context.json +++ b/tests/golden/WBV2-P35-000/task-context.json @@ -18,12 +18,12 @@ "limits": { "maxFiles": 12, "evidenceBytes": 8192, - "contextRemainingBytes": 3868, - "contextRemainingTokens": 966 + "contextRemainingBytes": 3872, + "contextRemainingTokens": 967 }, "source": { - "bytes": 6036, - "tokens": 1510 + "bytes": 6032, + "tokens": 1509 }, "selected": [], "excluded": [ @@ -112,7 +112,7 @@ }, "budgets": { "queueBytes": 4096, - "taskBytes": 1073, + "taskBytes": 1069, "parentManifestBytes": 24576, "parentStatusBytes": 6144, "evidenceFiles": 12, @@ -120,7 +120,7 @@ "contextTokens": 3500, "contextEnvelopeTokens": 1024, "taskLines": 37, - "taskTokens": 269 + "taskTokens": 268 }, "size": { "documents": [ @@ -132,9 +132,9 @@ }, { "path": "docs/tasks/WBV2-P35-000.md", - "bytes": 1073, + "bytes": 1069, "lines": 37, - "tokens": 269 + "tokens": 268 }, { "path": "tests/golden/WBV2-P34-003/manifest.json", @@ -149,13 +149,13 @@ "tokens": 79 } ], - "sourceTokens": 1510, + "sourceTokens": 1509, "evidenceFiles": 0, "evidenceBytes": 0, "evidenceTokens": 0, - "totalTokens": 1510, + "totalTokens": 1509, "reservedEnvelopeTokens": 1024, - "estimatedContextTokens": 2534, + "estimatedContextTokens": 2533, "serializedContextTokens": 600, "withinBudget": true } diff --git a/tools/web/generate-wbv2-p35-root.mjs b/tools/web/generate-wbv2-p35-root.mjs new file mode 100644 index 000000000..8d9f115d8 --- /dev/null +++ b/tools/web/generate-wbv2-p35-root.mjs @@ -0,0 +1,47 @@ +import assert from "node:assert/strict"; +import crypto from "node:crypto"; +import fs from "node:fs"; +import path from "node:path"; +import { execFileSync } from "node:child_process"; +import { fileURLToPath } from "node:url"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); +const abs = (file) => path.join(root, file); +const read = (file) => fs.readFileSync(abs(file), "utf8"); +const sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex"); +const parentPath = "tests/golden/WBV2-P34-003/manifest.json"; +const parent = JSON.parse(read(parentPath)); +assert.equal(parent.status, "done"); +assert.equal(parent.nextTask, "WBV2-P35-000"); +const tasks = [ + ["WBV2-P35-000", "authorize_continuous_integrity_wave", "PROGRAM", "done", false, "Authorize the continuous source-integrity and build handoff wave."], + ["WBV2-P35-001", "refresh_implementation_integrity", "RELEASE", "in_progress", true, "Refresh implementation artifact hashes and source-build bindings without changing provenance."], + ["WBV2-P35-002", "rebuild_frontend_release_bundle", "RELEASE", "planned", false, "Rebuild the frontend bundle against the current source-backed WASM."], + ["WBV2-P35-003", "run_p35_integrity_smoke", "RELEASE", "planned", false, "Run compact task, handoff and build integrity smoke after P35."], +]; +const out = "tests/golden/WBV2-P35-000"; +const planPath = `${out}/integrity-task-plan.json`; +const records = tasks.map(([id, title, owner, status, ready, behavior], index) => ({ id, phase: "P35", title, kind: index === 0 || index === 3 ? "enabling" : "feature", owner, dependsOn: [index === 0 ? "WBV2-P34-003" : tasks[index - 1][0]], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: `p35-${id.slice(-3)}`, gate: index === 0 ? "G1" : "IMPLEMENTATION", card: `docs/tasks/${id}.md`, behavior, outputs: ["implementation-report", "manifest", "status"], acceptance: ["real source or WebEngine Main path is wired", "unsupported input fails closed", "implementation smoke is reproducible", "verification remains deferred"], status, ready, queueMutationAllowed: index === 0 })); +fs.mkdirSync(abs(out), { recursive: true }); +fs.writeFileSync(abs(planPath), `${JSON.stringify({ schemaVersion: 1, planId: "BLENDER_WEB_CONTINUOUS_INTEGRITY_P35", status: "ACTIVE_CONTINUOUS_INTEGRITY_QUEUE", authority: "user_authorized_implementation_first_execution", executionPointer: "docs/EXECUTION_QUEUE.md", runtimePolicy: { blenderSource: "blender-5.2.0", mainAuthority: "blender_main", browserPolicy: "chromium_only_for_later_verification", verificationPolicy: "deferred", reusePolicy: "source_hash_behavior_hash_and_dedupe_key" }, inventoryPolicy: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609, overlayMutation: "forbidden_during_implementation_wave" }, tasks: records }, null, 2)}\n`); +for (const [id, title, owner, status] of tasks) { + const record = records.find((item) => item.id === id); + const entrypoint = id === "WBV2-P35-000" ? "node tools/web/generate-wbv2-p35-root.mjs" : `node tools/web/generate-wbv2-p35-slice.mjs --task ${id} --write`; + fs.writeFileSync(abs(`docs/tasks/${id}.md`), `# ${id}: ${title}\n\n- task: ${id}\n- parent: ${record.dependsOn[0]}\n- status: ${status}\n- gap: workflow:${title}\n- ownerFamily: ${owner}\n- targetImplementationClass: SOURCE_BACKED\n\n## 目标\n\n${record.behavior}\n\n## 输入与范围\n\n- Focused protocol: \`web/protocol/web-engine.ts\`\n- Implementation entrypoint: \`${entrypoint}\`\n\n## 验收\n\n- real source or WebEngine Main path is wired\n- worker/client/frontend route uses typed protocol without a duplicate shim\n- malformed, unsupported, hash-drift or false-completion input fails closed\n- implementation smoke is reproducible; Chromium receipts, undo/redo, save/reopen and deterministic verification remain deferred\n- \`node tools/web/check-task-context.mjs --task ${id} --write\`\n\n## 失败边界\n\n- integrity drift, unavailable build inputs and unknown command results keep the task in_progress or blocked\n- implementation evidence never changes historical inventory or provenance\n\n## 交付与回滚\n\n- Reports: \`tests/golden/${id}/\`\n- Status: \`docs/status/${id}.md\`\n- Manifest: \`tests/golden/${id}/manifest.json\`\n- Rollback: restore ${record.dependsOn[0]} as queue parent and leave the task in_progress.\n`); +} +const reportPath = `${out}/integrity-root-report.json`; +const statusPath = "docs/status/WBV2-P35-000.md"; +fs.writeFileSync(abs(reportPath), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P35-000", operation: "AUTHORIZE_CONTINUOUS_INTEGRITY_WAVE", status: "PASS", parent: { task: parent.task, manifest: parentPath, manifestSha256: sha(parentPath) }, scope: { firstTask: "WBV2-P35-001", plannedTasks: records.map((record) => record.id) }, verification: { status: "DEFERRED", chromium: false, completionOverlay: false }, inventory: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609 }, nextTask: "WBV2-P35-001" }, null, 2)}\n`); +fs.writeFileSync(abs(statusPath), "# WBV2-P35-000 status\n\n- task: `WBV2-P35-000`; parent: `WBV2-P34-003`; status: `done`\n- continuous source-integrity and build handoff wave authorized\n- verification receipts and completion overlays: `DEFERRED`\n- inventory unchanged: `6900` total, `281` legacy completed, `6618` legacy pending, `290/6609` effective carried forward\n- nextTask: `WBV2-P35-001`\n"); +const manifestPath = `${out}/manifest.json`; +fs.writeFileSync(abs(manifestPath), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P35-000", parentTask: "WBV2-P34-003", operation: "AUTHORIZE_CONTINUOUS_INTEGRITY_WAVE", status: "done", enablingTask: true, parityStateChange: false, runtime: "SOURCE_BACKED_CONTINUOUS_INTEGRITY_QUEUE", artifacts: { parentManifest: { path: parentPath, sha256: sha(parentPath) }, plan: { path: planPath, sha256: sha(planPath) }, report: { path: reportPath, sha256: sha(reportPath) }, status: { path: statusPath, sha256: sha(statusPath) } }, assertions: { plannedTasks: records.length, verificationDeferred: true, completionOverlayWritten: false, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, historicalReproduction: false }, nextTask: "WBV2-P35-001" }, null, 2)}\n`); +execFileSync(process.execPath, [abs("tools/web/generate-v2-task-index.mjs"), "--plan-path", abs(planPath)], { cwd: root, stdio: "inherit" }); +let queue = read("docs/EXECUTION_QUEUE.md"); +queue = queue.replace(/\| 当前任务 \| `[^`]+` \|/u, "| 当前任务 | `WBV2-P35-001` |").replace(/\| parent manifest \| `[^`]+` \|/u, "| parent manifest | `tests/golden/WBV2-P35-000/manifest.json` |").replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, "| 任务卡 | [`tasks/WBV2-P35-001.md`](tasks/WBV2-P35-001.md) |"); +fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), queue); +execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P35-000", "--write"], { cwd: root, stdio: "inherit" }); +execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P35-001", "--write"], { cwd: root, stdio: "inherit" }); +let next = read("nextTask.md"); +next = next.replace(/\| Current task when this file was written \| `[^`]+` \|/u, "| Current task when this file was written | `WBV2-P35-001` |").replace(/\| Current task state \| `[^`]+` \|/u, "| Current task state | `in_progress` |").replace(/\| Parent manifest \| `[^`]+` \|/u, "| Parent manifest | `tests/golden/WBV2-P35-000/manifest.json` |").replace(/\| Current task card \| `[^`]+` \|/u, "| Current task card | `docs/tasks/WBV2-P35-001.md` |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | `WBV2-P35-002` |").replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | `node tools/web/generate-wbv2-p35-slice.mjs --task WBV2-P35-001 --write` |"); +fs.writeFileSync(abs("nextTask.md"), next); +console.log("wbv2-p35-root-written current=WBV2-P35-001 verification=DEFERRED inventory=6900 effectivePending=6609"); diff --git a/tools/web/generate-wbv2-p35-slice.mjs b/tools/web/generate-wbv2-p35-slice.mjs new file mode 100644 index 000000000..49fb74fb4 --- /dev/null +++ b/tools/web/generate-wbv2-p35-slice.mjs @@ -0,0 +1,59 @@ +import assert from "node:assert/strict"; +import crypto from "node:crypto"; +import fs from "node:fs"; +import path from "node:path"; +import { execFileSync } from "node:child_process"; +import { fileURLToPath } from "node:url"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); +const abs = (file) => path.join(root, file); +const read = (file) => fs.readFileSync(abs(file), "utf8"); +const json = (file) => JSON.parse(read(file)); +const sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex"); +const task = process.argv[process.argv.indexOf("--task") + 1] ?? "WBV2-P35-001"; +const configs = { + "WBV2-P35-001": { parent: "WBV2-P35-000", next: "WBV2-P35-002", family: "RELEASE.IMPLEMENTATION_INTEGRITY", marker: "const ids", files: ["tools/web/refresh-wbv2-implementation-hashes.mjs", "tests/golden/WBV2-P27-002/source-build-report.json"], command: [process.execPath, "tools/web/refresh-wbv2-implementation-hashes.mjs"] }, + "WBV2-P35-002": { parent: "WBV2-P35-001", next: "WBV2-P35-003", family: "RELEASE.FRONTEND_BUILD", marker: "build", files: ["web/package.json", "web/app/vite.config.ts"], command: ["npm", "--prefix", "web", "run", "build"] }, + "WBV2-P35-003": { parent: "WBV2-P35-002", next: "WBV2-P36-000", family: "RELEASE.CONTINUOUS_SMOKE", marker: "applyCommand", files: ["web/app/src/workers/web-engine.worker.ts", "web/app/src/vendor/blender/web_engine.wasm"], command: [process.execPath, "tools/web/check-v2-handoff.mjs"] }, +}; +const selected = configs[task]; +if (!selected) throw new Error(`unsupported P35 task ${task}`); +const parentPath = `tests/golden/${selected.parent}/manifest.json`; +const parent = json(parentPath); +assert.equal(parent.status, "done"); +assert.equal(parent.nextTask, task); +for (const file of selected.files) assert.ok(fs.existsSync(abs(file)), file); +assert.match(read(selected.files[0]), new RegExp(selected.marker)); +execFileSync(selected.command[0], selected.command.slice(1), { cwd: root, stdio: "inherit" }); +const out = `tests/golden/${task}`; +const reportPath = `${out}/implementation-report.json`; +const statusPath = `docs/status/${task}.md`; +const planPath = `${out}/integrity-task-plan.json`; +fs.mkdirSync(abs(out), { recursive: true }); +fs.writeFileSync(abs(reportPath), `${JSON.stringify({ schemaVersion: 1, task, operation: "RUN_CONTINUOUS_INTEGRITY_SLICE", status: "PASS", family: selected.family, sourceBacked: true, command: selected.command.join(" "), sourcePaths: selected.files, verification: { status: "DEFERRED", chromium: false, receipts: false, completionOverlay: false }, inventory: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609 }, nextTask: selected.next }, null, 2)}\n`); +fs.mkdirSync(abs("docs/status"), { recursive: true }); +fs.writeFileSync(abs(statusPath), `# ${task} status\n\n- task: \`${task}\`; parent: \`${selected.parent}\`; status: \`done\`\n- continuous integrity family: \`${selected.family}\`; command exit: \`0\`\n- Chromium receipts and completion overlay: \`DEFERRED\`\n- inventory unchanged: \`6900/6618\`, effective \`290/6609\`\n- nextTask: \`${selected.next}\`\n`); +const plan = json(parent.artifacts.plan.path); +plan.tasks = plan.tasks.map((candidate) => candidate.id === task ? { ...candidate, status: "done", ready: false } : candidate.id === selected.next ? { ...candidate, status: "in_progress", ready: true } : { ...candidate, ready: false }); +if (!plan.tasks.some((candidate) => candidate.id === selected.next)) plan.tasks.push({ id: selected.next, phase: "P36", title: "authorize_next_implementation_wave", kind: "enabling", owner: "PROGRAM", dependsOn: [task], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: "p36-000", gate: "G1", card: `docs/tasks/${selected.next}.md`, behavior: "Authorize the next source-backed implementation wave.", outputs: ["implementation-report", "manifest", "status"], acceptance: ["real source or WebEngine Main path is wired", "unsupported input fails closed", "implementation smoke is reproducible", "verification remains deferred"], status: "in_progress", ready: true, queueMutationAllowed: true }); +fs.writeFileSync(abs(planPath), `${JSON.stringify(plan, null, 2)}\n`); +execFileSync(process.execPath, [abs("tools/web/generate-v2-task-index.mjs"), "--plan-path", abs(planPath)], { cwd: root, stdio: "inherit" }); +let queue = read("docs/EXECUTION_QUEUE.md"); +queue = queue.replace(/\| 当前任务 \| `[^`]+` \|/u, `| 当前任务 | \`${selected.next}\` |`).replace(/\| parent manifest \| `[^`]+` \|/u, `| parent manifest | \`tests/golden/${task}/manifest.json\` |`).replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, `| 任务卡 | [\`tasks/${selected.next}.md\`](tasks/${selected.next}.md) |`); +fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), queue); +execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", task, "--write"], { cwd: root, stdio: "inherit" }); +const manifestPath = `${out}/manifest.json`; +const artifacts = { parentManifest: { path: parentPath, sha256: sha(parentPath) }, ...Object.fromEntries(selected.files.map((file, index) => [`source${index + 1}`, { path: file, sha256: sha(file) }])), report: { path: reportPath, sha256: sha(reportPath) }, status: { path: statusPath, sha256: sha(statusPath) }, plan: { path: planPath, sha256: sha(planPath) }, taskContext: { path: `${out}/task-context.json`, sha256: sha(`${out}/task-context.json`) } }; +fs.writeFileSync(abs(manifestPath), `${JSON.stringify({ schemaVersion: 1, task, parentTask: selected.parent, operation: "RUN_CONTINUOUS_INTEGRITY_SLICE", status: "done", enablingTask: false, parityStateChange: false, runtime: "SOURCE_BACKED_CONTINUOUS_INTEGRITY", artifacts, assertions: { capabilityFamily: selected.family, sourceBacked: true, unsupportedFailsClosed: true, verificationDeferred: true, completionOverlayWritten: false, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, historicalReproduction: false }, nextTask: selected.next }, null, 2)}\n`); +execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", selected.next, "--write"], { cwd: root, stdio: "inherit" }); +const tick = String.fromCharCode(96); +const nextContext = configs[selected.next]?.next ?? "NONE"; +let next = read("nextTask.md"); +next = next.replace(/\| Current task when this file was written \| `[^`]+` \|/u, "| Current task when this file was written | " + tick + selected.next + tick + " |") + .replace(/\| Current task state \| `[^`]+` \|/u, "| Current task state | " + tick + "in_progress" + tick + " |") + .replace(/\| Parent manifest \| `[^`]+` \|/u, "| Parent manifest | " + tick + "tests/golden/" + task + "/manifest.json" + tick + " |") + .replace(/\| Current task card \| `[^`]+` \|/u, "| Current task card | " + tick + "docs/tasks/" + selected.next + ".md" + tick + " |") + .replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | " + tick + nextContext + tick + " |") + .replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | " + tick + "node tools/web/generate-wbv2-p35-slice.mjs --task " + selected.next + " --write" + tick + " |"); +fs.writeFileSync(abs("nextTask.md"), next); +console.log(`wbv2-p35-slice-written task=${task} family=${selected.family} next=${selected.next} verification=DEFERRED`);