import { readFile } from 'node:fs/promises'
import { resolve } from 'node:path'
const root = resolve(new URL('..', import.meta.url).pathname); const report = JSON.parse(await readFile(resolve(root, 'config/chrome-performance-verification.json'), 'utf8')); if (report.schemaVersion !== 1 || report.status !== 'pass' || report.browserId !== 'chrome' || !/Chrome/i.test(report.browser?.product || '') || report.crossOriginIsolated !== true) throw new Error('Chrome performance verification is not passing.'); if (report.benchmark?.objects !== 1000 || report.benchmark.triangles !== 1_000_000 || report.benchmark.tableCells !== 100_000 || report.benchmark.pass !== true || report.benchmark.objectMs > 2000 || report.benchmark.triangleMs > 4000 || report.benchmark.tableMs > 2000) throw new Error('QA-05 performance budget evidence is incomplete.'); if (report.benchmark.heapBytes !== null && report.benchmark.heapBytes > 512 * 1024 * 1024) throw new Error('QA-05 heap budget exceeded.'); if (report.persistence?.mode !== 'sqlite-opfs' || report.persistence.byteLength <= 0 || report.persistence.roundTrip !== true || report.persistence.released !== true) throw new Error('QA-05 OPFS resource evidence is incomplete.'); if (report.opfs?.markerSuite !== 'QA-05' || report.opfs.triangles !== 1_000_000 || report.opfs.markerRemoved !== true) throw new Error('QA-05 OPFS marker evidence is incomplete.'); if (report.afterRelease?.shapeCount !== 0 || report.afterRelease.kernelReferenceCount !== 0) throw new Error('QA-05 harness leaked ShapeHandles.'); console.log(JSON.stringify({ status: 'chrome-performance-pass', browser: report.browser.product, benchmark: report.benchmark, persistence: report.persistence, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
