13 lines
6.6 KiB
JavaScript
13 lines
6.6 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 [['api',qa,'stock-period-result.json',28],['ui',qa,'stock-period-ui.json',12],['queries',qa,'stock-period-queries.json',2],['guards',qa,'stock-period-guards.json',3],['demo',demo,'stock-period-demo.json',7]]){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/StockPeriodReport.php','app/Modules/Inventory/CompositionStockRead.php','app/Modules/Identity/Services/IdentityWorkflow.php','config/receipt_qa.php','resources/js/StockPeriodReportWorkspace.jsx','resources/js/stock-period-request.js','resources/js/StockMenuWorkspace.jsx'];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('73a9188da342'),'app'),unchanged=['packages/inventory-read/src/InventoryReader.php','packages/inventory-read/src/InventoryReadSession.php','app/Modules/Purchasing/ReceiptRuntime.php','app/Modules/Purchasing/ReceiptController.php','app/Modules/Purchasing/StockReceiptTraceController.php','resources/js/app.jsx','resources/js/context-transition.js','app/Shared/Context/ModuleNavigation.php'];for(const file of unchanged)assert.equal(hash(file),hash(path.join(prior,file)),file);
|
|
const guard=s=>{s=s.replaceAll('\r\n','\n');return s.slice(s.indexOf(' $host=DB::connection();'),s.indexOf(' $result='));};assert.equal(guard(fs.readFileSync('app/Modules/Inventory/CompositionStockRead.php','utf8')),guard(fs.readFileSync(path.join(prior,'app/Modules/Inventory/CompositionStockRead.php'),'utf8')));
|
|
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 [file,h]of Object.entries(read(path.join(root(demo),dir,'manifest.json')).files))assert.equal(hash(path.join(root(demo),dir,file)),h);}assert.deepEqual(pins,read('docs/proofs/stock-receipt-trace-20261103.json').pinned_native_manifests);
|
|
const previous=['docs/proofs/stock-receipt-trace-20261103.json','docs/proofs/stock-composed-source-20261103.json','docs/proofs/module-association-consolidation-summary-20261102.json'].map(file=>({file,sha256:hash(file)})),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 manifest='public/build/manifest.json',entry=read(manifest)['resources/js/app.jsx'].file;for(const tag of [qa,demo]){assert.equal(hash(manifest),hash(path.join(root(tag),'app',manifest)));assert.equal(hash('public/build/'+entry),hash(path.join(root(tag),'app/public/build',entry)));}
|
|
assert.equal(tests.demo.result.before,tests.demo.result.after);assert.equal(tests.api.result.read_fingerprint_before,tests.api.result.read_fingerprint_after_before_explicit_append);
|
|
const out='docs/proofs/stock-period-report-20261103.json';assert(!fs.existsSync(out));fs.writeFileSync(out,JSON.stringify({date:new Date().toISOString(),increment:'SGF-STOCK-PERIOD-REPORT-QA-v1',passed:true,functional_code:true,checks:52,tests,sources:sources.map(file=>({file,sha256:hash(file)})),unchanged_authority:unchanged.map(file=>({file,sha256:hash(file)})),existing_physical_source_and_permission_guard_unchanged:true,pinned_native_manifests:pins,build:{manifest_sha256:hash(manifest),entry_sha256:hash('public/build/'+entry)},demo:{port:8085,entry:'http://127.0.0.1:8085/qa/enter/validator?module=stock&open=1',navigate:'Stock > Relatórios > Movimentos de stock',initial_main_requests:0,initial_movements:0},prior_proofs_preserved:previous,preservation:{installed_purchasing_sha256:hash('packages/purchasing/current.json'),new_permission_names:[],new_real_grants:false,stock_reader_grants_widened:false,source_package_modified:false,new_source_or_target_indexes:false,target_database_connected:false,protected_six_records_changed:false,blocked_cache_cleared:false,previous_demo_data_written:false,publication:false,checkpoint:false},limitations:['UTC registration timestamps are used, not effective receipt dates. Deployment must validate the source timestamp convention; current QA source application is configured UTC.','Opening/entries/issues/closing are quantities per article and warehouse. Current item/warehouse metadata are shown; no cross-unit grand total, valuation, reservation, blocked or available quantity is inferred.','105 eligible pairs with114 initial SQL fixture movements; one explicit additional append verifies reference invalidation. These fixtures are not business receipts, stock-operation workflow proofs or financial transactions.','Existing receipt and Stock-trace proofs are reused without rerunning commands or suites.','Five projection SELECTs were observed for both25 and100 rows. This excludes host authentication, middleware and source-identity checks, and is not sustained load, memory profiling or deployment capacity evidence.','SQL aggregates examine the authorised history to the closing boundary with a3-second statement timeout; only the requested page is materialised in PHP. Large histories may time out and require later measurement.','12 UI checks use asynchronous reply simulation and actual React server rendering; no browser visual proof. New report dates are selected explicitly.','Three guards are direct report/adapter probes, not middleware. A harness bootstrap initially loaded duplicate copies of an unchanged reader class; corrected by loading the adapter bootstrap once before those guards.','Document-level period export/printing, historical names, other Stock reports, visual review, accessibility, sustained load and operational deployment remain pending.'],visual_review_pending:true,deployment_capacity_validated:false},null,2)+'\n');console.log(JSON.stringify({output:out,checks:52,demo_port:8085}));
|