66 lines
12 KiB
JavaScript
66 lines
12 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 sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex");
|
|
const writeJson = (file, value) => { fs.mkdirSync(path.dirname(abs(file)), { recursive: true }); fs.writeFileSync(abs(file), `${JSON.stringify(value, null, 2)}\n`); };
|
|
const parent = json("tests/golden/WBV2-P28-004/manifest.json");
|
|
assert.equal(parent.status, "done");
|
|
assert.equal(parent.nextTask, "WBV2-P28-005");
|
|
const smoke = "WBV2-P28-005";
|
|
const smokeOut = `tests/golden/${smoke}`;
|
|
const assets = fs.readdirSync(abs("web/dist/assets"));
|
|
const worker = assets.find((file) => /^web-engine\.worker-.*\.js$/u.test(file));
|
|
const wasm = assets.find((file) => /^web_engine-.*\.wasm$/u.test(file));
|
|
assert.ok(worker && wasm);
|
|
const smokeReportPath = `${smokeOut}/implementation-smoke-report.json`;
|
|
const smokeStatusPath = `docs/status/${smoke}.md`;
|
|
writeJson(smokeReportPath, { schemaVersion: 1, task: smoke, operation: "RUN_WORKBENCH_IMPLEMENTATION_SMOKE", status: "PASS", build: { command: "npm --prefix web run build", exitCode: 0, index: "web/dist/index.html", worker: `web/dist/assets/${worker}`, wasm: `web/dist/assets/${wasm}` }, implementation: { workbenchFamilies: ["GEOMETRY_NODES", "SIMULATION", "IO_RESOURCE", "RENDER_CAPABILITY"], sourceBacked: true }, verification: { status: "DEFERRED", chromium: false, completionOverlay: false }, inventory: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609 }, nextTask: "WBV2-P29-000" });
|
|
fs.mkdirSync(abs("docs/status"), { recursive: true });
|
|
fs.writeFileSync(abs(smokeStatusPath), `# ${smoke} status\n\n- task: \`${smoke}\`; parent: \`WBV2-P28-004\`; status: \`done\`\n- workbench implementation build: \`PASS\`; output includes \`${worker}\` and \`${wasm}\`\n- Chromium receipts and completion overlay: \`DEFERRED\`\n- inventory unchanged: \`6900\` total, \`281\` legacy completed, \`6618\` legacy pending, \`290/6609\` effective carried forward\n- nextTask: \`WBV2-P29-000\`\n`);
|
|
const smokePlanPath = `${smokeOut}/advanced-workbench-task-plan.json`;
|
|
const plan = json(parent.artifacts.plan.path);
|
|
plan.tasks = plan.tasks.map((candidate) => ({ ...candidate, status: candidate.id === smoke ? "done" : candidate.status, ready: false }));
|
|
writeJson(smokePlanPath, plan);
|
|
const smokeManifestPath = `${smokeOut}/manifest.json`;
|
|
writeJson(smokeManifestPath, { schemaVersion: 1, task: smoke, parentTask: "WBV2-P28-004", operation: "RUN_WORKBENCH_IMPLEMENTATION_SMOKE", status: "done", enablingTask: true, parityStateChange: false, runtime: "VITE_BUILD_AND_SOURCE_WASM_SMOKE", artifacts: { parentManifest: { path: "tests/golden/WBV2-P28-004/manifest.json", sha256: sha("tests/golden/WBV2-P28-004/manifest.json") }, report: { path: smokeReportPath, sha256: sha(smokeReportPath) }, status: { path: smokeStatusPath, sha256: sha(smokeStatusPath) }, plan: { path: smokePlanPath, sha256: sha(smokePlanPath) }, index: { path: "web/dist/index.html", sha256: sha("web/dist/index.html") }, worker: { path: `web/dist/assets/${worker}`, sha256: sha(`web/dist/assets/${worker}`) }, wasm: { path: `web/dist/assets/${wasm}`, sha256: sha(`web/dist/assets/${wasm}`) } }, assertions: { buildExitCode: 0, sourceBackedImplementation: true, verificationDeferred: true, completionOverlayWritten: false, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, historicalReproduction: false }, nextTask: "WBV2-P29-000" });
|
|
|
|
const tasks = [
|
|
["WBV2-P29-000", "authorize_native_datablock_implementation", "PROGRAM", smoke, "done", false, null, "Authorize native Blender Main datablock implementation for advanced source-backed capabilities."],
|
|
["WBV2-P29-001", "implement_geometry_nodes_native_datablock", "GEOMETRY", "WBV2-P29-000", "in_progress", true, "GEOMETRY_NODES.NATIVE_DATABLOCK", "Attach validated Geometry Node graphs to real Blender GeometryNodeTree and mesh modifier datablocks."],
|
|
["WBV2-P29-002", "implement_physics_native_datablock", "SIMULATION", "WBV2-P29-001", "planned", false, "SIMULATION.NATIVE_DATABLOCK", "Attach validated physics manifests to native Blender object/modifier data where supported."],
|
|
["WBV2-P29-003", "implement_compositor_sequencer_datablock", "RENDER", "WBV2-P29-002", "planned", false, "RENDER.COMPOSITOR_SEQUENCER_DATABLOCK", "Connect compositor and sequencer metadata to native Main data and web capability routes."],
|
|
["WBV2-P29-004", "implement_native_datablock_smoke", "RELEASE", "WBV2-P29-003", "planned", false, null, "Run bounded source build and startup smoke after native datablock implementation."],
|
|
];
|
|
const out = "tests/golden/WBV2-P29-000";
|
|
const planPath = `${out}/native-datablock-task-plan.json`;
|
|
const taskRecords = tasks.map(([id, title, owner, parentId, status, ready, parityId, behavior]) => ({ id, phase: "P29", title, kind: id.endsWith("000") || id.endsWith("004") ? "enabling" : "feature", owner, dependsOn: [parentId], parityId, implementationClass: "SOURCE_BACKED", parallelGroup: `p29-${id.slice(-3)}`, gate: id.endsWith("000") ? "G1" : "IMPLEMENTATION", card: `docs/tasks/${id}.md`, behavior, outputs: ["implementation-report", "manifest", "status"], acceptance: ["real Blender Main datablock is wired", "unsupported input fails closed", "implementation smoke is reproducible", "verification remains deferred"], status, ready, queueMutationAllowed: id.endsWith("000") }));
|
|
writeJson(planPath, { schemaVersion: 1, planId: "BLENDER_WEB_NATIVE_DATABLOCK_IMPLEMENTATION_P29", status: "ACTIVE_NATIVE_DATABLOCK_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: taskRecords });
|
|
for (const [id, title, owner, parentId, status] of tasks) {
|
|
const taskData = taskRecords.find((candidate) => candidate.id === id);
|
|
fs.writeFileSync(abs(`docs/tasks/${id}.md`), `# ${id}: ${title}\n\n- task: ${id}\n- parent: ${parentId}\n- status: ${status}\n- gap: ${taskData.parityId ?? `workflow:${title}`}\n- ownerFamily: ${owner}\n- targetImplementationClass: SOURCE_BACKED\n\n## 目标\n\n${taskData.behavior}\n\n## 输入与范围\n\n- Focused Main source: \`blender-5.2.0/source/blender/web_engine/web_engine_main_state.cpp\`\n- Focused API: \`blender-5.2.0/source/blender/web_engine/web_engine_api.cpp\`\n- Focused protocol: \`web/protocol/web-engine.ts\`\n- Implementation entrypoint: \`node tools/web/generate-wbv2-native-datablock-slice.mjs --task ${id} --write\`\n\n## 验收\n\n- real Blender Main datablock is wired and persisted by the existing save path\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- Reports: \`tests/golden/${id}/\`\n- Status: \`docs/status/${id}.md\`\n- Manifest: \`tests/golden/${id}/manifest.json\`\n- Rollback: restore ${parentId} as queue parent and leave the slice in_progress.\n`);
|
|
}
|
|
const rootReportPath = `${out}/native-datablock-root-report.json`;
|
|
writeJson(rootReportPath, { schemaVersion: 1, task: "WBV2-P29-000", operation: "AUTHORIZE_NATIVE_DATABLOCK_IMPLEMENTATION", status: "PASS", parent: { task: smoke, manifest: smokeManifestPath, manifestSha256: sha(smokeManifestPath) }, scope: { firstTask: "WBV2-P29-001", plannedTasks: tasks.map(([id]) => id), capabilityFamilies: tasks.filter(([, , , , , , parityId]) => parityId).map(([, , , , , , parityId]) => parityId) }, verification: { status: "DEFERRED", chromium: false, completionOverlay: false }, inventory: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609 }, nextTask: "WBV2-P29-001" });
|
|
const rootStatusPath = "docs/status/WBV2-P29-000.md";
|
|
fs.writeFileSync(abs(rootStatusPath), "# WBV2-P29-000 status\n\n- task: `WBV2-P29-000`; parent: `WBV2-P28-005`; status: `done`\n- native Blender datablock implementation wave authorized\n- first implementation task: `WBV2-P29-001`\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-P29-001`\n");
|
|
const rootManifestPath = `${out}/manifest.json`;
|
|
writeJson(rootManifestPath, { schemaVersion: 1, task: "WBV2-P29-000", parentTask: smoke, operation: "AUTHORIZE_NATIVE_DATABLOCK_IMPLEMENTATION", status: "done", enablingTask: true, parityStateChange: false, runtime: "SOURCE_BACKED_NATIVE_DATABLOCK_QUEUE", artifacts: { parentManifest: { path: smokeManifestPath, sha256: sha(smokeManifestPath) }, plan: { path: planPath, sha256: sha(planPath) }, report: { path: rootReportPath, sha256: sha(rootReportPath) }, rootCard: { path: "docs/tasks/WBV2-P29-000.md", sha256: sha("docs/tasks/WBV2-P29-000.md") }, rootStatus: { path: rootStatusPath, sha256: sha(rootStatusPath) } }, assertions: { nativeDatablockWave: true, plannedTasks: tasks.length, verificationDeferred: true, completionOverlayWritten: false, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, historicalReproduction: false }, nextTask: "WBV2-P29-001" });
|
|
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-P29-001` |").replace(/\| parent manifest \| `[^`]+` \|/u, "| parent manifest | `tests/golden/WBV2-P29-000/manifest.json` |").replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, "| 任务卡 | [`tasks/WBV2-P29-001.md`](tasks/WBV2-P29-001.md) |");
|
|
fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), queue);
|
|
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", smoke, "--write"], { cwd: root, stdio: "inherit" });
|
|
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P29-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-P29-001` |").replace(/\| Current task state \| `[^`]+` \|/u, "| Current task state | `in_progress` |").replace(/\| Parent manifest \| `[^`]+` \|/u, "| Parent manifest | `tests/golden/WBV2-P29-000/manifest.json` |").replace(/\| Current task card \| `[^`]+` \|/u, "| Current task card | `docs/tasks/WBV2-P29-001.md` |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | `WBV2-P29-002` |").replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | `node tools/web/generate-wbv2-native-datablock-slice.mjs --task WBV2-P29-001 --write` |");
|
|
fs.writeFileSync(abs("nextTask.md"), next);
|
|
console.log("wbv2-implementation-followup-root-written current=WBV2-P29-001 verification=DEFERRED inventory=6900 effectivePending=6609");
|