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 isolation required'); $s=json_decode(file_get_contents(__DIR__.'/option-B3-project-progress.json'),true,512,JSON_THROW_ON_ERROR); $d=$db->table('documents')->where('id',$s['document_id'])->first(); $p=['at'=>gmdate('c'),'target'=>$t,'operation'=>'Read-only QA scanner health and own document','host'=>config('services.malware.host'), 'port'=>config('services.malware.port'),'max_signature_age_hours'=>config('services.malware.max_signature_age_hours'), 'health'=>app(App\Services\Malware\MalwareScanner::class)->health(),'document_status'=>$d->status, 'document_scan'=>$d->malware_scan_status,'document_sha256'=>trim($d->sha256),'active_changes'=>0,'jobs_consumed'=>0, 'browser_observed'=>false,'C135_distinct'=>true]; $phase=$argv[1]??'before';if(!in_array($phase,['before','after','ready'],true))throw new RuntimeException('Unknown diagnosis phase'); $dest=__DIR__.'/option-B3-scanner-diagnosis'.($phase==='before'?'':'-'.$phase).'.json'; if(is_file($dest))throw new RuntimeException('Preserve recorded diagnosis'); file_put_contents($dest,json_encode($p,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo json_encode($p).PHP_EOL;