Checkpoint web parity through Chromium input tasks
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

This commit is contained in:
mes123456
2026-08-19 10:39:03 -04:00
parent 5a11045ca5
commit 380cbed4ff
634 changed files with 41862 additions and 212 deletions

View File

@@ -0,0 +1,48 @@
import assert from "node:assert/strict";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { pathToFileURL } from "node:url";
import test from "node:test";
import ts from "typescript";
const root = path.resolve(import.meta.dirname, "../../..");
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), "io-format-runtime-receipt-unit-"));
const sourcePath = path.join(root, "web/protocol/io-format-runtime-receipt.ts");
const transpiled = ts.transpileModule(fs.readFileSync(sourcePath, "utf8"), { compilerOptions: { module: ts.ModuleKind.ES2022, target: ts.ScriptTarget.ES2022 }, fileName: sourcePath, reportDiagnostics: true });
assert.deepEqual(transpiled.diagnostics, []);
fs.writeFileSync(path.join(temporary, "protocol.mjs"), transpiled.outputText);
const protocol = await import(pathToFileURL(path.join(temporary, "protocol.mjs")));
const receiptSet = JSON.parse(fs.readFileSync(path.join(root, "tests/golden/M12-05D/runtime-receipts.json"), "utf8"));
const inventorySha256 = receiptSet.inventorySha256;
test("M12-05D resolves capability from the runtime operator receipt", () => {
const parsed = protocol.validateIOFormatRuntimeReceiptSet(receiptSet, inventorySha256);
assert.equal(protocol.resolveIOFormatRuntimeRoute(parsed, { format: "GLB", operation: "EXPORT" }).status, "READY");
assert.equal(protocol.resolveIOFormatRuntimeRoute(parsed, { format: "USD", operation: "EXPORT" }).status, "BLOCKED");
});
test("M12-05D does not infer capability from a filename extension", () => {
const mutated = structuredClone(receiptSet);
const receipt = mutated.receipts.find((candidate) => candidate.format === "GLB" && candidate.operation === "EXPORT");
receipt.extensions = [".usd"];
const parsed = protocol.validateIOFormatRuntimeReceiptSet(mutated, inventorySha256);
assert.deepEqual(protocol.resolveIOFormatRuntimeRoute(parsed, { format: "GLB", operation: "EXPORT" }).status, "READY");
assert.deepEqual(protocol.resolveIOFormatRuntimeRoute(parsed, { format: "USD", operation: "EXPORT" }).status, "BLOCKED");
});
test("M12-05D rejects receipt identity drift and consumes explicit receipt status", () => {
const stale = structuredClone(receiptSet);
stale.inventorySha256 = "0".repeat(64);
assert.throws(() => protocol.validateIOFormatRuntimeReceiptSet(stale, inventorySha256), { code: "IO_FORMAT_UNSUPPORTED" });
const forged = structuredClone(receiptSet);
const usd = forged.receipts.find((candidate) => candidate.format === "USD" && candidate.operation === "EXPORT");
usd.runtimeStatus = "AVAILABLE";
usd.registered = true;
usd.rnaIdentifier = "WM_OT_usd_export";
usd.buildOptionEnabled = true;
assert.doesNotThrow(() => protocol.parseIOFormatRuntimeReceiptSet(forged));
assert.equal(protocol.resolveIOFormatRuntimeRoute(protocol.parseIOFormatRuntimeReceiptSet(forged), { format: "USD", operation: "EXPORT" }).status, "READY");
});
test.after(() => fs.rmSync(temporary, { recursive: true, force: true }));