Files
workinf_Blender_Wasm/web/tests/unit/legacy-manifest-integrity.mjs
mes123456 f3e21c6b98
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
chore: checkpoint web Blender migration source, tools and docs
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>
2026-11-10 11:18:01 +08:00

33 lines
1.8 KiB
JavaScript

import assert from "node:assert/strict";
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
const root = path.resolve(import.meta.dirname, "../../..");
const evidence = JSON.parse(fs.readFileSync(path.join(root, "tests/golden/WBV2-P1424-001/release-validation-20261021/M12-manifest-sha-drift-3.json"), "utf8"));
const sha256 = (file) => crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex");
assert.equal(sha256(path.join(root, evidence.previousEvidence.path)), evidence.previousEvidence.sha256);
assert.equal(sha256(path.join(root, evidence.previousObservation.path)), evidence.previousObservation.sha256);
const key = (task, artifact) => `${task}:${artifact}`;
const recorded = new Map(evidence.entries.map((entry) => [key(entry.task, entry.artifact), entry]));
export function assertLegacyManifestArtifacts(manifest) {
const manifestPath = `tests/golden/${manifest.task}/manifest.json`;
assert.equal(sha256(path.join(root, manifestPath)), evidence.manifestSha256[manifestPath], `${manifest.task} historical manifest changed`);
for (const [artifact, binding] of Object.entries(manifest.artifacts ?? {})) {
const actual = sha256(path.join(root, binding.path));
if (actual === binding.sha256) continue;
const entry = recorded.get(key(manifest.task, artifact));
assert.ok(entry, `${manifest.task}:${artifact} drift is not classified`);
assert.equal(entry.path, binding.path);
assert.equal(entry.originalSha256, binding.sha256);
assert.equal(entry.observedSha256, actual);
if (entry.sourceSnapshot) {
assert.equal(sha256(path.join(root, entry.sourceSnapshot)), binding.sha256);
assert.equal(entry.provenanceState, "VERIFIED_HISTORICAL_BYTES");
} else assert.equal(entry.provenanceState, "BLOCKED_SOURCE_LOST");
}
}
export { evidence };