Files
SGF/scripts/summarize-settlement-read.mjs
2026-11-04 09:37:20 +02:00

23 lines
4.1 KiB
JavaScript

import fs from 'node:fs';import path from 'node:path';import crypto from 'node:crypto';
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'),tag=process.argv[2];
if(state.port!==55439||!/^[a-f0-9]{12}$/.test(tag??''))throw Error('Owned QA tag required');
const root=path.join(state.root,'private/settlement-page-'+tag),owned=read(path.join(root,'settings.json'));
if(owned.tag!==tag||owned.cluster!=='sgf_modular_regression_'+state.id)throw Error('Owned cluster mismatch');
const cases=read(path.join(root,'settlement-read-cases.json')),race=read(path.join(root,'settlement-read-race.json')),http=read(path.join(root,'settlement-read-http.json')),post=read(path.join(root,'settlement-read-post.json'));
if(!cases.passed||cases.cases.some(c=>!c.passed)||!race.passed||!http.passed||!post.passed||!post.pending_decision_absent||!post.financial_fingerprint_equal||!race.reader_completed_before_release||race.read.writer_lock_queries!==0||race.confirmation_after_release.decisions!==1||race.confirmation_after_release.allocations_for_target!==1||!race.confirmation_after_release.replayed)throw Error('Incomplete proof');
const previous='docs/proofs/sgf-settlement-paged-read-20261102.json',prior=read(previous);
for(const p of prior.evidence)if(hash(path.join(state.root,p.file))!==p.sha256)throw Error('Earlier private proof changed');
for(const p of prior.prior_proofs_preserved)if(hash(p.file)!==p.sha256)throw Error('Earlier proof chain changed');
if(post.old_post_file_sha256!==hash(path.join(root,'settlement-post.json')))throw Error('Old post proof changed');
const files=['packages/payables/src/Payables.php','packages/payables/src/SupplierSettlements.php','packages/payables/src/SettlementHttp.php','app/Modules/Purchasing/SupplierPayables.php','scripts/payable-history-sgf-proof.php','scripts/settlement-page-proof.php','scripts/settlement-read-proof.php','scripts/settlement-read-cases.php','scripts/settlement-read-http.mjs','scripts/settlement-read-http-router.php','scripts/summarize-settlement-read.mjs'];
const result={increment:'SGF-SETTLEMENT-READ-ISOLATION-SIM-v1',date:'2026-11-02',synthetic_only:true,cases,race,http,preservation:post,
sources:files.map(file=>({file,sha256:hash(file)})),
evidence:['settlement-read-cases.json','settlement-read-race.json','settlement-read-http.json','settlement-read-post.json','read-http-focus.json','read-http-page.json'].map(file=>({file:'private/settlement-page-'+tag+'/'+file,sha256:hash(path.join(root,file))})),
previous_proof:{file:previous,sha256:hash(previous),all_recorded_private_evidence_hashes_preserved:true},
limits:['Only the SGF paged settlement reader explicitly opts into the dedicated read callback. Native installed package and legacy constructor/listing authorization remain unchanged.','The reader completes during an ordinary row writer lock; it can still wait on other database resources or DDL. No sustained throughput or deployment-capacity validation.','Legacy reader and command elapsed times include lock waiting; legacy also loads a different, full universe. Do not use these timings as a controlled page-speed comparison.','The parent correction and worker confirmation/replay are real common-core commands inside outer transactions that are rolled back. The original pending proposal remains undecided.','Authorization and facts are checked within a per-request snapshot; a concurrent revocation becomes visible to later requests. No frozen snapshot across human navigation.'],
new_rights:false,operational_migration:false,native_activation:false,publication:false,checkpoint:false,six_pending_associations_untouched:true,blocked_cache_untouched:true,visual_review_pending:true,deployment_capacity_validated:false};
fs.writeFileSync('docs/proofs/sgf-settlement-read-isolation-20261102.json',JSON.stringify(result,null,2)+'\n');
console.log(JSON.stringify({cases:cases.cases.length,assertions:cases.assertions,http_checks:http.checks,reader_time_ms:race.read.time_ms,confirmed_single_effect_after_release:true,earlier_proofs_preserved:true}));