'native.'.$t,['invoices','pa_obligations','pa_sources','pa_commands','sc_catalogue_meta','sc_catalogue_versions','sc_catalogue_commands'])));$before=[];$order=fn($table)=>in_array($table,['sr_outbox','sr_deliveries'],true)?'event_id':($table==='sc_catalogue_meta'?'policy':'id');foreach($qualified as$key){[$name,$table]=explode('.',$key);$db=$name==='host'?$host:$native;$before[$name][$table]=$db->table($table)->orderBy($order($table))->get()->toJson();}$binding=hash_file('sha256',$s['root'].'/binding.json');file_put_contents($work.'/preservation-private.json',json_encode($before)); $old=str_replace("\r\n","\n",file_get_contents($s['app'].'/app/Modules/Purchasing/ComposedFinanceController.php'));$new=str_replace("\r\n","\n",file_get_contents($repo.'/app/Modules/Purchasing/ComposedFinanceController.php'));$start=' public function command(';if(substr($old,strpos($old,$start))!==substr($new,strpos($new,$start)))throw new LogicException('Financial command changed'); $files=['routes/web.php','app/Modules/Purchasing/PayablePositionReadController.php','app/Modules/Purchasing/ComposedFinanceController.php','app/Shared/Context/ModuleNavigation.php','resources/js/app.jsx','resources/js/WorkspaceNavigation.jsx','resources/js/PayablePositionsWorkspace.jsx','resources/js/payable-position-view.js'];foreach($files as$file)if(str_ends_with($file,'.php'))(new Symfony\Component\Process\Process([PHP_BINARY,'-l',$repo.'/'.$file]))->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-payable-positions-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($order($table))->get()->toJson()!==$json)throw new LogicException('Original facts changed '.$table);$checks[]=$name.'.'.$table;}}if($binding!==hash_file('sha256',$s['root'].'/binding.json'))throw new LogicException('Binding changed');file_put_contents($work.'/payable-positions-installation.json',json_encode(['passed'=>true,'hashes'=>$hashes,'identical_original_tables'=>$checks,'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.'/payable-positions-installation.json']).PHP_EOL;