import fs from 'node:fs';import path from 'node:path';import {spawnSync} from 'node:child_process'; const state=JSON.parse(fs.readFileSync('C:/laragon/data/sgf-tempo/run/modular-regression-current.json','utf8')),tag=process.argv[2];if(state.port!==55439||!/^[a-f0-9]{12}$/.test(tag||''))throw Error('Owned native QA tag required');const root=path.join(state.root,'private/payable-history-'+tag),settings=path.join(root,'settings.json');const owned=JSON.parse(fs.readFileSync(settings,'utf8'));if(owned.tag!==tag||owned.cluster!=='sgf_modular_regression_'+state.id)throw Error('Wrong owned cluster'); for(const volume of [1000,5000,10000]){ for(const [phase,value] of [['native-page-seed',String(volume)],...['legacy','page25','page100','invoice'].map(s=>['native-page-bench',s])]){const started=Date.now(),r=spawnSync('C:/laragon/tools/sgf-tempo/php-8.4.27/php.exe',['-d','memory_limit=512M','scripts/payable-history-sgf-proof.php',settings,phase,value],{encoding:'utf8',windowsHide:true,maxBuffer:1024*1024});fs.writeFileSync(path.join(root,phase+'-'+volume+'-'+value+'-'+started+'.log'),(r.stdout||'')+(r.stderr||''));const output=path.join(root,phase==='native-page-seed'?'native-page-volume.json':`native-bench-${volume}-${value}.json`);if(r.status!==0||!fs.existsSync(output)||fs.statSync(output).mtimeMsJSON.parse(fs.readFileSync(path.join(root,`native-bench-${volume}-${s}.json`),'utf8'));const old=read('legacy');for(const size of [25,100])if(old.document_fingerprints[size]!==read('page'+size).document_fingerprints[size])throw Error('Native source window differs');const one=read('invoice');if(one.original_position_fingerprint!==old.original_position_fingerprint||one.original_balance_minor!==3000)throw Error('Native invoice monetary result differs');console.log(JSON.stringify({volume,native_documents_and_original_position_equal:true,indices_added:false})); }