import { expect, test } from "@playwright/test"; test("M13-03G recovers a denied script in a new generation with a continuous audit chain", async ({ page }) => { await page.goto("/"); const result = await page.evaluate(() => new Promise>((resolve, reject) => { const worker = new Worker("/src/workers/script-sandbox-recovery-test.worker.ts", { type: "module" }); worker.onmessage = (event: MessageEvent>) => { worker.terminate(); resolve(event.data); }; worker.onerror = (event) => { worker.terminate(); reject(new Error(event.message)); }; worker.postMessage({ type: "recover" }); })); expect(result.receipt).toMatchObject({ schemaVersion: 1, operation: "SCRIPT_SANDBOX_RECOVERY", previousGeneration: 4, nextGeneration: 5, mainRevisionBefore: 11, mainRevisionAfter: 11, recovered: true, execution: "DISABLED" }); expect(result.receipt.audit.entries).toBe(2); expect(result.receipt.audit.first.sequence).toBe(1); expect(result.receipt.audit.second.sequence).toBe(2); expect(result.receipt.audit.second.previousEntrySha256).toBe(result.receipt.audit.first.entrySha256); expect(result.receipt.audit.first.requestId).not.toBe(result.receipt.audit.second.requestId); expect(result.receipt.audit.first.sourceSha256).toBe(result.receipt.audit.second.sourceSha256); expect(result.receipt.audit.first.manifestSha256).toBe(result.receipt.audit.second.manifestSha256); expect(result.replayError).toBe("SCRIPT_MANIFEST_INVALID"); expect(result.tamperError).toBe("SCRIPT_MANIFEST_INVALID"); });