Files
workinf_Blender_Wasm/tools/web/generate-wbv2-geometry-nodes-receipt.mjs
mes123456 ea18416ff2
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
Advance WBV2 high-value domains through P13
2026-08-28 07:11:47 +08:00

46 lines
7.2 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 write = process.argv.includes("--write");
const absolute = (file) => path.join(root, file);
const read = (file) => fs.readFileSync(absolute(file), "utf8");
const json = (file) => JSON.parse(read(file));
const sha256 = (file) => crypto.createHash("sha256").update(fs.readFileSync(absolute(file))).digest("hex");
const outputRoot = "tests/golden/WBV2-P13-002";
const productionPath = `${outputRoot}/geometry-nodes-production.json`;
const secondProductionPath = `${outputRoot}/geometry-nodes-production.second.json`;
const reportPath = `${outputRoot}/geometry-nodes-receipt-report.json`;
const statusPath = "docs/status/WBV2-P13-002.md";
const planPath = `${outputRoot}/high-value-task-plan.json`;
const manifestPath = `${outputRoot}/manifest.json`;
const parentPath = "tests/golden/WBV2-P13-001/manifest.json";
const sourceManifestPath = "tests/golden/WBV2-P4-002/manifest.json";
const sourceReportPath = "tests/golden/WBV2-P4-002/nodes-report.json";
const parent = json(parentPath);
assert.equal(parent.status, "done"); assert.equal(parent.nextTask, "WBV2-P13-002");
for (const artifact of Object.values(parent.artifacts ?? {})) assert.equal(sha256(artifact.path), artifact.sha256, artifact.path);
const sourceManifest = json(sourceManifestPath); const sourceReport = json(sourceReportPath);
assert.equal(sourceManifest.status, "done"); assert.equal(sourceReport.desktop.status, "EXACT"); assert.equal(sourceReport.wasm.status, "EXACT");
const sourceBound = Object.values(sourceManifest.artifacts ?? {}).find((artifact) => artifact.path === sourceReportPath); assert.ok(sourceBound); assert.equal(sourceBound.sha256, sha256(sourceReportPath));
assert.equal(sha256(productionPath), sha256(secondProductionPath));
const production = json(productionPath);
assert.equal(production.task, "WBV2-P13-002"); assert.equal(production.browser, "chromium"); assert.equal(production.queueMutation, false);
assert.equal(production.graphCount, 3); assert.equal(production.hashesBefore.length, 3); assert.deepEqual(production.hashesBefore, production.hashesAfter); assert.equal(production.saveReopenExact, true); assert.equal(production.afterRevision, production.baseRevision); assert.notEqual(production.attempt.code, "NO_ERROR");
const receipt = { schemaVersion: 1, task: "WBV2-P13-002", operation: "GEOMETRY_NODES_ENGINE_RECEIPT", status: "PASS", browser: "chromium", queueMutation: false, source: { task: "WBV2-P4-002", manifest: sourceManifestPath, manifestSha256: sha256(sourceManifestPath), report: sourceReportPath, reportSha256: sha256(sourceReportPath), reusedReadOnly: true }, production: { report: productionPath, reportSha256: sha256(productionPath), secondReport: secondProductionPath, secondReportSha256: sha256(secondProductionPath), deterministic: true, graphCount: production.graphCount, hashes: production.hashesBefore, unsupportedGraph: production.unsupportedName, unsupportedAttempt: production.attempt, saveReopen: "EXACT", revisionPreserved: production.afterRevision === production.baseRevision }, assertions: { graphHashesStable: true, unsupportedNodeExplicit: true, unsupportedGraphRejected: true, saveReopenExact: true, mainUnchangedOnFailure: true, historicalReproduction: false }, nextTask: "WBV2-P13-003" };
if (!write) { process.stdout.write("wbv2-geometry-nodes-receipt-ok task=WBV2-P13-002 graphs=3 hashes=EXACT unsupported=REJECTED saveReopen=EXACT deterministic=true next=WBV2-P13-003\n"); process.exit(0); }
fs.mkdirSync(absolute(outputRoot), { recursive: true }); fs.writeFileSync(absolute(reportPath), `${JSON.stringify(receipt, null, 2)}\n`);
fs.writeFileSync(absolute(statusPath), `# WBV2-P13-002 status\n\n- task: \`WBV2-P13-002\`; parent: \`WBV2-P13-001\`; status: \`done\`\n- graph count: \`3\`; graph hashes: stable\n- unsupported Simulation graph: rejected before Main mutation\n- save/reopen: \`EXACT\`; repeated execution: deterministic\n- nextTask: \`WBV2-P13-003\`\n\nExisting P4-002 Geometry Nodes evidence is reused read-only. The production Chromium test loads the actual WebEngine WASM Main, verifies stable graph hashes and unsupported-node retention, and rejects an unsupported graph without changing revision.\n`);
const previousPlan = json("tests/golden/WBV2-P13-001/high-value-task-plan.json"); const nextPlan = structuredClone(previousPlan); nextPlan.parentRecoveryPlan = { path: "tests/golden/WBV2-P13-001/high-value-task-plan.json", sha256: sha256("tests/golden/WBV2-P13-001/high-value-task-plan.json") }; nextPlan.tasks = nextPlan.tasks.map((task) => task.id === "WBV2-P13-002" ? { ...task, status: "done", ready: false } : task.id === "WBV2-P13-003" ? { ...task, status: "in_progress", ready: true } : { ...task, ready: false }); fs.writeFileSync(absolute(planPath), `${JSON.stringify(nextPlan, null, 2)}\n`);
fs.writeFileSync(absolute("docs/tasks/WBV2-P13-003.md"), read("docs/tasks/WBV2-P13-003.md").replace("- status: planned", "- status: in_progress"));
execFileSync(process.execPath, [absolute("tools/web/generate-v2-task-index.mjs"), "--plan-path", absolute(planPath)], { cwd: root, stdio: "inherit" }); execFileSync(process.execPath, [absolute("tools/web/check-task-context.mjs"), "--task", "WBV2-P13-002", "--write"], { cwd: root, stdio: "inherit" });
const artifactPaths = { parentManifest: parentPath, sourceManifest: sourceManifestPath, sourceReport: sourceReportPath, production: productionPath, productionSecond: secondProductionPath, e2e: "web/tests/e2e/wbv2-geometry-nodes-production.spec.ts", client: "web/app/src/engine-client/WebEngineClient.ts", nativeApi: "blender-5.2.0/source/blender/web_engine/web_engine_api.cpp", generator: "tools/web/generate-wbv2-geometry-nodes-receipt.mjs", report: reportPath, status: statusPath, parityPlan: planPath, taskContext: `${outputRoot}/task-context.json` }; const artifacts = Object.fromEntries(Object.entries(artifactPaths).map(([name, file]) => [name, { path: file, sha256: sha256(file) }])); const manifest = { schemaVersion: 1, task: "WBV2-P13-002", parentTask: "WBV2-P13-001", operation: "GEOMETRY_NODES_ENGINE_RECEIPT", status: "done", enablingTask: false, parityStateChange: true, runtime: "PLAYWRIGHT_CHROMIUM_WEBENGINE_WASM", artifacts, assertions: { graphs: 3, stableHashes: true, unsupportedRejected: true, saveReopen: "EXACT", revisionPreservedOnFailure: true, deterministic: true, historicalReproduction: false }, nextTask: "WBV2-P13-003" }; fs.writeFileSync(absolute(manifestPath), `${JSON.stringify(manifest, null, 2)}\n`);
let queue = read("docs/EXECUTION_QUEUE.md"); queue = queue.replace(/\| 当前任务 \| `[^`]+` \|/u, "| 当前任务 | `WBV2-P13-003` |").replace(/\| parent manifest \| `[^`]+` \|/u, "| parent manifest | `tests/golden/WBV2-P13-002/manifest.json` |").replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, "| 任务卡 | [`tasks/WBV2-P13-003.md`](tasks/WBV2-P13-003.md) |"); fs.writeFileSync(absolute("docs/EXECUTION_QUEUE.md"), queue);
process.stdout.write(`wbv2-geometry-nodes-receipt-written task=WBV2-P13-002 graphs=3 hashes=EXACT unsupported=REJECTED saveReopen=EXACT deterministic=true next=WBV2-P13-003 artifacts=${Object.keys(artifacts).length}\n`);