12 lines
2.0 KiB
JavaScript
12 lines
2.0 KiB
JavaScript
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-native-chamfer-history-verification.json'), 'utf8'))
|
|
if (report.schemaVersion !== 1 || report.browserId !== 'chrome' || report.executionContext !== 'geometry-and-history-workers' || report.crossOriginIsolated !== true || report.status !== 'pass') throw new Error('Chrome native Chamfer history evidence is invalid.')
|
|
if (report.capabilities?.status !== 'ready' || report.nativeCapabilities?.availability !== 'available' || report.nativeCapabilities?.operations?.includes('chamfer') !== true) throw new Error('Native OCCT Chamfer Worker capability evidence is incomplete.')
|
|
if (!Number.isSafeInteger(report.history?.recordCount) || report.history.recordCount <= 0 || report.history.relations?.modified <= 0 || report.history.relations?.generated <= 0 || report.history.relations?.deleted <= 0 || JSON.stringify(report.history.sourceObjects) !== JSON.stringify(['Base'])) throw new Error('Native OCCT Chamfer relation evidence is incomplete.')
|
|
if (report.result?.structuralValid !== true || report.result?.solids !== 1 || !(report.result.volume > 0 && report.result.volume < 216)) throw new Error('Native OCCT Chamfer result evidence is invalid.')
|
|
if (report.opfs?.markerCreated !== true || report.opfs?.markerSuite !== 'chamfer' || report.opfs?.markerRemoved !== true) throw new Error('Chrome native Chamfer OPFS evidence is incomplete.')
|
|
if (report.afterRelease?.shapeCount !== 0 || report.afterRelease?.kernelReferenceCount !== 0) throw new Error('Chrome native Chamfer history handles were not released.')
|
|
console.log(JSON.stringify({ status: 'chrome-native-chamfer-history-pass', browserId: report.browserId, occtVersion: report.nativeCapabilities.occtVersion, records: report.history.recordCount, relations: report.history.relations, volume: report.result.volume, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))
|