8 lines
4.8 KiB
JavaScript
8 lines
4.8 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'),tests={};
|
|
for(const [name,base,file,count]of [['api',qa,'supplier-search-result.json',31],['guards',qa,'supplier-search-guard.json',3],['selection_model','.','docs/proofs/supplier-picker-model-20261103.json',8],['demo',demo,'supplier-search-demo.json',6],['assets',demo,'supplier-search-assets.json',3]]){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};}
|
|
const files=['app/Modules/Purchasing/SourcingController.php','app/Modules/Purchasing/SupplierAccess.php','app/Modules/Purchasing/ReceiptRuntime.php','public/sourcing-workspace.mjs','public/supplier-picker-model.mjs','routes/web.php'];for(const base of [qa,demo])for(const f of files)assert.equal(hash(path.join(base,'app',f)),hash(f),f);
|
|
const pins=[];for(const base of [qa,demo]){const p={};for(const dir of ['bundle','economic','internal']){p[dir]=hash(path.join(base,dir,'manifest.json'));for(const [f,h]of Object.entries(read(path.join(base,dir,'manifest.json')).files))assert.equal(hash(path.join(base,dir,f)),h);}pins.push(p);}assert.deepEqual(pins[0],pins[1]);assert.deepEqual(pins[0],read('docs/proofs/purchasing-integrated-composition-20261103.json').pinned_native_manifests);
|
|
const previous=['docs/proofs/purchasing-integrated-composition-20261103.json','docs/proofs/supplier-obligation-composition-20261103.json','docs/proofs/module-association-consolidation-summary-20261102.json'].map(file=>({file,sha256:hash(file)})),assoc=read(previous.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);assert.equal(hash('packages/purchasing/current.json'),read(previous[0].file).preservation.installed_purchasing_sha256);
|
|
const checks=Object.values(tests).reduce((n,t)=>n+t.checks,0);assert.equal(checks,51);const out='docs/proofs/supplier-search-composition-20261103.json';assert(!fs.existsSync(out));fs.writeFileSync(out,JSON.stringify({date:new Date().toISOString(),increment:'SGF-SOURCING-SUPPLIER-SEARCH-QA-v1',passed:true,functional_code:true,checks,tests,sources:files.map(file=>({file,sha256:hash(file)})),pinned_native_manifests:pins[0],selector:{eligible_suppliers:125,synthetic_extra_directory_rows:127,server_page_sizes:[25,100],literal_name_or_nuit_search:true,manual_choice:true,selected_revision_rechecked:true,request_scope_reused:true,new_permission_names:[],api_projection:['id','name','nuit','version','selection_revision']},demo:{port:8073,entry:'http://127.0.0.1:8073/qa/enter/requester?open=1',buyer:'http://127.0.0.1:8073/qa/enter/actor?open=1',initial_main_requests:0,initial_quotes:0,locations:0,synthetic_directory_seed:true},prior_proofs_preserved:previous,preservation:{installed_purchasing_sha256:hash('packages/purchasing/current.json'),target_database_connected:false,protected_six_records_changed:false,blocked_cache_cleared:false,previous_demo_data_written:false,public_rights_changed:false,publication:false,checkpoint:false},limitations:['Selector and quotation boundary verified; existing downstream suites were reused rather than repeated.','Legacy show response retains a bounded25-row supplier summary. The current interface uses the paged endpoint and never treats that summary as the complete directory.','Older direct clients may omit supplier_revision when preparing; the server still captures the current supplier fingerprint in every new preview and rechecks it before a new confirmation. Current interface also sends the fingerprint selected from the page.','Recorded same-key command receipts remain historical results, after current rights and origin checks; they do not execute a new quote when supplier facts subsequently change.','Extra directory records and scope audit markers are explicit synthetic fixture data, not130 newly onboarded supplier reviews or real company associations.','No new indexes, deployment activation, payment, accounting or real operations.','Visual review, sustained-load measurements and deployment/least-privilege capability remain pending.'],visual_review_pending:true,deployment_capacity_validated:false},null,2)+'\n');console.log(JSON.stringify({output:out,checks,demo_port:8073}));
|