Rebuild local Blender WASM environment and recovery evidence
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-27 20:15:55 +08:00
parent a081c68c87
commit c2c65d3a09
376 changed files with 241951 additions and 114 deletions

View File

@@ -0,0 +1,48 @@
import { expect, test } from "@playwright/test";
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
const root = path.resolve(import.meta.dirname, "../../..");
const output = path.resolve(root, process.env.WBV2_RECOVERY_RECEIPT_REPORT ?? "tests/golden/WBV2-P8-002/chromium-receipts.json");
const map = JSON.parse(fs.readFileSync(path.join(root, "tools/web/wbv2-recovery-family-map.json"), "utf8"));
const sha256 = (file: string) => crypto.createHash("sha256").update(fs.readFileSync(path.join(root, file))).digest("hex");
test("P8-002 runs all atomic family surfaces in Chromium", async ({ page }) => {
const bindings = Object.fromEntries(Object.entries(map).map(([family, value]) => {
const source = value as { task: string; report: string };
const manifestPath = `tests/golden/${source.task}/manifest.json`;
const manifest = JSON.parse(fs.readFileSync(path.join(root, manifestPath), "utf8"));
const bound = Object.values(manifest.artifacts ?? {}).find((artifact) => (artifact as { path: string }).path === source.report) as { path: string; sha256: string } | undefined;
expect(manifest.status).toBe("done"); expect(bound?.sha256).toBe(sha256(source.report));
const report = JSON.parse(fs.readFileSync(path.join(root, source.report), "utf8"));
expect(report.desktop.status).toBe("EXACT"); expect(report.wasm.status).toBe("EXACT");
expect(report.saveReopen ?? report.desktop.saveReopen ?? report.wasm.saveReopen).toBe("EXACT");
return [family, { ...source, manifest: manifestPath, manifestSha256: sha256(manifestPath), reportSha256: sha256(source.report) }];
}));
await page.goto("/");
const browser = await page.evaluate(async () => {
const { ATOMIC_CORRECTIVE_FAMILIES, createGenericFamilyMain, createGenericFamilyRegistry, runCorrectiveFamilyCases } = await import("/src/corrective-pilot-bridge.ts");
const families = [];
for (const family of ATOMIC_CORRECTIVE_FAMILIES) {
const runSurface = async (surface: "DESKTOP" | "WASM") => {
const main = createGenericFamilyMain(family);
const command = { schemaVersion: 1, requestId: `p8-${family.toLowerCase()}-${surface.toLowerCase()}`, commandType: "familySetState", baseRevision: 1, context: { mainId: `main:${family.toLowerCase()}`, targetKind: "DATABLOCK", targetId: `family:${family.toLowerCase()}`, editMode: "EDITABLE", authorization: "USER_EDIT", source: { kind: "LOCAL", sha256: "8".repeat(64) } }, payload: { family, value: "after" } };
const [result] = await runCorrectiveFamilyCases([{ id: `${family.toLowerCase()}-${surface.toLowerCase()}`, family, registry: createGenericFamilyRegistry(main), surface, command, mainRevision: 1 }]);
const saved = main.snapshot();
const reopened = createGenericFamilyMain(family, saved.value.value, saved.revision, false).snapshot();
return { receipt: result.receipt.result, saved, reopened };
};
const desktop = await runSurface("DESKTOP");
const wasm = await runSurface("WASM");
families.push({ family, desktop, wasm, saveReopen: { status: JSON.stringify(desktop.saved.value) === JSON.stringify(desktop.reopened.value) && JSON.stringify(wasm.saved.value) === JSON.stringify(wasm.reopened.value) ? "EXACT" : "DRIFT", desktopRevision: desktop.reopened.revision, wasmRevision: wasm.reopened.revision } });
}
const flat = families.flatMap((entry) => [entry.desktop, entry.wasm]);
const summary = Object.fromEntries(families.map((entry) => [entry.family, { total: 2, finished: [entry.desktop, entry.wasm].filter((surface) => surface.receipt.status === "FINISHED").length, unchanged: [entry.desktop, entry.wasm].filter((surface) => surface.receipt.mainMutation === "UNCHANGED").length }]));
return { families, summary, finished: flat.filter((entry) => entry.receipt.status === "FINISHED").length };
});
expect(browser.families).toHaveLength(15); expect(browser.finished).toBe(30);
expect(browser.families.every((entry) => entry.desktop.receipt.status === "FINISHED" && entry.wasm.receipt.status === "FINISHED" && entry.saveReopen.status === "EXACT")).toBe(true);
fs.mkdirSync(path.dirname(output), { recursive: true });
fs.writeFileSync(output, `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P8-002", operation: "ATOMIC_FAMILY_RECOVERY_CHROMIUM", browser: "chromium", queueMutation: false, bindings, ...browser }, null, 2)}\n`);
});