Complete WBV2 feature parity evidence epoch
This commit is contained in:
74
web/tests/e2e/wbv2-asset-catalog-production.spec.ts
Normal file
74
web/tests/e2e/wbv2-asset-catalog-production.spec.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const evidenceRoot = path.resolve(import.meta.dirname, "../../../tests/golden/WBV2-P9-003");
|
||||
|
||||
test("WBV2-P9-003 production Chromium Asset Catalog receipt is exact and resource-bound", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const report = await page.evaluate(async () => {
|
||||
const { AssetCatalogResourceResolver, CorrectiveHistoryStore, InMemoryCatalogProvider, InMemoryMainStore, createAssetCatalogRegistry } = await import("/src/corrective-pilot-bridge.ts");
|
||||
const bytes = new TextEncoder().encode("wbv2-asset-catalog-resource");
|
||||
const provider = new InMemoryCatalogProvider("EXTERNAL_LIBRARY");
|
||||
const resourceHash = await provider.put("library.blend", bytes);
|
||||
const resources = new AssetCatalogResourceResolver();
|
||||
resources.registerProvider(provider).setActiveLibraryContext({ libraryId: "library:wbv2-p9-003", sourceKind: "EXTERNAL", sourceId: "library.blend", generation: 1, revision: 4, readOnly: false });
|
||||
const clone = (value) => ({ entries: value.entries.map((entry) => ({ ...entry })) });
|
||||
const createMain = () => new InMemoryMainStore({ entries: [] }, 4, false, clone);
|
||||
const command = (overrides = {}) => ({
|
||||
schemaVersion: 1,
|
||||
requestId: "wbv2-p9-003-asset-append",
|
||||
commandType: "assetCatalogAppend",
|
||||
baseRevision: 4,
|
||||
context: { mainId: "main:wbv2-p9-003", targetKind: "ASSET_LIBRARY", targetId: "library:wbv2-p9-003", editMode: "EDITABLE", authorization: "USER_EDIT", source: { kind: "EXTERNAL", sha256: resourceHash }, resourceProvider: "EXTERNAL_LIBRARY" },
|
||||
payload: { id: "asset:wbv2-p9-003", name: "Production Asset", resource: { schemaVersion: 1, requestId: "wbv2-p9-003-resource", sourceKind: "EXTERNAL", sourceId: "library.blend", sha256: resourceHash } },
|
||||
...overrides,
|
||||
});
|
||||
const desktopMain = createMain();
|
||||
const wasmMain = createMain();
|
||||
const desktop = await createAssetCatalogRegistry(desktopMain, resources).dispatch("DESKTOP", { command: command(), mainRevision: 4 });
|
||||
const wasm = await createAssetCatalogRegistry(wasmMain, resources).dispatch("WASM", { command: command(), mainRevision: 4 });
|
||||
|
||||
const duplicate = await createAssetCatalogRegistry(desktopMain, resources).dispatch("DESKTOP", { command: command({ baseRevision: 5 }), mainRevision: 5 });
|
||||
const stale = await createAssetCatalogRegistry(createMain(), resources).dispatch("WASM", { command: command({ baseRevision: 3 }), mainRevision: 4 });
|
||||
const malformed = await createAssetCatalogRegistry(createMain(), resources).dispatch("DESKTOP", { command: command({ payload: { id: "bad id" } }), mainRevision: 4 });
|
||||
const missingResources = new AssetCatalogResourceResolver();
|
||||
missingResources.setActiveLibraryContext({ libraryId: "library:wbv2-p9-003", sourceKind: "EXTERNAL", sourceId: "library.blend", generation: 1, revision: 4, readOnly: false });
|
||||
const missing = await createAssetCatalogRegistry(createMain(), missingResources).dispatch("WASM", { command: command(), mainRevision: 4 });
|
||||
|
||||
const history = new CorrectiveHistoryStore({ entries: [] }, 4, false, clone);
|
||||
await createAssetCatalogRegistry(history, resources).dispatch("WASM", { command: command(), mainRevision: 4 });
|
||||
const saved = history.save();
|
||||
const postSave = await createAssetCatalogRegistry(history, resources).dispatch("DESKTOP", { command: command({ requestId: "wbv2-p9-003-asset-post-save", baseRevision: 5, payload: { id: "asset:post-save", name: "Post Save Asset", resource: { schemaVersion: 1, requestId: "wbv2-p9-003-resource-post-save", sourceKind: "EXTERNAL", sourceId: "library.blend", sha256: resourceHash } } }), mainRevision: 5 });
|
||||
const beforeReopen = history.snapshot();
|
||||
history.reopen();
|
||||
const reopened = history.snapshot();
|
||||
return {
|
||||
resource: { sourceId: "library.blend", sha256: resourceHash, byteLength: bytes.byteLength, provider: "EXTERNAL_LIBRARY" },
|
||||
positive: { desktop: desktop.result, wasm: wasm.result, desktopMain: desktopMain.snapshot(), wasmMain: wasmMain.snapshot(), parity: JSON.stringify(desktop.result) === JSON.stringify(wasm.result) && JSON.stringify(desktopMain.snapshot()) === JSON.stringify(wasmMain.snapshot()) },
|
||||
negative: { duplicate: duplicate.result, stale: stale.result, malformed: malformed.result, missing: missing.result },
|
||||
persistence: { saved, postSave: postSave.result, beforeReopen, reopened, exact: JSON.stringify(saved) === JSON.stringify(reopened) },
|
||||
};
|
||||
});
|
||||
fs.mkdirSync(evidenceRoot, { recursive: true });
|
||||
const output = process.env.WBV2_ASSET_PRODUCTION_REPORT ?? "chromium-asset-catalog-production.json";
|
||||
fs.writeFileSync(path.join(evidenceRoot, output), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P9-003", operation: "ASSET_CATALOG_PRODUCTION_CHROMIUM", browser: "chromium", queueMutation: false, ...report }, null, 2)}\n`);
|
||||
|
||||
expect(report.positive.parity).toBe(true);
|
||||
expect(report.positive.desktop.status).toBe("FINISHED");
|
||||
expect(report.positive.wasm.status).toBe("FINISHED");
|
||||
expect(report.positive.desktop.delta).toEqual({ addedId: "asset:wbv2-p9-003", count: 1 });
|
||||
expect(report.positive.desktop.mainRevisionAfter).toBe(5);
|
||||
expect(report.positive.wasm).toEqual(report.positive.desktop);
|
||||
expect(report.resource.provider).toBe("EXTERNAL_LIBRARY");
|
||||
expect(report.resource.sha256).toMatch(/^[a-f0-9]{64}$/u);
|
||||
expect(report.resource.byteLength).toBe(27);
|
||||
expect(report.positive.desktopMain.value.entries[0].sourceSha256).toBe(report.resource.sha256);
|
||||
expect(report.negative.duplicate.code).toBe("COMMAND_UNSUPPORTED");
|
||||
expect(report.negative.stale.code).toBe("REVISION_CONFLICT");
|
||||
expect(report.negative.malformed.code).toBe("COMMAND_MALFORMED");
|
||||
expect(report.negative.missing.code).toBe("RESOURCE_REQUIRED");
|
||||
expect(report.negative.missing.mainRevisionAfter).toBe(4);
|
||||
expect(report.persistence.exact).toBe(true);
|
||||
expect(report.persistence.reopened).toEqual(report.persistence.saved);
|
||||
});
|
||||
65
web/tests/e2e/wbv2-mesh-production.spec.ts
Normal file
65
web/tests/e2e/wbv2-mesh-production.spec.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const evidenceRoot = path.resolve(import.meta.dirname, "../../../tests/golden/WBV2-P9-001");
|
||||
|
||||
test("WBV2-P9-001 production Chromium Mesh receipt is exact and fail-closed", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const report = await page.evaluate(async () => {
|
||||
const { CorrectiveHistoryStore, createMeshMain, createMeshRegistry } = await import("/src/corrective-pilot-bridge.ts");
|
||||
const fixture = [{ id: "vertex:0", x: 1, y: 2, z: 3 }, { id: "vertex:1", x: 0, y: 0, z: 0 }];
|
||||
const command = (overrides = {}) => ({
|
||||
schemaVersion: 1,
|
||||
requestId: "wbv2-p9-001-mesh-translate",
|
||||
commandType: "meshTranslateVertex",
|
||||
baseRevision: 9,
|
||||
context: { mainId: "main:wbv2-p9-001", targetKind: "MESH", targetId: "mesh:cube", editMode: "EDITABLE", authorization: "USER_EDIT", source: { kind: "LOCAL", sha256: "b".repeat(64) } },
|
||||
payload: { vertexId: "vertex:0", delta: { x: 0.5, y: -1, z: 2 } },
|
||||
...overrides,
|
||||
});
|
||||
const clone = (value) => ({ vertices: value.vertices.map((vertex) => ({ ...vertex })) });
|
||||
const desktopMain = createMeshMain(fixture, 9, false);
|
||||
const wasmMain = createMeshMain(fixture, 9, false);
|
||||
const desktop = await createMeshRegistry(desktopMain).dispatch("DESKTOP", { command: command(), mainRevision: 9 });
|
||||
const wasm = await createMeshRegistry(wasmMain).dispatch("WASM", { command: command(), mainRevision: 9 });
|
||||
|
||||
const rollbackMain = createMeshMain(fixture, 9, false);
|
||||
const rollbackRegistry = createMeshRegistry(rollbackMain);
|
||||
const malformed = await rollbackRegistry.dispatch("DESKTOP", { command: command({ payload: { vertexId: "vertex:0", delta: { x: 0.5, y: -1, z: 2, w: 1 } } }), mainRevision: 9 });
|
||||
const stale = await rollbackRegistry.dispatch("WASM", { command: command({ baseRevision: 8 }), mainRevision: 9 });
|
||||
const unknown = await rollbackRegistry.dispatch("DESKTOP", { command: command({ payload: { vertexId: "vertex:missing", delta: { x: 0.5, y: -1, z: 2 } } }), mainRevision: 9 });
|
||||
|
||||
const history = new CorrectiveHistoryStore({ vertices: fixture }, 9, false, clone);
|
||||
await createMeshRegistry(history).dispatch("WASM", { command: command(), mainRevision: 9 });
|
||||
const saved = history.save();
|
||||
const postSave = await createMeshRegistry(history).dispatch("DESKTOP", { command: command({ requestId: "wbv2-p9-001-mesh-post-save", baseRevision: 10, payload: { vertexId: "vertex:1", delta: { x: 4, y: 0, z: 0 } } }), mainRevision: 10 });
|
||||
const beforeReopen = history.snapshot();
|
||||
history.reopen();
|
||||
const reopened = history.snapshot();
|
||||
const exact = JSON.stringify(saved) === JSON.stringify(reopened);
|
||||
return {
|
||||
fixture,
|
||||
positive: { desktop: desktop.result, wasm: wasm.result, desktopMain: desktopMain.snapshot(), wasmMain: wasmMain.snapshot(), parity: JSON.stringify(desktop.result) === JSON.stringify(wasm.result) && JSON.stringify(desktopMain.snapshot()) === JSON.stringify(wasmMain.snapshot()) },
|
||||
negative: { malformed: malformed.result, stale: stale.result, unknown: unknown.result, rollbackMain: rollbackMain.snapshot() },
|
||||
persistence: { saved, postSave: postSave.result, beforeReopen, reopened, exact },
|
||||
};
|
||||
});
|
||||
fs.mkdirSync(evidenceRoot, { recursive: true });
|
||||
const output = process.env.WBV2_MESH_PRODUCTION_REPORT ?? "chromium-mesh-production.json";
|
||||
fs.writeFileSync(path.join(evidenceRoot, output), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P9-001", operation: "MESH_PRODUCTION_CHROMIUM", browser: "chromium", queueMutation: false, ...report }, null, 2)}\n`);
|
||||
|
||||
expect(report.positive.parity).toBe(true);
|
||||
expect(report.positive.desktop.status).toBe("FINISHED");
|
||||
expect(report.positive.wasm.status).toBe("FINISHED");
|
||||
expect(report.positive.desktop.delta).toEqual({ vertexId: "vertex:0", before: { x: 1, y: 2, z: 3 }, after: { x: 1.5, y: 1, z: 5 } });
|
||||
expect(report.positive.desktop.mainRevisionBefore).toBe(9);
|
||||
expect(report.positive.desktop.mainRevisionAfter).toBe(10);
|
||||
expect(report.positive.wasm).toEqual(report.positive.desktop);
|
||||
expect(report.persistence.exact).toBe(true);
|
||||
expect(report.persistence.reopened).toEqual(report.persistence.saved);
|
||||
expect(report.negative.malformed.code).toBe("COMMAND_MALFORMED");
|
||||
expect(report.negative.stale.code).toBe("REVISION_CONFLICT");
|
||||
expect(report.negative.unknown.code).toBe("COMMAND_UNSUPPORTED");
|
||||
expect(report.negative.rollbackMain).toEqual({ value: { vertices: [{ id: "vertex:0", x: 1, y: 2, z: 3 }, { id: "vertex:1", x: 0, y: 0, z: 0 }] }, revision: 9, dirty: false });
|
||||
});
|
||||
64
web/tests/e2e/wbv2-modifier-production.spec.ts
Normal file
64
web/tests/e2e/wbv2-modifier-production.spec.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const evidenceRoot = path.resolve(import.meta.dirname, "../../../tests/golden/WBV2-P9-002");
|
||||
|
||||
test("WBV2-P9-002 production Chromium Modifier receipt is exact and fail-closed", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
const report = await page.evaluate(async () => {
|
||||
const { CorrectiveHistoryStore, createModifierMain, createModifierRegistry } = await import("/src/corrective-pilot-bridge.ts");
|
||||
const fixture = [{ uuid: "modifier:bevel", name: "Pilot Bevel", type: "BEVEL", enabled: false, showViewport: true, showRender: true }];
|
||||
const command = (overrides = {}) => ({
|
||||
schemaVersion: 1,
|
||||
requestId: "wbv2-p9-002-modifier-enabled",
|
||||
commandType: "modifierSetEnabled",
|
||||
baseRevision: 7,
|
||||
context: { mainId: "main:wbv2-p9-002", targetKind: "MODIFIER", targetId: "modifier:bevel", editMode: "EDITABLE", authorization: "USER_EDIT", source: { kind: "LOCAL", sha256: "a".repeat(64) } },
|
||||
payload: { modifierUuid: "modifier:bevel", enabled: true },
|
||||
...overrides,
|
||||
});
|
||||
const clone = (value) => ({ modifiers: value.modifiers.map((modifier) => ({ ...modifier })) });
|
||||
const desktopMain = createModifierMain(fixture, 7, false);
|
||||
const wasmMain = createModifierMain(fixture, 7, false);
|
||||
const desktop = await createModifierRegistry(desktopMain).dispatch("DESKTOP", { command: command(), mainRevision: 7 });
|
||||
const wasm = await createModifierRegistry(wasmMain).dispatch("WASM", { command: command(), mainRevision: 7 });
|
||||
|
||||
const rollbackMain = createModifierMain(fixture, 7, false);
|
||||
const rollbackRegistry = createModifierRegistry(rollbackMain);
|
||||
const malformed = await rollbackRegistry.dispatch("DESKTOP", { command: command({ payload: { modifierUuid: "modifier:bevel", enabled: true, unexpected: true } }), mainRevision: 7 });
|
||||
const stale = await rollbackRegistry.dispatch("WASM", { command: command({ baseRevision: 6 }), mainRevision: 7 });
|
||||
const unknown = await rollbackRegistry.dispatch("DESKTOP", { command: command({ payload: { modifierUuid: "modifier:missing", enabled: true } }), mainRevision: 7 });
|
||||
|
||||
const history = new CorrectiveHistoryStore({ modifiers: fixture }, 7, false, clone);
|
||||
await createModifierRegistry(history).dispatch("WASM", { command: command(), mainRevision: 7 });
|
||||
const saved = history.save();
|
||||
const postSave = await createModifierRegistry(history).dispatch("DESKTOP", { command: command({ requestId: "wbv2-p9-002-modifier-post-save", baseRevision: 8, payload: { modifierUuid: "modifier:bevel", enabled: false } }), mainRevision: 8 });
|
||||
const beforeReopen = history.snapshot();
|
||||
history.reopen();
|
||||
const reopened = history.snapshot();
|
||||
return {
|
||||
fixture,
|
||||
positive: { desktop: desktop.result, wasm: wasm.result, desktopMain: desktopMain.snapshot(), wasmMain: wasmMain.snapshot(), parity: JSON.stringify(desktop.result) === JSON.stringify(wasm.result) && JSON.stringify(desktopMain.snapshot()) === JSON.stringify(wasmMain.snapshot()) },
|
||||
negative: { malformed: malformed.result, stale: stale.result, unknown: unknown.result, rollbackMain: rollbackMain.snapshot() },
|
||||
persistence: { saved, postSave: postSave.result, beforeReopen, reopened, exact: JSON.stringify(saved) === JSON.stringify(reopened) },
|
||||
};
|
||||
});
|
||||
fs.mkdirSync(evidenceRoot, { recursive: true });
|
||||
const output = process.env.WBV2_MODIFIER_PRODUCTION_REPORT ?? "chromium-modifier-production.json";
|
||||
fs.writeFileSync(path.join(evidenceRoot, output), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P9-002", operation: "MODIFIER_PRODUCTION_CHROMIUM", browser: "chromium", queueMutation: false, ...report }, null, 2)}\n`);
|
||||
|
||||
expect(report.positive.parity).toBe(true);
|
||||
expect(report.positive.desktop.status).toBe("FINISHED");
|
||||
expect(report.positive.wasm.status).toBe("FINISHED");
|
||||
expect(report.positive.desktop.delta).toEqual({ modifierUuid: "modifier:bevel", previousEnabled: false, enabled: true });
|
||||
expect(report.positive.desktop.mainRevisionBefore).toBe(7);
|
||||
expect(report.positive.desktop.mainRevisionAfter).toBe(8);
|
||||
expect(report.positive.wasm).toEqual(report.positive.desktop);
|
||||
expect(report.persistence.exact).toBe(true);
|
||||
expect(report.persistence.reopened).toEqual(report.persistence.saved);
|
||||
expect(report.negative.malformed.code).toBe("COMMAND_MALFORMED");
|
||||
expect(report.negative.stale.code).toBe("REVISION_CONFLICT");
|
||||
expect(report.negative.unknown.code).toBe("COMMAND_UNSUPPORTED");
|
||||
expect(report.negative.rollbackMain).toEqual({ value: { modifiers: [{ uuid: "modifier:bevel", name: "Pilot Bevel", type: "BEVEL", enabled: false, showViewport: true, showRender: true }] }, revision: 7, dirty: false });
|
||||
});
|
||||
Reference in New Issue
Block a user