Files
workinf_Blender_Wasm/tools/web/check-blender-zero-gap-gate.mjs
mes123456 10640aeb3c
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
Govern task context and advance execution pointer
2026-08-20 06:02:43 -04:00

11 lines
3.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 planPath = path.join(root, "tests/golden/M15-03A/next-task-plan.json"); const reportPath = path.join(root, "tests/golden/M15-03E/zero-gap-gate-report.json"); const manifestPath = path.join(root, "tests/golden/M15-03E/manifest.json"); const sha256 = (b) => crypto.createHash("sha256").update(b).digest("hex"); const fileSha256 = (f) => sha256(fs.readFileSync(f)); const relative = (f) => path.relative(root, f).replaceAll(path.sep, "/");
const plan = JSON.parse(fs.readFileSync(planPath, "utf8")); const byFamily = {}; for (const task of plan.tasks) { const stats = byFamily[task.ownerFamily] ?? { total: 0, completed: 0, blocked: 0, remaining: 0 }; stats.total++; if (task.state === "completed") stats.completed++; else if (task.state === "blocked") stats.blocked++; else stats.remaining++; byFamily[task.ownerFamily] = stats; } const remaining = Object.values(byFamily).reduce((sum, value) => sum + value.remaining, 0); const gateStatus = remaining === 0 ? "READY" : "BLOCKED"; assert.equal(gateStatus, "BLOCKED"); assert.equal(remaining, plan.tasks.length - plan.summary.completed); assert.equal(plan.summary.active, 1); assert.equal(plan.firstTask, plan.tasks.find((task) => task.state === "active").id);
const report = { schemaVersion: 1, task: "M15-03E", operation: "BLENDER_ZERO_GAP_GATE", source: { path: "tests/golden/M15-03A/next-task-plan.json", sha256: fileSha256(planPath) }, status: gateStatus, summary: { ownerFamilies: Object.keys(byFamily).length, remaining }, byFamily, activeTask: plan.firstTask, nextTask: plan.firstTask };
if (process.env.UPDATE_M15_03E_MANIFEST === "1") { fs.mkdirSync(path.dirname(reportPath), { recursive: true }); fs.writeFileSync(reportPath, `${JSON.stringify(report, null, 2)}\n`); const paths = { parentManifest: path.join(root, "tests/golden/M15-03D/manifest.json"), checker: path.join(root, "tools/web/check-blender-zero-gap-gate.mjs"), plan: planPath, report: reportPath, package: path.join(root, "web/package.json") }; const artifacts = Object.fromEntries(Object.entries(paths).map(([name, file]) => [name, { path: relative(file), sha256: fileSha256(file) }])); fs.writeFileSync(manifestPath, `${JSON.stringify({ schemaVersion: 1, task: "M15-03E", parentTask: "M15-03D", status: "BLOCKED", enablingTask: false, parityStateChange: false, operation: "BLENDER_ZERO_GAP_GATE", artifacts, nextTask: plan.firstTask }, null, 2)}\n`); }
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8")); assert.equal(manifest.status, "BLOCKED"); assert.equal(manifest.nextTask, plan.firstTask); for (const artifact of Object.values(manifest.artifacts)) assert.equal(fileSha256(path.join(root, artifact.path)), artifact.sha256, artifact.path); process.stdout.write(`blender-zero-gap-gate-ok status=${gateStatus} families=${report.summary.ownerFamilies} remaining=${remaining} active=${plan.firstTask}\n`);