Files
SGF/scripts/receipt-workspace-source-check.mjs
2026-11-04 09:37:20 +02:00

3 lines
1.1 KiB
JavaScript

import fs from 'node:fs';import path from 'node:path';import crypto from 'node:crypto';import assert from 'node:assert/strict';
const tag=process.argv[2];assert(/^[a-f0-9]{12}$/.test(tag??''));const run=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json')),root=path.join(run.root,'private/receipt-composition-'+tag),s=JSON.parse(fs.readFileSync(path.join(root,'state.json'))),out=path.join(root,'receipt-workspace-final-source.json');assert(s.receiptWorkspace&&!fs.existsSync(out));const r=await fetch('http://127.0.0.1:8075/receipt-workspace.mjs');assert.equal(r.status,200);const hash=b=>crypto.createHash('sha256').update(b).digest('hex'),pin=hash(fs.readFileSync('public/receipt-workspace.mjs'));assert.equal(hash(Buffer.from(await r.arrayBuffer())),pin);assert.equal(hash(fs.readFileSync(path.join(s.app,'public/receipt-workspace.mjs'))),pin);fs.writeFileSync(out,JSON.stringify({passed:true,checks:['final warehouse script served identically after deferring catalogue queries until line selection'],sha256:pin,visual_review:false},null,2));console.log(JSON.stringify({passed:true,checks:1}));