10 lines
3.3 KiB
PHP
10 lines
3.3 KiB
PHP
<?php
|
|
$book='8085';require __DIR__.'/sgf-single-bootstrap.php';
|
|
foreach([$s['root'].'/accounting-reports-preinstall-20261110.json',$s['root'].'/accounting-reports-ui-20261110.json',$run['root'].'/private/receipt-composition-b4093c6f6707/single-integration/20261110-205824-49693644/accounting-report-boundaries.json']as$file)if((json_decode(file_get_contents($file),true)['passed']??false)!==true)throw new LogicException('Affected proof missing');
|
|
$previous=json_decode(file_get_contents($s['root'].'/single-integration/20261110-205202-210c8f94/overview-installation.json'),true);$before=[];foreach($previous['identical_original_tables']as$qualified){[$name,$table]=explode('.',$qualified);$db=$name==='host'?$host:$native;$before[$name][$table]=$db->table($table)->orderBy('id')->get()->toJson();}
|
|
$binding=hash_file('sha256',$s['root'].'/binding.json');$engine=hash_file('sha256',$repo.'/packages/general-ledger/src/LedgerReports.php');$controller='app/Modules/Accounting/ComposedLedgerController.php';$withoutReport=fn($source)=>preg_replace('~ public function report\(.*?\n public function stockCommand~s',' public function stockCommand',str_replace("\r\n","\n",$source));if($withoutReport(file_get_contents($repo.'/'.$controller))!==$withoutReport(file_get_contents($s['app'].'/'.$controller)))throw new LogicException('Unrelated controller differences require preservation');
|
|
$files=[$controller,'resources/js/app.jsx','resources/js/AccountingMenuWorkspace.jsx','resources/js/ComposedAccountingWorkspace.jsx','resources/js/LedgerReportsWorkspace.jsx','resources/js/ledger-report-view.js'];(new Symfony\Component\Process\Process([PHP_BINARY,'-l',$repo.'/'.$controller]))->mustRun();$hashes=[];$copy=function($src,$file)use($s,$work,&$hashes){$dest=$s['app'].'/'.$file;$backup=$work.'/before/'.$file;if(is_file($dest)){if(!is_dir(dirname($backup)))mkdir(dirname($backup),0700,true);copy($dest,$backup);}if(!is_dir(dirname($dest)))mkdir(dirname($dest),0700,true);copy($src,$dest);$hashes[$file]=hash_file('sha256',$dest);};foreach($files as$file)$copy($repo.'/'.$file,$file);
|
|
$build=$run['root'].'/private/single-accounting-reports-build-20261110';$manifest=json_decode(file_get_contents($build.'/manifest.json'),true);$assets=[];foreach($manifest as$entry){$assets[]=$entry['file'];foreach($entry['css']??[]as$file)$assets[]=$file;}foreach(array_unique($assets)as$file){if(!preg_match('~^assets/[a-zA-Z0-9_.-]+$~D',$file))throw new LogicException('Asset path invalid');$copy($build.'/'.$file,'public/build/'.$file);}$copy($build.'/manifest.json','public/build/manifest.json');
|
|
$checks=[];foreach($before as$name=>$tables){$db=$name==='host'?$host:$native;foreach($tables as$table=>$json){if($db->table($table)->orderBy('id')->get()->toJson()!==$json)throw new LogicException('Original data changed '.$table);$checks[]=$name.'.'.$table;}}
|
|
if($binding!==hash_file('sha256',$s['root'].'/binding.json'))throw new LogicException('Binding changed');file_put_contents($work.'/accounting-reports-installation.json',json_encode(['passed'=>true,'hashes'=>$hashes,'identical_original_tables'=>$checks,'ledger_report_engine_sha256'=>$engine,'business_commands'=>0,'new_grants'=>0,'new_demo'=>false,'cache_cleared'=>false,'native_writes'=>0,'binding_unchanged'=>true],JSON_PRETTY_PRINT));echo json_encode(['passed'=>true,'proof'=>$work.'/accounting-reports-installation.json']).PHP_EOL;
|