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-addon-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 addon governance verification is not passing.'); if (report.catalog?.installed !== 1 || report.catalog.revision !== 1 || report.catalog.rollbackVersion !== '1.0.0') throw new Error('Addon update/rollback evidence is incomplete.'); if (!report.security?.forgedRejected || !report.security.permissionRejected || !report.security.removed) throw new Error('Addon security evidence is incomplete.'); if (report.persistence?.mode !== 'sqlite-opfs' || report.persistence.byteLength <= 0 || report.persistence.roundTrip !== true || report.persistence.released !== true) throw new Error('Addon OPFS resource evidence is incomplete.'); if (report.opfs?.markerSuite !== 'ADDON-ALL' || report.opfs.markerInstalled !== 1 || report.opfs.markerRemoved !== true) throw new Error('Addon OPFS marker evidence is incomplete.'); if (report.afterRelease?.shapeCount !== 0 || report.afterRelease.kernelReferenceCount !== 0) throw new Error('Addon harness leaked ShapeHandles.'); console.log(JSON.stringify({ status: 'chrome-addon-pass', browser: report.browser.product, catalog: report.catalog, security: report.security, persistence: report.persistence, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
