import { readFile } from 'node:fs/promises'
import { resolve } from 'node:path'
const report = JSON.parse(await readFile(resolve(new URL('..', import.meta.url).pathname, 'config/chrome-native-mirrored-history-verification.json'), 'utf8'))
if (report.status !== 'pass' || report.browserId !== 'chrome' || report.nativeCapabilities?.operations?.includes('mirrored') !== true || report.history?.recordCount <= 0 || JSON.stringify(report.history?.sourceObjects) !== JSON.stringify(['Base']) || report.result?.bitbybitSolids !== 1 || Math.abs(report.result.bitbybitVolume - 3) > 1e-7 || report.result?.nativeStructuralValid !== true || report.result?.nativeSolids !== 1 || Math.abs(report.result.nativeVolume - 3) > 1e-7 || report.opfs?.markerRemoved !== true || report.afterRelease?.shapeCount !== 0 || report.afterRelease?.kernelReferenceCount !== 0) throw new Error('Chrome native Mirrored evidence is invalid.')
console.log(JSON.stringify({ status: 'chrome-native-mirrored-history-pass', records: report.history.recordCount, relations: report.history.relations, result: report.result, afterRelease: report.afterRelease }, null, 2))
