chore(web): add generic continuous queue runner
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

This commit is contained in:
mes123456
2026-08-29 07:39:28 +08:00
parent ab9944275e
commit d4c58b45b2
58 changed files with 3735 additions and 42 deletions

View File

@@ -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 sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex");
const queue = read("docs/EXECUTION_QUEUE.md");
const taskArgIndex = process.argv.indexOf("--task");
const task = taskArgIndex >= 0 ? process.argv[taskArgIndex + 1] : queue.match(/\| 当前任务 \| `(WBV2-P\d+-\d+)` \|/u)?.[1];
if (!task) throw new Error("continuous root requires a WBV2 task pointer");
const match = task.match(/^WBV2-P(\d+)-000$/u);
if (!match) throw new Error(`continuous root only handles -000 tasks: ${task}`);
const phase = Number(match[1]);
const parentPath = queue.match(/\| parent manifest \| `([^`]+)` \|/u)?.[1];
if (!parentPath) throw new Error("continuous root cannot resolve parent manifest");
const parent = JSON.parse(read(parentPath));
assert.equal(parent.status, "done");
assert.equal(parent.nextTask, task);
const nextPhase = phase + 1;
const nextRoot = `WBV2-P${nextPhase}-000`;
const ids = [`WBV2-P${phase}-000`, `WBV2-P${phase}-001`, `WBV2-P${phase}-002`, `WBV2-P${phase}-003`];
const behaviors = ["Authorize the next continuous source implementation wave.", "Refresh implementation hashes and source-build bindings.", "Rebuild the frontend release bundle from the current source-backed WASM.", "Run compact handoff and build integrity smoke."];
const owners = ["PROGRAM", "RELEASE", "RELEASE", "RELEASE"];
const records = ids.map((id, index) => ({ id, phase: `P${phase}`, title: index === 0 ? "authorize_continuous_wave" : index === 1 ? "refresh_continuous_integrity" : index === 2 ? "rebuild_continuous_bundle" : "run_continuous_smoke", kind: index === 0 || index === 3 ? "enabling" : "feature", owner: owners[index], dependsOn: [index === 0 ? parent.task : ids[index - 1]], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: `p${phase}-${String(index).padStart(3, "0")}`, gate: index === 0 ? "G1" : "IMPLEMENTATION", card: `docs/tasks/${id}.md`, behavior: behaviors[index], 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: index === 0 ? "done" : index === 1 ? "in_progress" : "planned", ready: index === 1, queueMutationAllowed: index === 0 }));
const out = `tests/golden/${task}`;
const planPath = `${out}/continuous-task-plan.json`;
fs.mkdirSync(abs(out), { recursive: true });
fs.writeFileSync(abs(planPath), `${JSON.stringify({ schemaVersion: 1, planId: `BLENDER_WEB_CONTINUOUS_P${phase}`, status: "ACTIVE_CONTINUOUS_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`);
const reportPath = `${out}/continuous-root-report.json`;
const statusPath = `docs/status/${task}.md`;
fs.mkdirSync(abs("docs/status"), { recursive: true });
fs.writeFileSync(abs(reportPath), `${JSON.stringify({ schemaVersion: 1, task, operation: "AUTHORIZE_CONTINUOUS_IMPLEMENTATION_WAVE", status: "PASS", parent: { task: parent.task, manifest: parentPath, manifestSha256: sha(parentPath) }, scope: { firstTask: ids[1], plannedTasks: ids }, verification: { status: "DEFERRED", chromium: false, completionOverlay: false }, inventory: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609 }, nextTask: ids[1] }, null, 2)}\n`);
fs.writeFileSync(abs(statusPath), `# ${task} status\n\n- task: \`${task}\`; parent: \`${parent.task}\`; status: \`done\`\n- continuous implementation wave authorized\n- verification receipts and completion overlay: \`DEFERRED\`\n- inventory unchanged: \`6900/6618\`, effective \`290/6609\`\n- nextTask: \`${ids[1]}\`\n`);
for (const [index, id] of ids.entries()) {
const card = `docs/tasks/${id}.md`;
if (index === 0 && id === task) continue;
fs.writeFileSync(abs(card), `# ${id}: ${records[index].title}\n\n- task: ${id}\n- parent: ${records[index].dependsOn[0]}\n- status: ${records[index].status}\n- gap: workflow:${records[index].title}\n- ownerFamily: ${records[index].owner}\n- targetImplementationClass: SOURCE_BACKED\n\n## 目标\n\n${records[index].behavior}\n\n## 输入与范围\n\n- Focused protocol: \`web/protocol/web-engine.ts\`\n- Implementation entrypoint: \`node tools/web/generate-wbv2-continuous-slice.mjs --task ${id} --write\`\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 ${records[index].dependsOn[0]} as queue parent and leave the task in_progress.\n`);
}
const nextCard = `docs/tasks/${nextRoot}.md`;
fs.writeFileSync(abs(nextCard), `# ${nextRoot}: authorize_continuous_wave\n\n- task: ${nextRoot}\n- parent: ${ids[3]}\n- status: in_progress\n- gap: workflow:authorize_continuous_wave\n- ownerFamily: PROGRAM\n- targetImplementationClass: SOURCE_BACKED\n\n## 目标\n\nAuthorize the next source-backed implementation wave.\n\n## 输入与范围\n\n- Focused protocol: \`web/protocol/web-engine.ts\`\n- Implementation entrypoint: \`node tools/web/generate-wbv2-continuous-root.mjs\`\n\n## 验收\n\n- implementation-first execution remains active\n- original inventory and provenance remain unchanged\n- Chromium parity receipts and completion overlays remain deferred\n- \`node tools/web/check-task-context.mjs --task ${nextRoot} --write\`\n\n## 失败边界\n\n- malformed, unsupported and hash-drift inputs fail closed\n- implementation evidence never changes historical provenance\n\n## 交付与回滚\n\n- Reports: \`tests/golden/${nextRoot}/\`\n- Status: \`docs/status/${nextRoot}.md\`\n- Manifest: \`tests/golden/${nextRoot}/manifest.json\`\n- Rollback: restore ${ids[3]} as queue parent and leave the wave in_progress.\n`);
records.push({ id: nextRoot, phase: `P${nextPhase}`, title: "authorize_continuous_wave", kind: "enabling", owner: "PROGRAM", dependsOn: [ids[3]], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: `p${nextPhase}-000`, gate: "G1", card: nextCard, 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 });
const manifestPath = `${out}/manifest.json`;
fs.writeFileSync(abs(manifestPath), `${JSON.stringify({ schemaVersion: 1, task, parentTask: parent.task, operation: "AUTHORIZE_CONTINUOUS_IMPLEMENTATION_WAVE", status: "done", enablingTask: true, parityStateChange: false, runtime: "SOURCE_BACKED_CONTINUOUS_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: ids[1] }, null, 2)}\n`);
execFileSync(process.execPath, [abs("tools/web/generate-v2-task-index.mjs"), "--plan-path", abs(planPath)], { cwd: root, stdio: "inherit" });
let updatedQueue = read("docs/EXECUTION_QUEUE.md");
updatedQueue = updatedQueue.replace(/\| 当前任务 \| `[^`]+` \|/u, `| 当前任务 | \`${ids[1]}\` |`).replace(/\| parent manifest \| `[^`]+` \|/u, `| parent manifest | \`tests/golden/${task}/manifest.json\` |`).replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, `| 任务卡 | [\`tasks/${ids[1]}.md\`](tasks/${ids[1]}.md) |`);
fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), updatedQueue);
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", task, "--write"], { cwd: root, stdio: "inherit" });
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", ids[1], "--write"], { cwd: root, stdio: "inherit" });
let next = read("nextTask.md");
const tick = String.fromCharCode(96);
next = next.replace(/\| Current task when this file was written \| `[^`]+` \|/u, "| Current task when this file was written | " + tick + ids[1] + 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/" + ids[1] + ".md" + tick + " |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | " + tick + ids[2] + tick + " |").replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | " + tick + "node tools/web/generate-wbv2-continuous-slice.mjs --task " + ids[1] + " --write" + tick + " |");
fs.writeFileSync(abs("nextTask.md"), next);
console.log(`wbv2-continuous-root-written task=${task} next=${ids[1]} successor=${nextRoot} verification=DEFERRED`);

View File

@@ -0,0 +1,67 @@
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];
if (!task) throw new Error("continuous slice requires --task WBV2-P<phase>-<slice>");
const match = task.match(/^WBV2-P(\d+)-(00[1-3])$/u);
if (!match) throw new Error(`continuous slice only handles -001..-003 tasks: ${task}`);
const phase = Number(match[1]);
const index = Number(match[2]);
const queue = read("docs/EXECUTION_QUEUE.md");
const current = queue.match(/\| 当前任务 \| `(WBV2-P\d+-\d+)` \|/u)?.[1];
assert.equal(current, task);
const parentPath = queue.match(/\| parent manifest \| `([^`]+)` \|/u)?.[1];
if (!parentPath) throw new Error("continuous slice cannot resolve parent manifest");
const parent = json(parentPath);
assert.equal(parent.status, "done");
assert.equal(parent.nextTask, task);
const commands = {
1: [process.execPath, "tools/web/refresh-wbv2-implementation-hashes.mjs"],
2: ["npm", "--prefix", "web", "run", "build"],
3: [process.execPath, "tools/web/check-v2-handoff.mjs"],
};
const files = {
1: ["tools/web/refresh-wbv2-implementation-hashes.mjs"],
2: ["web/package.json", "web/app/vite.config.ts"],
3: ["web/app/src/workers/web-engine.worker.ts", "web/app/src/vendor/blender/web_engine.wasm"],
};
for (const file of files[index]) assert.ok(fs.existsSync(abs(file)), file);
execFileSync(commands[index][0], commands[index].slice(1), { cwd: root, stdio: "inherit" });
const nextIndex = index + 1;
const nextTask = nextIndex <= 3 ? `WBV2-P${phase}-${String(nextIndex).padStart(3, "0")}` : `WBV2-P${phase + 1}-000`;
const out = `tests/golden/${task}`;
const reportPath = `${out}/implementation-report.json`;
const statusPath = `docs/status/${task}.md`;
const planPath = `${out}/continuous-task-plan.json`;
fs.mkdirSync(abs(out), { recursive: true });
fs.writeFileSync(abs(reportPath), `${JSON.stringify({ schemaVersion: 1, task, operation: "RUN_CONTINUOUS_IMPLEMENTATION_SLICE", status: "PASS", family: index === 1 ? "RELEASE.INTEGRITY_REFRESH" : index === 2 ? "RELEASE.BUNDLE_BUILD" : "RELEASE.HANDOFF_SMOKE", command: commands[index].join(" "), sourcePaths: files[index], verification: { status: "DEFERRED", chromium: false, receipts: false, completionOverlay: false }, inventory: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609 }, nextTask }, null, 2)}\n`);
fs.mkdirSync(abs("docs/status"), { recursive: true });
fs.writeFileSync(abs(statusPath), `# ${task} status\n\n- task: \`${task}\`; parent: \`${parent.task}\`; status: \`done\`\n- continuous slice command exit: \`0\`\n- Chromium receipts and completion overlay: \`DEFERRED\`\n- inventory unchanged: \`6900/6618\`, effective \`290/6609\`\n- nextTask: \`${nextTask}\`\n`);
const plan = json(parent.artifacts.plan.path);
plan.tasks = plan.tasks.map((candidate) => candidate.id === task ? { ...candidate, status: "done", ready: false } : candidate.id === nextTask ? { ...candidate, status: "in_progress", ready: true } : { ...candidate, ready: false });
if (!plan.tasks.some((candidate) => candidate.id === nextTask)) plan.tasks.push({ id: nextTask, phase: `P${phase + 1}`, title: "authorize_continuous_wave", kind: "enabling", owner: "PROGRAM", dependsOn: [task], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: `p${phase + 1}-000`, gate: "G1", card: `docs/tasks/${nextTask}.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`);
if (nextIndex > 3) fs.writeFileSync(abs(`docs/tasks/${nextTask}.md`), `# ${nextTask}: authorize_continuous_wave\n\n- task: ${nextTask}\n- parent: ${task}\n- status: in_progress\n- gap: workflow:authorize_continuous_wave\n- ownerFamily: PROGRAM\n- targetImplementationClass: SOURCE_BACKED\n\n## 目标\n\nAuthorize the next source-backed implementation wave.\n\n## 输入与范围\n\n- Focused protocol: \`web/protocol/web-engine.ts\`\n- Implementation entrypoint: \`node tools/web/generate-wbv2-continuous-root.mjs\`\n\n## 验收\n\n- implementation-first execution remains active\n- original inventory and provenance remain unchanged\n- Chromium parity receipts and completion overlays remain deferred\n- \`node tools/web/check-task-context.mjs --task ${nextTask} --write\`\n\n## 失败边界\n\n- malformed, unsupported and hash-drift inputs fail closed\n- implementation evidence never changes historical provenance\n\n## 交付与回滚\n\n- Reports: \`tests/golden/${nextTask}/\`\n- Status: \`docs/status/${nextTask}.md\`\n- Manifest: \`tests/golden/${nextTask}/manifest.json\`\n- Rollback: restore ${task} as queue parent and leave the wave in_progress.\n`);
execFileSync(process.execPath, [abs("tools/web/generate-v2-task-index.mjs"), "--plan-path", abs(planPath)], { cwd: root, stdio: "inherit" });
let updatedQueue = read("docs/EXECUTION_QUEUE.md");
updatedQueue = updatedQueue.replace(/\| 当前任务 \| `[^`]+` \|/u, `| 当前任务 | \`${nextTask}\` |`).replace(/\| parent manifest \| `[^`]+` \|/u, `| parent manifest | \`tests/golden/${task}/manifest.json\` |`).replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, `| 任务卡 | [\`tasks/${nextTask}.md\`](tasks/${nextTask}.md) |`);
fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), updatedQueue);
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(files[index].map((file, item) => [`source${item + 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: parent.task, operation: "RUN_CONTINUOUS_IMPLEMENTATION_SLICE", status: "done", enablingTask: false, parityStateChange: false, runtime: "SOURCE_BACKED_CONTINUOUS_QUEUE", artifacts, assertions: { capabilityFamily: index === 1 ? "RELEASE.INTEGRITY_REFRESH" : index === 2 ? "RELEASE.BUNDLE_BUILD" : "RELEASE.HANDOFF_SMOKE", sourceBacked: true, unsupportedFailsClosed: true, verificationDeferred: true, completionOverlayWritten: false, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, historicalReproduction: false }, nextTask }, null, 2)}\n`);
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", nextTask, "--write"], { cwd: root, stdio: "inherit" });
const tick = String.fromCharCode(96);
let next = read("nextTask.md");
next = next.replace(/\| Current task when this file was written \| `[^`]+` \|/u, "| Current task when this file was written | " + tick + nextTask + 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/" + nextTask + ".md" + tick + " |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | " + tick + (nextIndex > 3 ? "NONE" : `WBV2-P${phase}-${String(nextIndex + 1).padStart(3, "0")}`) + tick + " |").replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | " + tick + (nextIndex > 3 ? "node tools/web/generate-wbv2-continuous-root.mjs" : `node tools/web/generate-wbv2-continuous-slice.mjs --task ${nextTask} --write`) + tick + " |");
fs.writeFileSync(abs("nextTask.md"), next);
console.log(`wbv2-continuous-slice-written task=${task} next=${nextTask} verification=DEFERRED`);

View File

@@ -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-P35-003/manifest.json";
const parent = JSON.parse(read(parentPath));
assert.equal(parent.status, "done");
assert.equal(parent.nextTask, "WBV2-P36-000");
const tasks = [
["WBV2-P36-000", "authorize_continuous_release_wave", "PROGRAM", "done", false, "Authorize the next continuous source-integrity release wave."],
["WBV2-P36-001", "refresh_release_integrity", "RELEASE", "in_progress", true, "Refresh all implementation artifact hashes and source-build bindings."],
["WBV2-P36-002", "rebuild_release_bundle", "RELEASE", "planned", false, "Rebuild the frontend release bundle from the current source-backed WASM."],
["WBV2-P36-003", "run_p36_release_smoke", "RELEASE", "planned", false, "Run compact handoff and build integrity smoke after P36."],
];
const out = "tests/golden/WBV2-P36-000";
const planPath = `${out}/release-task-plan.json`;
const records = tasks.map(([id, title, owner, status, ready, behavior], index) => ({ id, phase: "P36", title, kind: index === 0 || index === 3 ? "enabling" : "feature", owner, dependsOn: [index === 0 ? "WBV2-P35-003" : tasks[index - 1][0]], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: `p36-${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_RELEASE_P36", status: "ACTIVE_CONTINUOUS_RELEASE_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-P36-000" ? "node tools/web/generate-wbv2-p36-root.mjs" : `node tools/web/generate-wbv2-p36-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}/release-root-report.json`;
const statusPath = "docs/status/WBV2-P36-000.md";
fs.writeFileSync(abs(reportPath), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P36-000", operation: "AUTHORIZE_CONTINUOUS_RELEASE_WAVE", status: "PASS", parent: { task: parent.task, manifest: parentPath, manifestSha256: sha(parentPath) }, scope: { firstTask: "WBV2-P36-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-P36-001" }, null, 2)}\n`);
fs.writeFileSync(abs(statusPath), "# WBV2-P36-000 status\n\n- task: `WBV2-P36-000`; parent: `WBV2-P35-003`; status: `done`\n- continuous release integrity 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-P36-001`\n");
const manifestPath = `${out}/manifest.json`;
fs.writeFileSync(abs(manifestPath), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P36-000", parentTask: "WBV2-P35-003", operation: "AUTHORIZE_CONTINUOUS_RELEASE_WAVE", status: "done", enablingTask: true, parityStateChange: false, runtime: "SOURCE_BACKED_CONTINUOUS_RELEASE_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-P36-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-P36-001` |").replace(/\| parent manifest \| `[^`]+` \|/u, "| parent manifest | `tests/golden/WBV2-P36-000/manifest.json` |").replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, "| 任务卡 | [`tasks/WBV2-P36-001.md`](tasks/WBV2-P36-001.md) |");
fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), queue);
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P36-000", "--write"], { cwd: root, stdio: "inherit" });
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P36-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-P36-001` |").replace(/\| Current task state \| `[^`]+` \|/u, "| Current task state | `in_progress` |").replace(/\| Parent manifest \| `[^`]+` \|/u, "| Parent manifest | `tests/golden/WBV2-P36-000/manifest.json` |").replace(/\| Current task card \| `[^`]+` \|/u, "| Current task card | `docs/tasks/WBV2-P36-001.md` |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | `WBV2-P36-002` |").replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | `node tools/web/generate-wbv2-p36-slice.mjs --task WBV2-P36-001 --write` |");
fs.writeFileSync(abs("nextTask.md"), next);
console.log("wbv2-p36-root-written current=WBV2-P36-001 verification=DEFERRED inventory=6900 effectivePending=6609");

View File

@@ -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-P36-001";
const configs = {
"WBV2-P36-001": { parent: "WBV2-P36-000", next: "WBV2-P36-002", family: "RELEASE.INTEGRITY_REFRESH", 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-P36-002": { parent: "WBV2-P36-001", next: "WBV2-P36-003", family: "RELEASE.BUNDLE_BUILD", marker: "build", files: ["web/package.json", "web/app/vite.config.ts"], command: ["npm", "--prefix", "web", "run", "build"] },
"WBV2-P36-003": { parent: "WBV2-P36-002", next: "WBV2-P37-000", family: "RELEASE.HANDOFF_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 P36 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}/release-task-plan.json`;
fs.mkdirSync(abs(out), { recursive: true });
fs.writeFileSync(abs(reportPath), `${JSON.stringify({ schemaVersion: 1, task, operation: "RUN_CONTINUOUS_RELEASE_SLICE", status: "PASS", family: selected.family, command: selected.command.join(" "), sourcePaths: selected.files, verification: { status: "DEFERRED", chromium: 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 release 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: "P37", title: "authorize_next_implementation_wave", kind: "enabling", owner: "PROGRAM", dependsOn: [task], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: "p37-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_RELEASE_SLICE", status: "done", enablingTask: false, parityStateChange: false, runtime: "SOURCE_BACKED_CONTINUOUS_RELEASE", 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-p36-slice.mjs --task " + selected.next + " --write" + tick + " |");
fs.writeFileSync(abs("nextTask.md"), next);
console.log(`wbv2-p36-slice-written task=${task} family=${selected.family} next=${selected.next} verification=DEFERRED`);