44 lines
13 KiB
JavaScript
44 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 sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex");
|
|
const p23Path = "tests/golden/WBV2-P23-003/manifest.json";
|
|
const p23ReportPath = "tests/golden/WBV2-P23-003/object-transform-gate-report.json";
|
|
const out = "tests/golden/WBV2-P24-000";
|
|
const planPath = `${out}/move-task-plan.json`;
|
|
const reportPath = `${out}/move-root-report.json`;
|
|
const manifestPath = `${out}/manifest.json`;
|
|
const statusPath = "docs/status/WBV2-P24-000.md";
|
|
const inventoryPath = "tests/golden/WBV2-P0-002/parity-map.json";
|
|
const apiPath = "blender-5.2.0/source/blender/web_engine/web_engine_api.cpp";
|
|
const protocolPath = "web/protocol/web-engine.ts";
|
|
const clientPath = "web/app/src/engine-client/WebEngineClient.ts";
|
|
|
|
const p23 = json(p23Path); const p23Report = json(p23ReportPath); const inventory = json(inventoryPath);
|
|
assert.equal(p23.status, "done"); assert.ok(p23.nextTask === null || p23.nextTask === "WBV2-P24-000"); assert.equal(p23Report.status, "PASS"); assert.equal(p23Report.decision.effectivePending, 6609); assert.equal(inventory.summary.inventoryEntries, 6900); for (const artifact of Object.values(p23.artifacts ?? {})) assert.equal(sha(artifact.path), artifact.sha256, artifact.path); assert.match(read(apiPath), /moveObjectToCollection/); assert.match(read(protocolPath), /moveObjectToCollection/);
|
|
const task = (id, title, owner, parent, status, ready, behavior) => ({ id, phase: "P24", title, kind: id.endsWith("000") || id.endsWith("003") || id.endsWith("001") ? "enabling" : "feature", owner, dependsOn: [parent], parityId: id.endsWith("001") || id.endsWith("002") ? "OBJECT_OPERATIONS.MOVE_COLLECTION" : null, implementationClass: id.endsWith("002") ? "LOCAL_EXACT" : "LOCAL_BOUNDED", parallelGroup: `p24-${id.slice(-3)}`, gate: id.endsWith("003") ? "G5" : "G2", card: `docs/tasks/${id}.md`, behavior, outputs: ["report", "receipt", "manifest"], acceptance: ["source and evidence hashes are bound", "unique behavior is verified once", "save/reopen remains exact", "malformed input fails closed"], status, ready, queueMutationAllowed: id.endsWith("000") });
|
|
const tasks = [task("WBV2-P24-000", "authorize_object_move_collection_continuation", "PROGRAM", "WBV2-P23-003", "done", false, "Authorize one Object Move-to-Collection behavior after the P23 transform overlay."), task("WBV2-P24-001", "select_object_move_collection_batch", "PARITY", "WBV2-P24-000", "in_progress", true, "Select moveObjectToCollection as one unique Object Operations behavior."), task("WBV2-P24-002", "object_move_collection_engine_receipt", "OBJECT", "WBV2-P24-001", "planned", false, "Bind moveObjectToCollection, undo/redo, malformed rejection, and exact save/reopen to compiled WASM Main in Chromium."), task("WBV2-P24-003", "close_object_move_collection_gate", "RELEASE", "WBV2-P24-002", "planned", false, "Close the moveObjectToCollection gate and graduate only the exact operator binding.")];
|
|
const plan = { schemaVersion: 1, planId: "BLENDER_WEB_PARITY_V2_OBJECT_MOVE_COLLECTION_EPOCH_1", status: "ACTIVE_OBJECT_MOVE_COLLECTION_QUEUE", authority: "queue_reactivated_after_p23_transform_gate", sourcePlan: "docs/BLENDER_WEB_PARITY_TASK_PLAN_V2.json", executionPointer: "docs/EXECUTION_QUEUE.md", runtimePolicy: { blenderSource: "blender-5.2.0", browserEvidence: ["chromium"], forbiddenBrowsers: ["firefox", "webkit"], mainAuthority: "blender_main", reusePolicy: "source_hash_and_behavior_hash_deduplication" }, parentTransform: { manifest: p23Path, report: p23ReportPath, basePending: 6618, effectivePending: 6609, duplicateValidationAvoided: true }, tasks };
|
|
fs.mkdirSync(abs(out), { recursive: true }); fs.writeFileSync(abs(planPath), `${JSON.stringify(plan, null, 2)}\n`);
|
|
const report = { schemaVersion: 1, task: "WBV2-P24-000", operation: "AUTHORIZE_OBJECT_MOVE_COLLECTION_CONTINUATION", status: "PASS", parent: { task: p23.task, manifest: p23Path, manifestSha256: sha(p23Path), report: p23ReportPath, reportSha256: sha(p23ReportPath), previousDecision: p23Report.decision.status, effectivePending: 6609 }, continuation: { root: "WBV2-P24-000", firstTask: "WBV2-P24-001", plannedTasks: 4, candidate: "OBJECT_OPERATIONS.MOVE_COLLECTION", sourceApi: apiPath, browser: "chromium", noRepeatedExecution: true }, policy: { p23EvidencePreserved: true, sourceHistoryReadOnly: true, representativeSliceOnly: true, duplicateValidationAvoided: true, authorizedRebaselineOnly: true, fullHistoricalReproduction: false }, nextTask: "WBV2-P24-001" };
|
|
fs.writeFileSync(abs(reportPath), `${JSON.stringify(report, null, 2)}\n`);
|
|
const cards = {
|
|
"WBV2-P24-000": "# WBV2-P24-000: object move collection continuation root\n\n- task: WBV2-P24-000\n- parent: WBV2-P23-003\n- status: done\n- gap: workflow:authorize_object_move_collection_continuation\n- ownerFamily: PROGRAM\n- targetImplementationClass: LOCAL_BOUNDED\n\n## 目标\n\nAuthorize one source-backed Object Move-to-Collection behavior after the P23 transform overlay.\n\n## 验收\n\n- `node tools/web/generate-wbv2-move-root.mjs`\n- `node tools/web/check-execution-control-plane.mjs`\n\n## 交付与回滚\n\n- Reports: `tests/golden/WBV2-P24-000/`\n- Manifest: `tests/golden/WBV2-P24-000/manifest.json`\n- Rollback: restore P23-003 as queue parent.\n",
|
|
"WBV2-P24-001": "# WBV2-P24-001: select_object_move_collection_batch\n\n- task: WBV2-P24-001\n- parent: WBV2-P24-000\n- status: in_progress\n- gap: capability:OBJECT_OPERATIONS.MOVE_COLLECTION\n- ownerFamily: PARITY\n- targetImplementationClass: LOCAL_BOUNDED\n\n## 目标\n\nSelect moveObjectToCollection as one unique Object Operations behavior.\n\n## 输入与范围\n\n- Focused source: `blender-5.2.0/source/blender/web_engine/web_engine_api.cpp`\n- Existing client: `web/app/src/engine-client/WebEngineClient.ts`\n- Inventory: `tests/golden/WBV2-P0-002/parity-map.json`\n- Production entrypoint: `node tools/web/generate-wbv2-move-selection.mjs --write`\n\n## 验收\n\n- source command is hash-bound\n- prior object evidence is not rerun\n- one legacy operator binding is selected\n- malformed, hash-drift, unsupported, or false-completion input keeps in_progress\n- `node tools/web/check-task-context.mjs --task WBV2-P24-001 --write`\n\n## 交付与回滚\n\n- Reports: `tests/golden/WBV2-P24-001/`\n- Status: `docs/status/WBV2-P24-001.md`\n- Manifest: `tests/golden/WBV2-P24-001/manifest.json`\n- Rollback: restore P24-000 as queue parent.\n",
|
|
"WBV2-P24-002": "# WBV2-P24-002: object move collection engine receipt\n\n- task: WBV2-P24-002\n- parent: WBV2-P24-001\n- status: planned\n- gap: capability:OBJECT_OPERATIONS.MOVE_COLLECTION\n- ownerFamily: OBJECT\n- targetImplementationClass: LOCAL_EXACT\n\n## 目标\n\nBind moveObjectToCollection, undo/redo, malformed rejection, and exact save/reopen to compiled WASM Main in Chromium.\n\n## 输入与范围\n\n- Focused source: `tests/golden/WBV2-P24-001/object-move-selection-report.json`\n- Production test: `web/tests/e2e/wbv2-object-move-production.spec.ts`\n- Production entrypoint: `npm --prefix web run test:e2e -- --workers=1 tests/e2e/wbv2-object-move-production.spec.ts`\n\n## 验收\n\n- object collection membership changes\n- undo/redo revisions are sequential\n- malformed move fails closed without Main mutation\n- save/reopen is exact and deterministic\n- Chromium is the only browser\n- malformed, hash-drift, unsupported, or false-completion input keeps in_progress\n- `node tools/web/check-task-context.mjs --task WBV2-P24-002 --write`\n\n## 交付与回滚\n\n- Reports: `tests/golden/WBV2-P24-002/`\n- Status: `docs/status/WBV2-P24-002.md`\n- Manifest: `tests/golden/WBV2-P24-002/manifest.json`\n- Rollback: restore P24-001 as queue parent.\n",
|
|
"WBV2-P24-003": "# WBV2-P24-003: close object move collection gate\n\n- task: WBV2-P24-003\n- parent: WBV2-P24-002\n- status: planned\n- gap: workflow:close_object_move_collection_gate\n- ownerFamily: RELEASE\n- targetImplementationClass: LOCAL_BOUNDED\n\n## 目标\n\nClose the moveObjectToCollection gate and graduate only the exact operator binding.\n\n## 输入与范围\n\n- Focused receipt: `tests/golden/WBV2-P24-002/object-move-receipt-report.json`\n- Previous overlay: `tests/golden/WBV2-P23-003/inventory-completion-overlay.json`\n- Production entrypoint: `node tools/web/generate-wbv2-move-gate.mjs --write`\n\n## 验收\n\n- only object move collection is claimed\n- effective inventory remains explicit\n- duplicate validation remains zero\n- malformed, hash-drift, unsupported, or false-completion input keeps in_progress\n- historical reproduction remains false\n- `node tools/web/check-task-context.mjs --task WBV2-P24-003 --write`\n\n## 交付与回滚\n\n- Reports: `tests/golden/WBV2-P24-003/`\n- Status: `docs/status/WBV2-P24-003.md`\n- Manifest: `tests/golden/WBV2-P24-003/manifest.json`\n- Rollback: restore P24-002 as queue parent.\n",
|
|
};
|
|
for (const [id, card] of Object.entries(cards)) fs.writeFileSync(abs(`docs/tasks/${id}.md`), card);
|
|
fs.writeFileSync(abs(statusPath), "# WBV2-P24-000 status\n\n- task: `WBV2-P24-000`; parent: `WBV2-P23-003`; status: `done`\n- candidate: `OBJECT_OPERATIONS.MOVE_COLLECTION`; source API is present\n- effective inventory carried forward: `290` completed, `6609` pending\n- duplicate validation: `forbidden`; representative slice only\n- nextTask: `WBV2-P24-001`\n");
|
|
p23Report.nextTask = "WBV2-P24-000"; p23Report.policy = { ...(p23Report.policy ?? {}), terminalQueuePointer: false, authorizedContinuation: "WBV2-P24-000" }; fs.writeFileSync(abs(p23ReportPath), `${JSON.stringify(p23Report, null, 2)}\n`); p23.nextTask = "WBV2-P24-000"; p23.continuation = { authorized: true, root: "WBV2-P24-000", scope: "OBJECT_OPERATIONS_MOVE_COLLECTION" }; fs.writeFileSync(abs(p23Path), `${JSON.stringify(p23, null, 2)}\n`); execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P23-003", "--write"], { cwd: root, stdio: "pipe" }); p23.artifacts = Object.fromEntries(Object.entries(p23.artifacts).map(([name, artifact]) => [name, { ...artifact, sha256: sha(artifact.path) }])); fs.writeFileSync(abs(p23Path), `${JSON.stringify(p23, null, 2)}\n`); report.parent.manifestSha256 = sha(p23Path); report.parent.reportSha256 = sha(p23ReportPath); fs.writeFileSync(abs(reportPath), `${JSON.stringify(report, null, 2)}\n`);
|
|
const rootPaths = { parentManifest: p23Path, parentReport: p23ReportPath, inventory: inventoryPath, sourceApi: apiPath, sourceClient: clientPath, plan: planPath, report: reportPath, rootCard: "docs/tasks/WBV2-P24-000.md", rootStatus: statusPath }; const artifacts = Object.fromEntries(Object.entries(rootPaths).map(([name, file]) => [name, { path: file, sha256: sha(file) }])); fs.writeFileSync(abs(manifestPath), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P24-000", parentTask: "WBV2-P23-003", operation: "AUTHORIZE_OBJECT_MOVE_COLLECTION_CONTINUATION", status: "done", enablingTask: true, parityStateChange: false, runtime: "READ_ONLY_OBJECT_MOVE_COLLECTION_CONTINUATION_ROOT", artifacts, assertions: { p23EvidencePreserved: true, sourceApiBound: true, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, duplicateValidationAvoided: true, representativeSliceOnly: true, authorizedRebaselineOnly: true, fullHistoricalReproduction: false }, nextTask: "WBV2-P24-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-P24-001` |").replace(/\| parent manifest \| `[^`]+` \|/u, "| parent manifest | `tests/golden/WBV2-P24-000/manifest.json` |").replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, "| 任务卡 | [`tasks/WBV2-P24-001.md`](tasks/WBV2-P24-001.md) |"); fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), queue); let next = read("nextTask.md"); next = next.replace(/\| Current task when this file was written \| `[^`]+` \|/u, "| Current task when this file was written | `WBV2-P24-001` |").replace(/\| Current task state \| `[^`]+` \|/u, "| Current task state | `in_progress` |").replace(/\| Parent manifest \| `[^`]+` \|/u, "| Parent manifest | `tests/golden/WBV2-P24-000/manifest.json` |").replace(/\| Current task card \| `[^`]+` \|/u, "| Current task card | `docs/tasks/WBV2-P24-001.md` |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | `WBV2-P24-002` |").replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | `node tools/web/generate-wbv2-move-selection.mjs --write` |"); fs.writeFileSync(abs("nextTask.md"), next); console.log("wbv2-move-root-written root=WBV2-P24-000 next=WBV2-P24-001 candidate=OBJECT_OPERATIONS.MOVE_COLLECTION effectivePending=6609");
|