39 lines
4.3 KiB
JavaScript
39 lines
4.3 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import crypto from 'node:crypto';
|
|
import {spawnSync} from 'node:child_process';
|
|
const read=p=>JSON.parse(fs.readFileSync(p,'utf8').replace(/^\uFEFF/,''));
|
|
const hash=p=>crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');
|
|
const state=read('C:/laragon/data/sgf-tempo/run/modular-regression-current.json');
|
|
const measurement=path.resolve(process.argv[2]||''),functional=path.resolve(process.argv[3]||'');
|
|
for(const p of [measurement,functional])if(path.dirname(p)!==path.resolve(state.root)||!/^stock-read-\d+\.(json|xml)$/.test(path.basename(p)))throw Error('Unexpected private proof');
|
|
const metrics=read(measurement);
|
|
if(hash('packages/inventory-read/src/InventoryReader.php')!==metrics.source_sha256||metrics.profiles.length!==24)throw Error('Source/measurement mismatch');
|
|
const junit=p=>{
|
|
const xml=fs.readFileSync(p,'utf8'),suite=xml.match(/<testsuite\b([^>]*)>/)?.[1];
|
|
const n=k=>Number(suite?.match(new RegExp('\\b'+k+'="(\\d+)"'))?.[1]);
|
|
if(!n('tests')||n('errors')||n('failures'))throw Error('Invalid JUnit');
|
|
return {tests:n('tests'),assertions:n('assertions'),errors:n('errors'),failures:n('failures'),sha256:hash(p)};
|
|
};
|
|
const previous=read('docs/proofs/module-association-http-lock-summary-20261102.json');
|
|
for(const p of [previous.proof,...previous.previous_proofs])if(hash(p.path)!==p.sha256)throw Error('Prior evidence changed');
|
|
for(const p of metrics.profiles)if(p.samples.length!==3||p.samples.some(s=>s.queries>=35))throw Error('Incomplete load profile');
|
|
const post=spawnSync('C:/laragon/tools/sgf-tempo/php-8.4.27/php.exe',['scripts/stock-read-state.php'],{encoding:'utf8',windowsHide:true});
|
|
if(post.status!==0)throw Error('QA rights restoration postcheck failed');
|
|
const preservation=JSON.parse(post.stdout);
|
|
const files=['packages/inventory-read/src/InventoryReader.php','app/Modules/Inventory/StockReadController.php','config/stock_read.php','resources/js/StockReadWorkspace.jsx','resources/js/StockMenuWorkspace.jsx','routes/web.php','app/Shared/Context/ModuleNavigation.php'];
|
|
const summary={date:'2026-11-02',increment:'SGF-STOCK-READ-SIM-v1',status:'partial_synthetic_sgf_read_adapter',
|
|
tests:{initial_stock_suite:junit(measurement.replace(/\.json$/,'.xml')),final_functional:junit(functional),navigation:junit(path.join(state.root,'junit-focused.xml'))},
|
|
provenance:{reader_sha256:metrics.source_sha256,measured_controller_sha256:metrics.controller_sha256,final_controller_sha256:hash(files[1]),
|
|
followup:'Error handling for missing/incompatible source and timeout added after load measurement; successful query path/reader unchanged. Final functional cases rerun; load not repeated.'},
|
|
profiles:metrics.profiles.map(p=>({...p,queries:[...new Set(p.samples.map(s=>s.queries))],max_incremental_php_bytes:Math.max(...p.samples.map(s=>s.incremental_php_bytes))})),
|
|
measured_requests:72,full_balance_page_traversal:[1000,5000,10000],indexes:'Primary keys only; no experimental or destination indexes',sources:Object.fromEntries(files.map(p=>[p,hash(p)])),
|
|
preservation:{...preservation,protected_six_records_untouched:true,blocked_cache_untouched:true,previous_proof_hashes_unchanged:true,qa_fixtures_retained:true,real_or_demo_database_connected:false,
|
|
public_rights_changed:false,purchasing_source_modified:false,purchasing_activated:false,publication:false,checkpoint:false},
|
|
limits:['Testing-only source bindings, empty by default. No existing demo updated.','Shared read projection uses Purchasing ledger structure; Purchasing HTTP adapter/two-host parity remains pending.',
|
|
'Physical stock only; reservations, blocked, available and valuation not established.','No stock commands, receipt/consumption linkage or journal engine added.','Static UI/build is not visual review; warm in-process load is not deployment capacity.'],visual_review_pending:true,deployment_capacity_validated:false};
|
|
fs.copyFileSync(measurement,'docs/proofs/stock-read-load-20261102.json');
|
|
fs.writeFileSync('docs/proofs/stock-read-summary-20261102.json',JSON.stringify(summary,null,2)+'\n');
|
|
fs.writeFileSync('docs/proofs/stock-read-postcheck-20261102.json',JSON.stringify(preservation,null,2)+'\n');
|
|
console.log(JSON.stringify({tests:summary.tests,measured_requests:72,profiles:metrics.profiles.length,temporary_rights_remaining:preservation.temporary_stock_grants_remaining,prior_proofs_unchanged:true,status:summary.status},null,2));
|