Checkpoint web parity through Chromium input tasks
Some checks are pending
M6 deployable RC / quick (push) Waiting to run
M6 deployable RC / chromium (push) Blocked by required conditions
M6 deployable RC / release (push) Blocked by required conditions

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,39 @@
import assert from "node:assert/strict";
import crypto from "node:crypto";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const reportPath = path.join(root, "tests/golden/M13-01A/entry-inventory.json");
const manifestPath = path.join(root, "tests/golden/M13-01A/manifest.json");
const fixtureRoot = path.join(root, "tests/files/web/m13_script_entry_v1");
const generator = path.join(root, "tools/web/generate-script-entry-inventory.py");
const blender = process.env.BLENDER_BIN ?? path.join(root, "build_blender_5.2.0/bin/blender");
const sha256 = (bytes) => crypto.createHash("sha256").update(bytes).digest("hex");
const readJson = (file) => JSON.parse(fs.readFileSync(file, "utf8"));
const report = readJson(reportPath);
const manifest = readJson(manifestPath);
assert.deepEqual({ schemaVersion: manifest.schemaVersion, task: manifest.task, parentTask: manifest.parentTask, nextTask: manifest.nextTask }, { schemaVersion: 1, task: "M13-01A", parentTask: "M12-07J", nextTask: "M13-01B" });
assert.deepEqual({ schemaVersion: report.schemaVersion, task: report.task, operation: report.operation, nextTask: report.nextTask }, { schemaVersion: 1, task: "M13-01A", operation: "BLENDER_SCRIPT_ENTRY_INVENTORY", nextTask: "M13-01B" });
assert.deepEqual(report.executionPolicy, { text: "READ_METADATA_ONLY", pythonConsole: "DENY", autorun: "DENY", driverExpression: "DENY", handler: "DENY", addon: "DENY" });
assert.equal(report.inventory.text.count, 3); assert.deepEqual(report.inventory.autorun.moduleTextNames, ["ModuleAutorun.py"]); assert.equal(report.inventory.driverExpressions.count, 1); assert.equal(report.inventory.pythonConsole.available, true); assert.equal(report.inventory.addons.defaultExecution, "DENY");
const fixturePath = path.join(fixtureRoot, report.fixture.name);
assert.equal(sha256(fs.readFileSync(fixturePath)), report.fixture.sha256);
for (const artifact of Object.values(manifest.artifacts)) assert.equal(sha256(fs.readFileSync(path.join(root, artifact.path))), artifact.sha256, `artifact hash mismatch ${artifact.path}`);
const inventory = readJson(path.join(root, "tests/golden/M12-05A/format-inventory.json"));
for (const key of ["blenderVersion", "versionTuple", "buildDate", "buildTime", "buildHash", "buildBranch", "buildPlatform", "buildType", "binarySha256"]) assert.deepEqual(report.runtime[key], inventory.runtime[key], `runtime drift in ${key}`);
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), "m13-01a-script-"));
try {
const regenerated = path.join(temporary, "entry-inventory.json");
const result = spawnSync(blender, ["-b", "--factory-startup", "--python", generator, "--", temporary, regenerated], { cwd: root, encoding: "utf8", maxBuffer: 20 * 1024 * 1024 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
const regeneratedReport = readJson(regenerated);
assert.deepEqual({ ...regeneratedReport, fixture: { ...regeneratedReport.fixture, sha256: "<runtime-save-hash>" } }, { ...report, fixture: { ...report.fixture, sha256: "<runtime-save-hash>" } }, "script entry inventory is not deterministic");
assert.equal(regeneratedReport.fixture.byteLength, report.fixture.byteLength);
assert.equal(fs.statSync(path.join(temporary, report.fixture.name)).size, report.fixture.byteLength);
}
finally { fs.rmSync(temporary, { recursive: true, force: true }); }
process.stdout.write(`script-entry-inventory-ok texts=3 console=3 autorun=1 drivers=1 handlers=${report.inventory.handlers.groups.length} addonOps=4 deterministic=true next=${report.nextTask}\n`);