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-data-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 data modules verification is not passing.'); if (report.adapters?.total !== 7 || report.adapters.supported !== 4 || report.adapters.proxy !== 3 || report.records?.total !== 7 || report.records.proxy !== 3 || report.records.manifestBytes <= 0) throw new Error('Specialist data adapter coverage is incomplete.'); if (report.points?.sourceCount !== 6 || JSON.stringify(report.points.parsedFormats) !== JSON.stringify(['pts', 'pcd', 'ply']) || report.points.mergedCount !== 12 || report.points.croppedCount !== 4 || report.points.polygonCroppedCount !== 4 || report.points.reducedCount !== 1 || report.points.structured?.width !== 3 || report.points.structured?.height !== 2 || Object.values(report.points.exportBytes || {}).some((value) => value <= 0)) throw new Error('Chrome point-cloud operations evidence is incomplete.'); if (report.reverseEngineering?.planeRms > 1e-7 || Math.abs(report.reverseEngineering.sphereRadius - 2) > 1e-7 || Math.abs(report.reverseEngineering.cylinderRadius - 3) > 1e-7 || Math.abs(report.reverseEngineering.cylinderHeight - 8) > 1e-7 || report.reverseEngineering.polynomialRms > 1e-7 || report.reverseEngineering.segmentCount !== 2 || JSON.stringify(report.reverseEngineering.segmentSizes) !== JSON.stringify([2, 2])) throw new Error('Chrome reverse-engineering fit evidence is incomplete.'); if (report.persistence?.mode !== 'sqlite-opfs' || report.persistence.byteLength <= 0 || !/^[0-9a-f]{64}$/.test(report.persistence.hash) || report.persistence.roundTrip !== true || report.persistence.released !== true) throw new Error('Data modules OPFS resource evidence is incomplete.'); if (report.opfs?.markerSuite !== 'DATA-ALL' || report.opfs.records !== 7 || report.opfs.markerRemoved !== true) throw new Error('Data modules OPFS marker evidence is incomplete.'); if (report.afterRelease?.shapeCount !== 0 || report.afterRelease.kernelReferenceCount !== 0) throw new Error('Data harness leaked ShapeHandles.'); console.log(JSON.stringify({ status: 'chrome-data-pass', browser: report.browser.product, adapters: report.adapters, records: report.records, points: report.points, reverseEngineering: report.reverseEngineering, persistence: report.persistence, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
