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-security-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 security verification is not passing.'); if (report.checks?.path !== 5 || report.checks.archiveEntries !== 3 || report.checks.xmlBytes <= 0 || report.checks.permissionChecks !== 3 || report.checks.rejectedCases !== 4 || report.checks.pass !== true) throw new Error('QA-07 security preflight evidence is incomplete.'); if (report.persistence?.mode !== 'sqlite-opfs' || report.persistence.byteLength <= 0 || report.persistence.roundTrip !== true || report.persistence.released !== true) throw new Error('QA-07 OPFS resource evidence is incomplete.'); if (report.opfs?.markerSuite !== 'QA-07' || report.opfs.checks !== 4 || report.opfs.markerRemoved !== true) throw new Error('QA-07 OPFS marker evidence is incomplete.'); if (report.afterRelease?.shapeCount !== 0 || report.afterRelease.kernelReferenceCount !== 0) throw new Error('QA-07 harness leaked ShapeHandles.'); console.log(JSON.stringify({ status: 'chrome-security-pass', browser: report.browser.product, checks: report.checks, persistence: report.persistence, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
