6 lines
5.9 KiB
JavaScript
6 lines
5.9 KiB
JavaScript
import fs from 'node:fs';import path from 'node:path';import crypto from 'node:crypto';import assert from 'node:assert/strict';
|
|
const [qaTag,demoTag]=process.argv.slice(2);assert([qaTag,demoTag].every(t=>/^[a-f0-9]{12}$/.test(t??'')));const run=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json')),qa=path.join(run.root,'private/receipt-composition-'+qaTag),demo=path.join(run.root,'private/receipt-composition-'+demoTag),read=p=>JSON.parse(fs.readFileSync(p,'utf8')),hash=p=>crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');const tests={};for(const [name,base,file,count]of [['request',qa,'request-result.json',30],['integrated_source_to_receipt',qa,'sourcing-result.json',47],['guards',qa,'request-guards.json',3],['demonstration',demo,'request-demo-smoke.json',11],['assets',demo,'request-demo-assets.json',3],['package_freeze',demo,'package-freeze.json',3],['navigation','.','docs/proofs/request-home-20261103.json',6]]){const p=path.join(base,file),r=read(p);assert(r.passed);assert.equal(Array.isArray(r.checks)?r.checks.length:r.checks,count);tests[name]={file:base==='.'?file:'private/'+path.basename(base)+'/'+file,sha256:hash(p),checks:count,result:r};}assert.equal(Object.values(tests).reduce((n,t)=>n+t.checks,0),103);
|
|
const files=['app/Modules/Purchasing/RequestController.php','app/Modules/Purchasing/RequisitionAccess.php','app/Modules/Purchasing/SourcingController.php','app/Modules/Purchasing/OrderController.php','app/Modules/Purchasing/ReceiptController.php','app/Modules/Purchasing/ReceiptRuntime.php','config/receipt_qa.php','routes/web.php','app/Shared/Context/ModuleNavigation.php','app/Modules/Identity/Services/IdentityWorkflow.php','resources/js/PurchasingHome.jsx','resources/views/request-workspace.blade.php','public/request-workspace.mjs','scripts/order-native-setup.php','scripts/request-host-setup.php','scripts/request-composition-proof.php','scripts/request-sourcing-resume.php','scripts/receipt-composition-run.mjs','scripts/receipt-composition-http.php','scripts/sourcing-composition-proof.php'];const sources=files.map(file=>({file,sha256:hash(file)}));for(const base of [qa,demo])for(const file of files.filter(f=>!f.startsWith('scripts/')))assert.equal(hash(path.join(base,'app',file)),hash(file));
|
|
const manifests=[];for(const base of [qa,demo]){const m={};for(const dir of ['bundle','economic','internal']){const file=path.join(base,dir,'manifest.json');m[dir]=hash(file);for(const [name,pin]of Object.entries(read(file).files))assert.equal(hash(path.join(base,dir,name)),pin);}manifests.push(m);}assert.deepEqual(manifests[0],manifests[1]);const prior=['docs/proofs/supplier-composition-20261103.json','docs/proofs/sourcing-composition-20261103.json','docs/proofs/order-composition-20261103.json','docs/proofs/receipt-composition-20261103.json','docs/proofs/module-association-consolidation-summary-20261102.json'].map(file=>({file,sha256:hash(file)}));const supplier=read(prior[0].file);assert.equal(hash('packages/purchasing/current.json'),supplier.preservation.installed_purchasing_sha256);const assoc=read(prior.at(-1).file);assert.equal(hash('app/Modules/Identity/Services/ModuleAssociationReview.php'),assoc.source_sha256);assert.equal(hash('app/Modules/Identity/Http/ModuleRecordsController.php'),assoc.controller_sha256);
|
|
const out='docs/proofs/request-to-receipt-composition-20261103.json';assert(!fs.existsSync(out));fs.writeFileSync(out,JSON.stringify({date:new Date().toISOString(),increment:'SGF-REQUEST-TO-RECEIPT-QA-v1',passed:true,functional_code:true,checks:103,tests,sources,pinned_manifests:manifests[0],single_authority:{native_request_id_preserved:true,native_reservation_once:true,native_commitment_once:true,host_budget_unchanged:true,legacy_ir_transferred:false},demo:{url:'http://127.0.0.1:8068/qa/enter/requester?open=1',approver_url:'http://127.0.0.1:8068/qa/enter/approver?open=1',buyer_url:'http://127.0.0.1:8068/qa/enter/actor?open=1',finance_url:'http://127.0.0.1:8068/qa/enter/issuer?open=1',warehouse_url:'http://127.0.0.1:8068/qa/enter/validator?open=1',initial_main_requests:0,initial_main_reserved_minor:0,initial_main_committed_minor:0},qa_rights:['purchasing_requests.view','purchasing_requests.prepare','purchasing_requests.submit','purchasing_requests.approve'],prior_proofs_preserved:prior,diagnostics:{initial_test_host_table_name_corrected:'cb_budget_entries; initial error before commands',dependent_runner_now_requires_completed_request_proof:true,source_approval_replay_test_corrected_to_actual_department_head:true,source_first37_valid_checks_retained:true,remaining10_source_checks_resumed:true,replay_probe:'QA encrypted envelope reconstructed from the exact historical decision receipt; no workflow decision repeated'},preservation:{installed_purchasing_sha256:hash('packages/purchasing/current.json'),protected_six_records_changed:false,blocked_cache_cleared:false,real_rights_changed:false,target_database_connected:false,previous_demo_data_written:false,destination_activated:false,publication:false,checkpoint:false},limitations:['This delivers new requisitions through the SGF interface on the same native book; it does not migrate previously reserved SGF ir_requests.','Fresh synthetic identities for requester, department head, buyer, finance and warehouse. Native approvals/budget rules remain authoritative; no real grants or configuration.','Selected QA path100MZN, three proposals and original source-to-receipt workflow. Equipment/technical catalogues, formal regimes and later corrections are not declared complete.','Read/history workspace exposes recent25 request events; full native history remains retained.','Rollback-only previews may consume sequence values; no external notification channel is used.','No visual review, sustained-load or deployment-capacity validation.'],visual_review_pending:true,deployment_capacity_validated:false},null,2)+'\n');console.log(JSON.stringify({output:out,checks:103,demo_port:8068}));
|