selectOne('SELECT current_database() AS database,inet_server_port() AS port'); if($t!==['database'=>'stability_consumers_20261011_084534_test','port'=>55441])throw new RuntimeException('QA only'); $db->beginTransaction();$db->statement('SET TRANSACTION READ ONLY'); try{ $id='06b2d5d7-98ad-48db-b732-8a70b2f5eb4c';$r=Illuminate\Http\Request::create('/carteira/'.$id,'GET');$r->setUserResolver(fn()=>null); try{app(App\Http\Controllers\InvestmentPortfolioController::class)->show($r,$id);$proof=['result'=>'controller_did_not_reproduce'];} catch(Throwable$e){ $safe=null;if(preg_match('/(?:column|relation) [^\r\n]{1,180}(?:does not exist|is ambiguous)/',$e->getMessage(),$m))$safe=$m[0]; $frames=[];foreach($e->getTrace()as$f)if(isset($f['file'])&&str_starts_with(str_replace('\\','/',$f['file']),str_replace('\\','/',$b6QA).'/app/'))$frames[]=['file'=>str_replace('\\','/',substr($f['file'],strlen($b6QA)+1)),'line'=>$f['line']??null,'method'=>($f['class']??'').'::'.($f['function']??'')]; $proof=['result'=>'cause_reproduced_read_only','exception_class'=>get_class($e),'code'=>(string)$e->getCode(),'safe_schema_message'=>$safe,'application_frames'=>$frames]; } $proof+=['at'=>gmdate('c'),'target'=>$t,'SQL_read_only'=>true,'active_writes'=>0,'stack_arguments_or_SQL_values_exported'=>false]; $dest=__DIR__.'/option-B6-portfolio-cause.json';if(is_file($dest))throw new RuntimeException('Preserve diagnosis');file_put_contents($dest,json_encode($proof,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR));echo json_encode($proof,JSON_UNESCAPED_UNICODE).PHP_EOL; }finally{$db->rollBack();}