Files
Web_FreeCAD_Bitbybit/scripts/check-chrome-robot.mjs

8 lines
1.7 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-robot-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 Robot verification is not passing.')
if (!report.geometry?.valid || report.trajectory?.joints !== 3 || report.trajectory.waypoints !== 2 || report.trajectory.poses !== 5 || report.trajectory.status !== 'generated' || report.trajectory.violations !== 0 || report.trajectory.maxReach !== 6 || report.trajectory.homeX !== 6 || report.trajectory.collisions < 1 || report.trajectory.controllerBytes <= 0 || report.trajectory.csvBytes <= 0) throw new Error('Robot trajectory/kinematics/workspace/collision/controller 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('Robot OPFS evidence is incomplete.')
if (report.opfs?.markerSuite !== 'ROBOT-ALL' || report.opfs.poses !== 5 || report.opfs.markerRemoved !== true || report.afterRelease?.shapeCount !== 0 || report.afterRelease.kernelReferenceCount !== 0) throw new Error('Robot lifecycle evidence is incomplete.')
console.log(JSON.stringify({ status: 'chrome-robot-pass', browser: report.browser.product, geometry: report.geometry, trajectory: report.trajectory, persistence: report.persistence, opfs: report.opfs, afterRelease: report.afterRelease }, null, 2))