Rebuild local Blender WASM environment and recovery evidence
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { CorrectiveCommandRegistry } from "./corrective-command-registry";
|
||||
import { CaseSurface, SurfaceReceipt } from "./corrective-case-runner";
|
||||
|
||||
export type CorrectiveFamily = "ASSET_CATALOG" | "MODIFIER" | "MESH";
|
||||
export const ATOMIC_CORRECTIVE_FAMILIES = [
|
||||
"CORE_DNA_RNA", "CORE_MESH", "CORE_OBJECT", "CORE_SCENE_GRAPH", "MATERIAL_RENDER",
|
||||
"MEDIA_IO", "MESH_EDITING", "MODIFIER_SYSTEM", "NODES_GRAPH", "OBJECT_OPERATIONS",
|
||||
"OTHER_OPERATOR", "RIG_ANIMATION", "SCULPT_PAINT", "SIMULATION", "UI_EDITOR",
|
||||
] as const;
|
||||
export const CORRECTIVE_FAMILIES = [...ATOMIC_CORRECTIVE_FAMILIES, "ASSET_CATALOG", "MODIFIER", "MESH"] as const;
|
||||
export type CorrectiveFamily = typeof CORRECTIVE_FAMILIES[number];
|
||||
|
||||
export interface CorrectiveFamilyCase {
|
||||
id: string;
|
||||
@@ -23,21 +29,17 @@ export async function runCorrectiveFamilyCases(cases: readonly CorrectiveFamilyC
|
||||
for (const testCase of cases) {
|
||||
if (!testCase || !CASE_ID.test(testCase.id) || ids.has(testCase.id)) throw new Error(`family case id is invalid or duplicated: ${testCase?.id ?? "unknown"}`);
|
||||
ids.add(testCase.id);
|
||||
if (!["ASSET_CATALOG", "MODIFIER", "MESH"].includes(testCase.family)) throw new Error(`unsupported corrective family: ${testCase.family}`);
|
||||
if (!CORRECTIVE_FAMILIES.includes(testCase.family)) throw new Error(`unsupported corrective family: ${testCase.family}`);
|
||||
if (!(testCase.registry instanceof CorrectiveCommandRegistry)) throw new Error(`family case registry is invalid: ${testCase.id}`);
|
||||
if (!Number.isSafeInteger(testCase.mainRevision) || testCase.mainRevision < 0) throw new Error(`family case revision is invalid: ${testCase.id}`);
|
||||
}
|
||||
return Promise.all(cases.map(async (testCase) => ({ ...testCase, receipt: await testCase.registry.dispatch(testCase.surface, { command: testCase.command, mainRevision: testCase.mainRevision }) })));
|
||||
}
|
||||
|
||||
export function summarizeCorrectiveFamilyResults(results: readonly CorrectiveFamilyResult[]): Record<CorrectiveFamily, { total: number; finished: number; unchanged: number }> {
|
||||
const summary: Record<CorrectiveFamily, { total: number; finished: number; unchanged: number }> = {
|
||||
ASSET_CATALOG: { total: 0, finished: 0, unchanged: 0 },
|
||||
MODIFIER: { total: 0, finished: 0, unchanged: 0 },
|
||||
MESH: { total: 0, finished: 0, unchanged: 0 },
|
||||
};
|
||||
export function summarizeCorrectiveFamilyResults(results: readonly CorrectiveFamilyResult[]): Partial<Record<CorrectiveFamily, { total: number; finished: number; unchanged: number }>> {
|
||||
const summary: Partial<Record<CorrectiveFamily, { total: number; finished: number; unchanged: number }>> = {};
|
||||
for (const result of results) {
|
||||
const bucket = summary[result.family]; bucket.total += 1;
|
||||
const bucket = (summary[result.family] ??= { total: 0, finished: 0, unchanged: 0 }); bucket.total += 1;
|
||||
if (result.receipt.result.status === "FINISHED") bucket.finished += 1;
|
||||
if (result.receipt.result.mainMutation === "UNCHANGED") bucket.unchanged += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user