15 lines
5.8 KiB
JavaScript
15 lines
5.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 [qa,demo]=process.argv.slice(2);for(const tag of [qa,demo])assert(/^[a-f0-9]{12}$/.test(tag??''));
|
|
const run=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json')),root=tag=>path.join(run.root,'private/receipt-composition-'+tag),read=p=>JSON.parse(fs.readFileSync(p,'utf8')),hash=p=>crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex');
|
|
const tests={};for(const [name,tag,file,count]of [['integration',qa,'composition-stock-result.json',31],['demo',demo,'composition-stock-demo.json',10]]){const p=path.join(root(tag),file),r=read(p);assert(r.passed);assert.equal(r.checks.length,count);tests[name]={file:'private/'+path.basename(root(tag))+'/'+file,sha256:hash(p),checks:count,result:r};}
|
|
const sources=['app/Modules/Inventory/CompositionStockRead.php','app/Modules/Inventory/StockReadController.php','config/receipt_qa.php'];for(const tag of [qa,demo])for(const file of sources)assert.equal(hash(file),hash(path.join(root(tag),'app',file)),file);
|
|
const prior=path.join(root('f3ce5f53dab4'),'app'),authority=['resources/js/StockReadWorkspace.jsx','resources/js/StockMenuWorkspace.jsx','resources/js/app.jsx','app/Modules/Purchasing/ReceiptRuntime.php','app/Modules/Purchasing/ReceiptController.php'];
|
|
for(const file of authority){assert.equal(hash(file),hash(path.join(prior,file)),file);for(const tag of [qa,demo])assert.equal(hash(file),hash(path.join(root(tag),'app',file)),file);}
|
|
for(const [relative,pin]of Object.entries(read('docs/proofs/stock-read-composition-20261102.json').package.files)){const file='packages/inventory-read/'+relative;assert.equal(hash(file),pin);for(const tag of [qa,demo])assert.equal(hash(file),hash(path.join(root(tag),'app',file)));authority.push(file);}
|
|
const writer='packages/inventory-write/src/ReceiptMovementWriter.php',installedWriter='packages/inventory-write/releases/0.1.0/src/ReceiptMovementWriter.php';assert.equal(hash(writer),read('docs/proofs/stock-receipt-link-20261102.json').source_hashes[writer]);for(const tag of [qa,demo])assert.equal(hash(writer),hash(path.join(root(tag),'app',installedWriter)));assert.equal(hash(writer),hash(path.join(prior,installedWriter)));authority.push(writer);
|
|
const pins={};for(const dir of ['bundle','economic','internal']){pins[dir]=hash(path.join(root(demo),dir,'manifest.json'));assert.equal(pins[dir],hash(path.join(root(qa),dir,'manifest.json')));for(const tag of [qa,demo])for(const [file,h]of Object.entries(read(path.join(root(tag),dir,'manifest.json')).files))assert.equal(hash(path.join(root(tag),dir,file)),h);}
|
|
const previous=['docs/proofs/obligation-evidence-workspace-20261103.json','docs/proofs/stock-receipt-link-20261102.json','docs/proofs/module-association-consolidation-summary-20261102.json'].map(file=>({file,sha256:hash(file)}));
|
|
assert.deepEqual(pins,read(previous[0].file).pinned_native_manifests);const assoc=read(previous[2].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 server=read(path.join(root(demo),'demo-server.json'));assert.equal(server.port,8083);
|
|
const out='docs/proofs/stock-composed-source-20261103.json';assert(!fs.existsSync(out));fs.writeFileSync(out,JSON.stringify({date:new Date().toISOString(),increment:'SGF-STOCK-COMPOSED-SOURCE-QA-v1',passed:true,functional_code:true,checks:41,tests,sources:sources.map(file=>({file,sha256:hash(file)})),unchanged_authority_and_ui:authority.map(file=>({file,sha256:hash(file)})),pinned_native_manifests:pins,behaviour:{same_native_receipt_book:true,no_balance_copy:true,separate_select_only_source_role:true,no_native_writer_mutex_on_read:true,shared_host_authority_locks:true,append_only_trigger_only_in_new_qa_books:true,snapshot_bound_to_session_context:true,explicit_warehouse_mapping:true,default_disabled:true},demo:{port:8083,entry:'http://127.0.0.1:8083/qa/enter/validator?module=stock&open=1',navigate:'Stock > Existências',initial_main_requests:0,initial_receipts:0,initial_movements:0},prior_proofs_preserved:previous,preservation:{installed_purchasing_sha256:hash('packages/purchasing/current.json'),new_permission_names:[],existing_qa_right:'stock.view',target_database_connected:false,protected_six_records_changed:false,blocked_cache_cleared:false,previous_demo_data_written:false,real_grants:false,publication:false,checkpoint:false},limitations:['One minimal request/sourcing/order setup supplies the changed receipt-to-Stock boundary. Earlier suites are reused, not counted or repeated.','31 integration assertions and10 demo/guard assertions; two guards invoke the adapter directly and do not measure middleware.','The first integration attempt stopped on a denial-status assertion: module isolation returned409 before the stock permission check. The completed source order was reused; no second order was issued.','Existing Stock React UI, navigation and shared reader are unchanged; served asset checks are not visual review.','Tenant catalogue is tenant-wide; movements and warehouses are restricted to the explicitly mapped warehouses.','Only physical quantities are supplied. Available/reserved/blocked quantities, valuation, costing, financial effects and direct document access are not added.','Append-only SQL trigger and existing stock.view grant apply only to fresh QA fixtures. No target schema or installed operational binding was changed.','No sustained load, deployment compatibility or deployment capacity claim follows from these tests.'],visual_review_pending:true,deployment_capacity_validated:false},null,2)+'\n');console.log(JSON.stringify({output:out,checks:41,demo_port:8083}));
|