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-part-primitives-verification.json'), 'utf8')) if (report.schemaVersion !== 1 || report.status !== 'pass' || report.browserId !== 'chrome' || !/Chrome/i.test(report.browser?.product || '')) throw new Error('Chrome Part primitive verification is not passing.') const expected = ['ellipsoid', 'torus', 'prism', 'wedge', 'helix'] if (JSON.stringify(report.operations?.map((operation) => operation.name)) !== JSON.stringify(expected) || !report.operations.slice(0, 4).every((operation) => operation.meshVertices >= 3 && operation.meshTriangles >= 1) || !(report.operations[4]?.length > 0)) throw new Error('Chrome Part primitive mesh/curve evidence is incomplete.') if (report.operations.find((operation) => operation.name === 'ellipsoid')?.volume <= 0 || report.operations.find((operation) => operation.name === 'torus')?.volume <= 0 || report.operations.find((operation) => operation.name === 'prism')?.volume <= 0 || report.operations.find((operation) => operation.name === 'wedge')?.volume <= 0) throw new Error('Chrome Part primitive mass evidence is incomplete.') if (report.afterRelease?.shapeCount !== 0 || report.afterRelease?.kernelReferenceCount !== 0) throw new Error('Chrome Part primitive handles were not fully released.') if (report.opfs?.markerSuite !== 'PART-ALL' || report.opfs.markerOperations !== 5 || report.opfs.markerRemoved !== true) throw new Error('Chrome Part primitive OPFS marker was not verified and removed.') console.log(JSON.stringify({ status: 'chrome-part-primitives-pass', browser: report.browser.product, operations: report.operations, afterRelease: report.afterRelease, opfs: report.opfs }, null, 2))