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>
33 lines
2.0 KiB
JavaScript
33 lines
2.0 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import crypto from "node:crypto";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
const read = (relative) => fs.readFileSync(path.join(root, relative), "utf8");
|
|
const json = (relative) => JSON.parse(read(relative));
|
|
const sha256 = (bytes) => crypto.createHash("sha256").update(bytes).digest("hex");
|
|
const index = json("tests/golden/WBV2/task-index.json");
|
|
const plan = json(index.source.path);
|
|
const catalogBytes = fs.readFileSync(path.join(root, index.catalog.path));
|
|
|
|
assert.equal(index.schemaVersion, 1);
|
|
assert.equal(index.operation, "BLENDER_WEB_CAPABILITY_TASK_INDEX");
|
|
assert.equal(sha256(read(index.source.path)), index.source.sha256);
|
|
assert.equal(sha256(catalogBytes), index.catalog.sha256);
|
|
assert.equal(index.taskCount, plan.tasks.length);
|
|
const ready = plan.tasks.filter((task) => task.ready === true);
|
|
const terminal = ready.length === 0 && plan.tasks.length > 0 && plan.tasks.every((task) => task.ready !== true && task.status === "done");
|
|
assert.ok(terminal || ready.length === 1);
|
|
assert.equal(index.activeTask, terminal ? null : ready[0].id);
|
|
const lines = catalogBytes.toString("utf8").trimEnd().split("\n").filter(Boolean).map((line) => JSON.parse(line));
|
|
assert.equal(lines.length, plan.tasks.length);
|
|
assert.equal(lines.filter((task) => task.state === "active").length, terminal ? 0 : 1);
|
|
assert.equal(lines.find((task) => task.state === "active")?.id ?? null, index.activeTask);
|
|
for (const task of plan.tasks.filter((candidate) => candidate.ready || candidate.status === "done")) {
|
|
assert.ok(index.entries[task.id], `${task.id} must have an index entry`);
|
|
assert.ok(fs.existsSync(path.join(root, task.card)), `${task.id} card must exist before activation`);
|
|
}
|
|
process.stdout.write(`v2-task-index-ok tasks=${index.taskCount} active=${index.activeTask ?? "NONE"} catalog=${index.catalog.path}\n`);
|