15 lines
4.3 KiB
JavaScript
15 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/,'')),sha=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],team=process.argv[3];
|
|
if(state.port!==55439||![tag,team].every(t=>/^[a-f0-9]{12}$/.test(t??''))||tag===team)throw Error('Separate owned regression/team tags required');
|
|
const output='docs/proofs/sgf-financial-ledger-flow-20261102.json';if(fs.existsSync(output))throw Error('Completed consolidation preserved');
|
|
const root=path.join(state.root,'private/ledger-'+tag),demoRoot=path.join(state.root,'private/ledger-'+team),files=['ledger-flow-http.json','ledger-flow-cases.json','ledger-flow-focus-cases.json'];
|
|
const proofs=files.map(f=>read(path.join(root,f))),demo=read(path.join(demoRoot,'ledger-flow-demo-http.json'));if(![...proofs,demo].every(p=>p.passed))throw Error('Missing successful integration evidence');
|
|
const priorPaths=['docs/proofs/common-ledger-payable-20261102.json','docs/proofs/sgf-payable-paged-read-20261102.json','docs/proofs/sgf-payable-report-20261102.json','docs/proofs/sgf-settlement-read-isolation-20261102.json','docs/proofs/module-association-consolidation-summary-20261102.json'];
|
|
const old=read(priorPaths[0]);for(const p of old.evidence){const file=path.resolve(state.root,p.file);if(!file.startsWith(path.resolve(state.root)+path.sep)||sha(file)!==p.sha256)throw Error('Previous ledger artifact changed: '+p.file);}
|
|
const sourceFiles=['app/Modules/Accounting/GeneralLedger.php','app/Modules/Accounting/GeneralLedgerController.php','app/Modules/Purchasing/SupplierPayablesController.php','packages/general-ledger/src/PayableJournal.php','packages/payables/ui/page.php','routes/web.php','resources/views/accounting/general-ledger.blade.php','resources/views/accounting/payable-flow.blade.php','resources/views/accounting/payable-flow-entry.blade.php','scripts/ledger-proof.php','scripts/ledger-run.mjs','scripts/ledger-http-entry.php','scripts/ledger-flow-http.mjs','scripts/ledger-flow-cases.php','scripts/ledger-flow-focus-cases.php','scripts/ledger-flow-demo-check.mjs','scripts/summarize-ledger-flow.mjs','docs/SGF_FINANCIAL_LEDGER_FLOW_DELIVERY.md','docs/GENERAL_LEDGER_COMPLETE_SYNTHETIC_SCOPE.md'];
|
|
let php=0,js=0;for(const file of sourceFiles){const isPhp=file.endsWith('.php')&&!file.endsWith('.blade.php'),isJs=file.endsWith('.mjs');if(!isPhp&&!isJs)continue;const r=spawnSync(isPhp?'C:/laragon/tools/sgf-tempo/php-8.4.27/php.exe':process.execPath,[isPhp?'-l':'--check',file],{encoding:'utf8',windowsHide:true});if(r.status!==0)throw Error('Syntax check failed: '+file);isPhp?php++:js++;}
|
|
const artifact=f=>({file:path.relative(state.root,f).replaceAll('\\','/'),sha256:sha(f)});
|
|
const result={increment:'SGF-PAYABLE-LEDGER-FLOW-SIM-v1',date:'2026-11-02',synthetic_only:true,actual_functional_code:true,tests:{http:proofs[0],isolation:proofs[1],two_effect_focus:proofs[2],team_readiness:demo,total_new_checks:[...proofs,demo].reduce((n,p)=>n+p.checks,0),previous_suites_reused_not_rerun:true,syntax:{php_files:php,javascript_files:js}},evidence:[...files.map(f=>artifact(path.join(root,f))),artifact(path.join(demoRoot,'ledger-flow-demo-http.json'))],previous_proofs:priorPaths.map(file=>({file,sha256:sha(file)})),previous_ledger_artifact_hashes_verified:old.evidence.length,sources:sourceFiles.map(file=>({file,sha256:sha(file)})),team_demo:{...read(path.join(demoRoot,'ledger-demo.json')),starts_before_recognition:true,regression_database_separate:true},limits:{live_purchasing_source:false,complete_erp:false,payment_accounting:false,journal_correction:false,period_closing:false,native_ledger_adapter:false,visual_review_pending:true,deployment_capacity_validated:false,new_performance_measurements:false},preservation:{six_pending_associations_untouched:true,blocked_cache_not_cleared:true,existing_demos_preserved:true,real_rights_changed:false,operational_migrations:false,purchasing_activation:false,publication:false,checkpoint:false}};
|
|
fs.writeFileSync(output,JSON.stringify(result,null,2)+'\n');console.log(JSON.stringify({output,new_checks:result.tests.total_new_checks,old_ledger_artifacts_verified:old.evidence.length,syntax:result.tests.syntax,url:demo.url}));
|