Files
workinf_Blender_Wasm/tools/web/check-wbv2-advanced-ledger.mjs
mes123456 ea18416ff2
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
Advance WBV2 high-value domains through P13
2026-08-28 07:11:47 +08:00

42 lines
2.3 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 absolute = (file) => path.join(root, file);
const read = (file) => fs.readFileSync(absolute(file), "utf8");
const json = (file) => JSON.parse(read(file));
const sha256 = (file) => crypto.createHash("sha256").update(fs.readFileSync(absolute(file))).digest("hex");
const ledgerPath = "tests/golden/WBV2-P13-001/advanced-ledger.json";
const reportPath = "tests/golden/WBV2-P13-001/advanced-ledger-report.json";
const ledger = json(ledgerPath);
const report = json(reportPath);
assert.equal(ledger.task, "WBV2-P13-001");
assert.equal(ledger.operation, "ADVANCED_DOMAIN_LEDGER");
assert.equal(ledger.status, "READY");
assert.equal(report.status, "PASS");
assert.equal(report.ledgerSha256, sha256(ledgerPath));
assert.equal(ledger.policy.reuseReadOnly, true);
assert.equal(ledger.policy.noRepeatedExecution, true);
assert.equal(ledger.inventory.total, 6900);
assert.equal(ledger.inventory.pending, 6618);
assert.equal(ledger.inventory.claimedComplete, 0);
assert.equal(ledger.sourceManifests.length, 15);
for (const entry of ledger.sourceManifests) {
assert.equal(entry.status, "done", entry.task);
assert.equal(entry.manifestSha256, sha256(entry.manifest), `${entry.task} manifest drift`);
assert.equal(entry.currentDriftCount, entry.artifacts.filter((artifact) => artifact.drift).length);
assert.ok(["EXACT_RECORDED", "HISTORICAL_DRIFT_RECORDED"].includes(entry.evidenceClass));
for (const artifact of entry.artifacts) {
assert.equal(artifact.exists, fs.existsSync(absolute(artifact.path)));
if (artifact.exists) assert.equal(artifact.currentHash, sha256(artifact.path));
}
}
assert.equal(ledger.summary.manifestsDone, 15);
assert.equal(ledger.summary.repeatedBlenderRuns, 0);
assert.equal(ledger.summary.repeatedChromiumRuns, 0);
assert.equal(ledger.summary.unprovenDomains.length, 7);
process.stdout.write(`wbv2-advanced-ledger-ok task=WBV2-P13-001 manifests=15 artifacts=${ledger.summary.artifactRecords} drift=${ledger.summary.historicalDriftManifests} repeatedRuns=0 unprovenDomains=${ledger.summary.unprovenDomains.length}\n`);