Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
278 lines
13 KiB
JavaScript
278 lines
13 KiB
JavaScript
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 writeJson = (file, value) => {
|
|
fs.mkdirSync(path.dirname(abs(file)), { recursive: true });
|
|
fs.writeFileSync(abs(file), `${JSON.stringify(value, null, 2)}\n`);
|
|
};
|
|
const writeText = (file, value) => {
|
|
fs.mkdirSync(path.dirname(abs(file)), { recursive: true });
|
|
fs.writeFileSync(abs(file), value);
|
|
};
|
|
const sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex");
|
|
const run = ([entry, ...args]) => execFileSync(process.execPath, [abs(entry), ...args], { cwd: root, stdio: "inherit" });
|
|
|
|
const rootTask = "WBV2-P1129-000";
|
|
const moduleTask = "WBV2-P1129-001";
|
|
const parentTask = "WBV2-P1128-000";
|
|
const planPath = "tests/golden/WBV2-P1100-000/module-execution-plan.json";
|
|
const parentManifestPath = `tests/golden/${parentTask}/manifest.json`;
|
|
const queuePath = "docs/EXECUTION_QUEUE.md";
|
|
const queue = read(queuePath);
|
|
const queueTask = queue.match(/\| 当前任务 \| `([^`]+)` \|/u)?.[1];
|
|
const parent = json(parentManifestPath);
|
|
const index = json("tests/golden/WBV2/task-index.json");
|
|
const plan = json(planPath);
|
|
const prepared = plan.tasks.some((task) => task.id === rootTask || task.id === moduleTask);
|
|
if (prepared) {
|
|
assert.equal(queueTask, rootTask, `expected resumable authorization checkpoint ${rootTask}, got ${queueTask}`);
|
|
assert.equal(parent.status, "done");
|
|
assert.equal(parent.nextTask, rootTask);
|
|
assert.equal(index.activeTask, moduleTask);
|
|
} else {
|
|
assert.equal(queueTask, parentTask, `expected terminal queue task ${parentTask}, got ${queueTask}`);
|
|
assert.equal(parent.status, "done");
|
|
assert.equal(parent.nextTask, null);
|
|
assert.equal(plan.status, "COMPLETED_MODULE_EXECUTION");
|
|
assert.equal(index.activeTask, null);
|
|
assert.ok(plan.tasks.every((task) => task.status === "done" && task.ready !== true));
|
|
}
|
|
|
|
const module = {
|
|
moduleId: "CORE_SCENE_GRAPH_SETTINGS",
|
|
sourceBacked: true,
|
|
capabilities: ["CAP-SCENE-COMPOSITOR-SETTINGS", "CAP-SCENE-PERFORMANCE-SETTINGS", "CAP-SCENE-SAMPLING-SETTINGS"],
|
|
sourcePaths: [
|
|
"blender-5.2.0/source/blender/web_engine/web_engine_main_state.cpp",
|
|
"blender-5.2.0/source/blender/web_engine/web_engine_main_state.h",
|
|
"blender-5.2.0/source/blender/web_engine/web_engine_api.cpp",
|
|
"web/protocol/web-engine.ts",
|
|
"web/app/src/workers/web-engine.worker.ts",
|
|
"web/app/src/app/App.tsx",
|
|
"web/tests/e2e/wbv2-scene-settings-production.spec.ts",
|
|
],
|
|
reuseReceipts: [
|
|
{ manifest: "tests/golden/WBV2-P65-002/manifest.json", report: "tests/golden/WBV2-P65-002/implementation-report.json" },
|
|
{ manifest: "tests/golden/WBV2-P66-002/manifest.json", report: "tests/golden/WBV2-P66-002/implementation-report.json" },
|
|
{ manifest: "tests/golden/WBV2-P67-002/manifest.json", report: "tests/golden/WBV2-P67-002/implementation-report.json" },
|
|
],
|
|
positive: ["compositor device/precision mutation", "performance thread/persistence mutation", "sampling filter/dither mutation"],
|
|
negative: ["invalid sampling range", "unknown scene target", "malformed property set"],
|
|
recovery: ["undo", "redo", "save/reopen", "deterministic scene settings snapshot"],
|
|
commands: [
|
|
"npm --prefix web run typecheck",
|
|
"npm --prefix web run build",
|
|
"WEB_TEST_PORT=5344 npm --prefix web run test:e2e -- --workers=1 tests/e2e/wbv2-scene-settings-production.spec.ts",
|
|
],
|
|
fullFamilyParity: false,
|
|
};
|
|
|
|
const rootRecord = {
|
|
id: rootTask,
|
|
phase: "1129",
|
|
title: "authorize_scene_settings_module",
|
|
kind: "enabling",
|
|
owner: "PROGRAM",
|
|
dependsOn: [parentTask],
|
|
parityId: null,
|
|
implementationClass: "QUEUE_ONLY",
|
|
parallelGroup: "module-root-1129",
|
|
gate: "MODULE",
|
|
card: `docs/tasks/${rootTask}.md`,
|
|
behavior: "Authorize one source-backed Core Scene Graph settings module after the terminal P1128 module epoch.",
|
|
outputs: ["successor authorization", "module plan", "manifest", "status"],
|
|
acceptance: ["P1128 evidence remains hash-bound", "existing receipts are reused", "inventory remains immutable", "one source-backed module is active"],
|
|
commands: ["node tools/web/check-execution-control-plane.mjs"],
|
|
status: "done",
|
|
ready: false,
|
|
queueMutationAllowed: true,
|
|
};
|
|
const moduleRecord = {
|
|
id: moduleTask,
|
|
phase: "1129",
|
|
title: "verify_scene_settings_module",
|
|
kind: "module",
|
|
owner: "CORE_SCENE",
|
|
dependsOn: [rootTask],
|
|
parityId: module.moduleId,
|
|
implementationClass: "LOCAL_EXACT",
|
|
parallelGroup: "module-core_scene_graph_settings",
|
|
gate: "MODULE",
|
|
card: `docs/tasks/${moduleTask}.md`,
|
|
behavior: "Verify the existing Blender Main scene compositor, performance and sampling setting transactions as one aggregate module.",
|
|
outputs: ["module receipt", "negative matrix", "manifest", "status"],
|
|
acceptance: ["source and protocol hashes are bound", "positive Main mutations are proven", "negative no-mutation and recovery are proven", "Chromium and save/reopen receipts are exact", "full-family parity remains explicit"],
|
|
status: "in_progress",
|
|
ready: true,
|
|
queueMutationAllowed: true,
|
|
module,
|
|
};
|
|
|
|
if (!prepared) {
|
|
plan.status = "ACTIVE_MODULE_EXECUTION_QUEUE";
|
|
plan.modules.push({ id: module.moduleId, task: moduleTask, owner: "CORE_SCENE", sourceBacked: true, capabilities: module.capabilities, reusedReceipts: module.reuseReceipts, fullFamilyParity: false });
|
|
plan.tasks.push(rootRecord, moduleRecord);
|
|
writeJson(planPath, plan);
|
|
run(["tools/web/generate-v2-task-index.mjs", "--plan-path", abs(planPath)]);
|
|
|
|
parent.nextTask = rootTask;
|
|
parent.continuation = { authorized: true, root: rootTask, scope: module.moduleId, priorTerminalEpoch: "WBV2-P1128-000" };
|
|
parent.artifacts.plan.sha256 = sha(planPath);
|
|
writeJson(parentManifestPath, parent);
|
|
} else {
|
|
const existingRoot = plan.tasks.find((task) => task.id === rootTask);
|
|
if (existingRoot) existingRoot.commands = rootRecord.commands;
|
|
writeJson(planPath, plan);
|
|
run(["tools/web/generate-v2-task-index.mjs", "--plan-path", abs(planPath)]);
|
|
parent.artifacts.plan.sha256 = sha(planPath);
|
|
writeJson(parentManifestPath, parent);
|
|
}
|
|
|
|
writeText(`docs/tasks/${rootTask}.md`, `# ${rootTask}: authorize scene settings module
|
|
|
|
- task: ${rootTask}
|
|
- parent: ${parentTask}
|
|
- status: done
|
|
- gap: workflow:authorize_scene_settings_module
|
|
- ownerFamily: PROGRAM
|
|
- targetImplementationClass: QUEUE_ONLY
|
|
- Implementation entrypoint: \`node tools/web/authorize-wbv2-p1129.mjs\`
|
|
|
|
## 目标
|
|
|
|
Authorize one source-backed Core Scene Graph settings module while preserving all P1128 evidence and the immutable inventory.
|
|
|
|
## 输入与范围
|
|
|
|
- Parent manifest: \`${parentManifestPath}\`
|
|
- Existing receipts: \`tests/golden/WBV2-P65-002/\`, \`tests/golden/WBV2-P66-002/\`, \`tests/golden/WBV2-P67-002/\`
|
|
- New module: \`${moduleTask}\`
|
|
|
|
## 验收
|
|
|
|
- P1128 source and receipt hashes remain bound
|
|
- existing scene-setting implementation receipts are reused without rerun
|
|
- exactly one source-backed module is active
|
|
- inventory remains \`6900\` total and effective \`290/6609\`
|
|
- missing source, unsupported capability, malformed input, hash drift or failed gate keeps the module in_progress
|
|
- node tools/web/check-execution-control-plane.mjs
|
|
|
|
## 交付与回滚
|
|
|
|
- Manifest: \`tests/golden/${rootTask}/manifest.json\`
|
|
- Rollback: restore ${parentTask} as the terminal queue parent and leave ${moduleTask} unstarted.
|
|
`);
|
|
writeText(`docs/status/${rootTask}.md`, `# ${rootTask} status
|
|
|
|
- task: \`${rootTask}\`; parent: \`${parentTask}\`; status: \`done\`
|
|
- operation: \`AUTHORIZE_SOURCE_BACKED_MODULE\`; module: \`${module.moduleId}\`
|
|
- P1128 evidence reused; no implementation or inventory mutation claimed
|
|
- nextTask: \`${moduleTask}\`
|
|
`);
|
|
|
|
let updatedQueue = read(queuePath)
|
|
.replace(/\| 当前任务 \| `[^`]+` \|/u, `| 当前任务 | \`${rootTask}\` |`)
|
|
.replace(/\| parent manifest \| `[^`]+` \|/u, `| parent manifest | \`${parentManifestPath}\` |`)
|
|
.replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, `| 任务卡 | [\`tasks/${rootTask}.md\`](tasks/${rootTask}.md) |`);
|
|
writeText(queuePath, updatedQueue);
|
|
run(["tools/web/check-task-context.mjs", "--task", rootTask, "--write"]);
|
|
|
|
const rootReportPath = `tests/golden/${rootTask}/successor-authorization-report.json`;
|
|
const rootStatusPath = `docs/status/${rootTask}.md`;
|
|
const rootContextPath = `tests/golden/${rootTask}/task-context.json`;
|
|
writeJson(rootReportPath, {
|
|
schemaVersion: 1,
|
|
task: rootTask,
|
|
operation: "AUTHORIZE_SOURCE_BACKED_MODULE",
|
|
status: "PASS",
|
|
parent: { task: parentTask, manifest: parentManifestPath, manifestSha256: sha(parentManifestPath) },
|
|
successor: { task: moduleTask, moduleId: module.moduleId, sourceBacked: true, noRepeatedImplementation: true },
|
|
inventory: plan.inventory,
|
|
nextTask: moduleTask,
|
|
});
|
|
writeJson(`tests/golden/${rootTask}/manifest.json`, {
|
|
schemaVersion: 1,
|
|
task: rootTask,
|
|
parentTask,
|
|
operation: "AUTHORIZE_SOURCE_BACKED_MODULE",
|
|
status: "done",
|
|
enablingTask: true,
|
|
parityStateChange: false,
|
|
runtime: "MODULE_EXECUTION_QUEUE_BRIDGE",
|
|
artifacts: {
|
|
parentManifest: { path: parentManifestPath, sha256: sha(parentManifestPath) },
|
|
plan: { path: planPath, sha256: sha(planPath) },
|
|
report: { path: rootReportPath, sha256: sha(rootReportPath) },
|
|
status: { path: rootStatusPath, sha256: sha(rootStatusPath) },
|
|
taskContext: { path: rootContextPath, sha256: sha(rootContextPath) },
|
|
},
|
|
assertions: { sourceBackedSuccessor: true, priorEvidencePreserved: true, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, fullHistoricalReproduction: false },
|
|
nextTask: moduleTask,
|
|
});
|
|
|
|
updatedQueue = read(queuePath)
|
|
.replace(/\| 当前任务 \| `[^`]+` \|/u, `| 当前任务 | \`${moduleTask}\` |`)
|
|
.replace(/\| parent manifest \| `[^`]+` \|/u, `| parent manifest | \`tests/golden/${rootTask}/manifest.json\` |`)
|
|
.replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, `| 任务卡 | [\`tasks/${moduleTask}.md\`](tasks/${moduleTask}.md) |`);
|
|
writeText(queuePath, updatedQueue);
|
|
writeText(`docs/tasks/${moduleTask}.md`, `# ${moduleTask}: verify scene settings module
|
|
|
|
- task: ${moduleTask}
|
|
- parent: ${rootTask}
|
|
- status: in_progress
|
|
- gap: workflow:core_scene_graph_settings
|
|
- ownerFamily: CORE_SCENE
|
|
- targetImplementationClass: LOCAL_EXACT
|
|
- moduleId: ${module.moduleId}
|
|
- Implementation entrypoint: \`node tools/web/run-wbv2-module-task.mjs --task ${moduleTask} --write\`
|
|
|
|
## 目标
|
|
|
|
Verify the existing Blender Main compositor, performance and sampling setting transactions as one source-backed module. This adds aggregate production evidence without duplicating the P1128 movie implementation or older scene-setting receipts.
|
|
|
|
## 输入与范围
|
|
|
|
- Source paths:
|
|
${module.sourcePaths.map((file) => `- \`${file}\``).join("\n")}
|
|
- Reused receipts:
|
|
${module.reuseReceipts.map((item) => `- \`${item.manifest}\` + \`${item.report}\``).join("\n")}
|
|
- Production test: \`web/tests/e2e/wbv2-scene-settings-production.spec.ts\`
|
|
|
|
## 验收
|
|
|
|
- Positive: ${module.positive.join(", ")}
|
|
- Negative: ${module.negative.join(", ")}
|
|
- Recovery: ${module.recovery.join(", ")}
|
|
- Commands:
|
|
${module.commands.map((command) => `- \`${command}\``).join("\n")}
|
|
- Missing source, hash drift, malformed input or browser failure remains in_progress and does not advance the queue.
|
|
|
|
## 交付与回滚
|
|
|
|
- Receipt: \`tests/golden/${moduleTask}/module-receipt.json\`
|
|
- Manifest: \`tests/golden/${moduleTask}/manifest.json\`
|
|
- Status: \`docs/status/${moduleTask}.md\`
|
|
- Rollback: restore ${rootTask} as the queue parent and leave this module in_progress.
|
|
`);
|
|
run(["tools/web/check-task-context.mjs", "--task", moduleTask, "--write"]);
|
|
|
|
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}${moduleTask}${tick} |`)
|
|
.replace(/\| Current task state \| `[^`]+` \|/u, `| Current task state | ${tick}in_progress${tick} |`)
|
|
.replace(/\| Parent manifest \| `[^`]+` \|/u, `| Parent manifest | ${tick}tests/golden/${rootTask}/manifest.json${tick} |`)
|
|
.replace(/\| Current task card \| `[^`]+` \|/u, `| Current task card | ${tick}docs/tasks/${moduleTask}.md${tick} |`)
|
|
.replace(/\| Current task-context nextTask \| `[^`]+` \|/u, `| Current task-context nextTask | ${tick}NONE${tick} |`)
|
|
.replace(/\| Focused command \| `[^`]+` \|/u, `| Focused command | ${tick}node tools/web/run-wbv2-module-task.mjs --task ${moduleTask} --write${tick} |`);
|
|
writeText("nextTask.md", next);
|
|
process.stdout.write(`wbv2-successor-authorized root=${rootTask} next=${moduleTask} module=${module.moduleId}\n`);
|