3 lines
8.4 KiB
JavaScript
3 lines
8.4 KiB
JavaScript
import fs from 'node:fs';import path from 'node:path';import {spawnSync} from 'node:child_process';
|
|
const [tag,file]=process.argv.slice(2);if(!/^[a-f0-9]{12}$/.test(tag??'')||!['stock-period-guards.php','stock-period-query-proof.php','stock-period-proof.php','stock-period-demo.php','stock-trace-demo.php','composition-stock-demo.php','composition-stock-proof.php','obligation-evidence-demo.php','invoice-progress-demo.php','request-history-demo.php','request-history-finalize.php','request-history-proof.php','purchasing-continuity-demo.php','continuity-boundaries.php','receipt-ui-source.php','purchasing-focus-demo.php','receipt-documents-extra.php','receipt-documents-resume.php','receipt-documents-guards.php','receipt-documents-proof.php','receipt-documents-demo.php','supplier-documents-integration.php','supplier-documents-resume.php','supplier-documents-proof.php','supplier-documents-guards.php','supplier-documents-demo.php','receipt-workspace-proof.php','receipt-workspace-seed.php','receipt-workspace-demo.php','receipt-workspace-guards.php','dossier-demo-proof.php','dossier-guard-proof.php','supplier-search-guard.php','supplier-search-proof.php','supplier-search-seed.php','supplier-search-demo.php','purchasing-integrated-resume.php','purchasing-navigation-guard.php','purchasing-integrated-proof.php','purchasing-integrated-smoke.php','obligation-boundary-proof.php','obligation-replay-proof.php','obligation-guard-proof.php','obligation-composition-proof.php','obligation-demo-smoke.php','invoice-boundary-proof.php','invoice-composition-proof.php','invoice-guard-proof.php','invoice-demo-smoke.php','geography-pagination-proof.php','geography-composition-proof.php','geography-demo-smoke.php','geography-guard-proof.php','request-sourcing-resume.php','request-composition-proof.php','sourcing-composition-proof.php','request-guard-proof.php','request-demo-smoke.php','supplier-guard-proof.php','supplier-boundary-proof.php','supplier-demo-smoke.php'].includes(file))throw Error('Explicit QA proof required');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')));if(!s.suppliers&&!s.invoices)throw Error('Supplier QA fixture required');const result=spawnSync('C:/laragon/tools/sgf-tempo/php-8.4.27/php.exe',[path.resolve('scripts',file)],{cwd:s.app,env:s.env,encoding:'utf8',windowsHide:true,timeout:180000});fs.writeFileSync(path.join(root,file+'.log'),result.stdout+'\n'+result.stderr);if(file==='continuity-boundaries.php'&&!fs.existsSync(path.join(root,'continuity-boundaries.json')))throw Error('Continuity boundary proof incomplete');if(file==='receipt-ui-source.php'&&!fs.existsSync(path.join(root,'receipt-ui-source.json')))throw Error('Receipt UI source incomplete');if(file==='obligation-evidence-demo.php'&&!fs.existsSync(path.join(root,'obligation-evidence-demo.json')))throw Error('Evidence demo incomplete');if(file==='invoice-progress-demo.php'&&!fs.existsSync(path.join(root,'invoice-progress-demo.json')))throw Error('Matching demo incomplete');if(file==='request-history-demo.php'&&!fs.existsSync(path.join(root,'request-history-demo.json')))throw Error('Request history demo incomplete');if(file==='request-history-finalize.php'&&!fs.existsSync(path.join(root,'request-history-result.json')))throw Error('Request history final proof incomplete');if(file==='request-history-proof.php'&&!fs.existsSync(path.join(root,'request-history-result.json')))throw Error('Request history proof incomplete');if(file==='purchasing-continuity-demo.php'&&!fs.existsSync(path.join(root,'purchasing-continuity-demo.json')))throw Error('Continuity demonstration incomplete');if(file==='purchasing-focus-demo.php'&&!fs.existsSync(path.join(root,'purchasing-focus-demo.json')))throw Error('Focus demo proof incomplete');if(!['purchasing-focus-demo.php','purchasing-continuity-demo.php'].includes(file)&&file.startsWith('purchasing-')&&!fs.existsSync(path.join(root,({'purchasing-integrated-resume.php':'integrated-result.json','purchasing-integrated-proof.php':'integrated-result.json','purchasing-integrated-smoke.php':'integrated-smoke.json','purchasing-navigation-guard.php':'integrated-navigation-guard.json'})[file])))throw Error('Integrated proof incomplete; inspect private diagnostics');if(file.startsWith('obligation-')&&!fs.existsSync(path.join(root,({'obligation-evidence-demo.php':'obligation-evidence-demo.json','obligation-composition-proof.php':'obligation-result.json','obligation-boundary-proof.php':'obligation-boundaries.json','obligation-replay-proof.php':'obligation-replay.json','obligation-guard-proof.php':'obligation-guards.json','obligation-demo-smoke.php':'obligation-demo-smoke.json'})[file])))throw Error('Obligation proof incomplete; inspect private diagnostics');if(file.startsWith('receipt-documents-')&&!fs.existsSync(path.join(root,({'receipt-documents-extra.php':'receipt-documents-extra.json','receipt-documents-resume.php':'receipt-documents-result.json','receipt-documents-proof.php':'receipt-documents-result.json','receipt-documents-guards.php':'receipt-documents-guards.json','receipt-documents-demo.php':'receipt-documents-demo.json'})[file])))throw Error('Receipt documents proof incomplete; private diagnostics preserved');if(file==='supplier-documents-integration.php'&&!fs.existsSync(path.join(root,'supplier-documents-integration.json')))throw Error('Supplier document integration incomplete');if(file==='supplier-documents-resume.php'&&!fs.existsSync(path.join(root,'supplier-documents-result.json')))throw Error('Supplier document resume incomplete');if(file==='supplier-documents-proof.php'&&!fs.existsSync(path.join(root,'supplier-documents-result.json')))throw Error('Supplier document proof incomplete');if(file==='supplier-documents-guards.php'&&!fs.existsSync(path.join(root,'supplier-documents-guards.json')))throw Error('Supplier document guard proof incomplete');if(file==='supplier-documents-demo.php'&&!fs.existsSync(path.join(root,'supplier-documents-demo.json')))throw Error('Supplier document demo incomplete');if(file==='receipt-workspace-proof.php'&&!fs.existsSync(path.join(root,'receipt-workspace-result.json')))throw Error('Receipt workspace proof incomplete');if(file==='receipt-workspace-demo.php'&&!fs.existsSync(path.join(root,'receipt-workspace-demo.json')))throw Error('Receipt workspace demo incomplete');if(file==='receipt-workspace-guards.php'&&!fs.existsSync(path.join(root,'receipt-workspace-guards.json')))throw Error('Receipt workspace guards incomplete');if(file==='dossier-demo-proof.php'&&!fs.existsSync(path.join(root,'dossier-demo-result.json')))throw Error('Dossier demonstration incomplete');if(file==='dossier-guard-proof.php'&&!fs.existsSync(path.join(root,'dossier-guard-result.json')))throw Error('Dossier guard proof incomplete');if(file==='supplier-search-guard.php'&&!fs.existsSync(path.join(root,'supplier-search-guard.json')))throw Error('Supplier selector guard proof incomplete');if(file==='supplier-search-proof.php'&&!fs.existsSync(path.join(root,'supplier-search-result.json')))throw Error('Supplier search proof incomplete');if(file==='supplier-search-demo.php'&&!fs.existsSync(path.join(root,'supplier-search-demo.json')))throw Error('Supplier search smoke incomplete');if(file==='invoice-composition-proof.php'&&!fs.existsSync(path.join(root,'invoice-result.json')))throw Error('Invoice proof incomplete; inspect private diagnostics');if(file==='stock-period-guards.php'&&!fs.existsSync(path.join(root,'stock-period-guards.json')))throw Error('Period guards incomplete');if(file==='stock-period-query-proof.php'&&!fs.existsSync(path.join(root,'stock-period-queries.json')))throw Error('Period query proof incomplete');if(file==='stock-period-proof.php'&&!fs.existsSync(path.join(root,'stock-period-result.json')))throw Error('Period proof incomplete');if(file==='stock-period-demo.php'&&!fs.existsSync(path.join(root,'stock-period-demo.json')))throw Error('Period demo incomplete');if(file==='stock-trace-demo.php'&&!fs.existsSync(path.join(root,'stock-trace-demo.json')))throw Error('Trace demo incomplete');if(file==='composition-stock-demo.php'&&!fs.existsSync(path.join(root,'composition-stock-demo.json')))throw Error('Stock demo incomplete');if(file==='composition-stock-proof.php'&&!fs.existsSync(path.join(root,'composition-stock-result.json')))throw Error('Stock proof incomplete');if(result.status!==0)throw Error('Proof failed; private diagnostics preserved: '+file);console.log(result.stdout.trim()||file+' passed');
|