49 lines
8.7 KiB
JavaScript
49 lines
8.7 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 sha = (file) => crypto.createHash("sha256").update(fs.readFileSync(abs(file))).digest("hex");
|
|
const parentPath = "tests/golden/WBV2-P42-003/manifest.json";
|
|
const parent = JSON.parse(read(parentPath));
|
|
assert.equal(parent.status, "done");
|
|
assert.equal(parent.nextTask, "WBV2-P43-000");
|
|
const tasks = [
|
|
["WBV2-P43-000", "authorize_capability_family_implementation", "PROGRAM", "done", false, "Authorize source-backed implementation indexing across the immutable 6900-entry inventory."],
|
|
["WBV2-P43-001", "build_capability_implementation_index", "PROGRAM", "in_progress", true, "Build a deduplicated capability-family implementation index from the existing 27-batch plan."],
|
|
["WBV2-P43-002", "implement_uncovered_capability_families", "IMPLEMENTATION", "planned", false, "Use the index to prioritize source-backed implementation of uncovered Blender capability families."],
|
|
["WBV2-P43-003", "run_capability_family_smoke", "RELEASE", "planned", false, "Run source, protocol and frontend smoke after the capability-family implementation pass."],
|
|
];
|
|
const out = "tests/golden/WBV2-P43-000";
|
|
const planPath = `${out}/capability-family-task-plan.json`;
|
|
const records = tasks.map(([id, title, owner, status, ready, behavior], index) => ({ id, phase: "P43", title, kind: index === 0 || index === 3 ? "enabling" : "feature", owner, dependsOn: [index === 0 ? "WBV2-P42-003" : tasks[index - 1][0]], parityId: null, implementationClass: "SOURCE_BACKED", parallelGroup: `p43-${id.slice(-3)}`, gate: index === 0 ? "G1" : "IMPLEMENTATION", card: `docs/tasks/${id}.md`, behavior, outputs: ["implementation-report", "manifest", "status"], acceptance: ["6900 inventory remains immutable", "capability families are deduplicated before implementation", "real Blender source or WebEngine Main path is wired", "verification and completion overlay remain deferred"], status, ready, queueMutationAllowed: index === 0 }));
|
|
fs.mkdirSync(abs(out), { recursive: true });
|
|
fs.writeFileSync(abs(planPath), `${JSON.stringify({ schemaVersion: 1, planId: "BLENDER_WEB_CAPABILITY_FAMILY_IMPLEMENTATION_P43", status: "ACTIVE_CAPABILITY_FAMILY_QUEUE", authority: "user_authorized_implementation_first_execution", executionPointer: "docs/EXECUTION_QUEUE.md", sourceAuthority: { blenderSource: "blender-5.2.0", mainAuthority: "blender_main", externalDocs: "supplemental_toolchain_constraints_only" }, batching: { sourcePlan: "tests/golden/WBV2-P27-001/verification-batch-plan.json", batchCount: 27, dedupeBy: ["sourceHash", "behaviorHash", "dedupeKey"], repeatedVerification: false }, 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-P43-000" ? "node tools/web/generate-wbv2-capability-family-root.mjs" : `node tools/web/generate-wbv2-capability-family-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- Blender source authority: \`blender-5.2.0/source/blender\`\n- Inventory: \`tests/golden/WBV2-P0-002/parity-map.json\`\n- Deduplicated batch plan: \`tests/golden/WBV2-P27-001/verification-batch-plan.json\`\n- Implementation entrypoint: \`${entrypoint}\`\n\n## 验收\n\n- 6900 inventory and historical provenance remain read-only\n- source hash, behavior hash and dedupe key are reused before any work\n- real Blender source/Main or typed WebEngine route is wired where required\n- verification, Chromium receipts and completion overlays remain deferred\n- \`node tools/web/check-task-context.mjs --task ${id} --write\`\n\n## 失败边界\n\n- missing source, unsupported capability, hash drift or ambiguous mapping remains in_progress/blocked\n- representative implementation never becomes a full-family completion claim\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}/capability-family-root-report.json`;
|
|
const statusPath = "docs/status/WBV2-P43-000.md";
|
|
fs.writeFileSync(abs(reportPath), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P43-000", operation: "AUTHORIZE_CAPABILITY_FAMILY_IMPLEMENTATION", status: "PASS", parent: { task: parent.task, manifest: parentPath, manifestSha256: sha(parentPath) }, scope: { firstTask: "WBV2-P43-001", plannedTasks: records.map((record) => record.id) }, batching: { plan: "tests/golden/WBV2-P27-001/verification-batch-plan.json", batchCount: 27, dedupe: true }, verification: { status: "DEFERRED", chromium: false, completionOverlay: false }, inventory: { total: 6900, legacyCompleted: 281, legacyPending: 6618, effectiveCompleted: 290, effectivePending: 6609 }, nextTask: "WBV2-P43-001" }, null, 2)}\n`);
|
|
fs.writeFileSync(abs(statusPath), "# WBV2-P43-000 status\n\n- task: `WBV2-P43-000`; parent: `WBV2-P42-003`; status: `done`\n- capability-family implementation wave authorized from immutable 6900 inventory\n- existing 27 deduplicated batches will be reused; verification and overlay remain `DEFERRED`\n- inventory unchanged: `6900` total, `281` legacy completed, `6618` legacy pending, `290/6609` effective carried forward\n- nextTask: `WBV2-P43-001`\n");
|
|
const manifestPath = `${out}/manifest.json`;
|
|
fs.writeFileSync(abs(manifestPath), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P43-000", parentTask: "WBV2-P42-003", operation: "AUTHORIZE_CAPABILITY_FAMILY_IMPLEMENTATION", status: "done", enablingTask: true, parityStateChange: false, runtime: "SOURCE_BACKED_CAPABILITY_FAMILY_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, dedupeBatchCount: 27, verificationDeferred: true, completionOverlayWritten: false, inventoryTotal: 6900, effectiveCompleted: 290, effectivePending: 6609, historicalReproduction: false }, nextTask: "WBV2-P43-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-P43-001` |").replace(/\| parent manifest \| `[^`]+` \|/u, "| parent manifest | `tests/golden/WBV2-P43-000/manifest.json` |").replace(/\| 任务卡 \| \[[^\]]+\]\([^\)]+\) \|/u, "| 任务卡 | [`tasks/WBV2-P43-001.md`](tasks/WBV2-P43-001.md) |");
|
|
fs.writeFileSync(abs("docs/EXECUTION_QUEUE.md"), queue);
|
|
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P43-000", "--write"], { cwd: root, stdio: "inherit" });
|
|
execFileSync(process.execPath, [abs("tools/web/check-task-context.mjs"), "--task", "WBV2-P43-001", "--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 + "WBV2-P43-001" + tick + " |").replace(/\| Current task state \| `[^`]+` \|/u, "| Current task state | " + tick + "in_progress" + tick + " |").replace(/\| Parent manifest \| `[^`]+` \|/u, "| Parent manifest | " + tick + "tests/golden/WBV2-P43-000/manifest.json" + tick + " |").replace(/\| Current task card \| `[^`]+` \|/u, "| Current task card | " + tick + "docs/tasks/WBV2-P43-001.md" + tick + " |").replace(/\| Current task-context nextTask \| `[^`]+` \|/u, "| Current task-context nextTask | " + tick + "WBV2-P43-002" + tick + " |").replace(/\| Focused command \| `[^`]+` \|/u, "| Focused command | " + tick + "node tools/web/generate-wbv2-capability-family-slice.mjs --task WBV2-P43-001 --write" + tick + " |");
|
|
fs.writeFileSync(abs("nextTask.md"), next);
|
|
console.log("wbv2-capability-family-root-written current=WBV2-P43-001 verification=DEFERRED inventory=6900 effectivePending=6609");
|