selectOne('SELECT current_database() AS database, inet_server_port() AS port');if($target!==['database'=>'stability_consumers_20261011_084534_test','port'=>55441])throw new RuntimeException('QA only'); $db->beginTransaction();$db->statement('SET TRANSACTION READ ONLY'); try{ $u=App\Models\User::findOrFail(17);$r=App\Models\InterestRequest::where('reference','IR-2026-01M4ZNZZ33ZMBWKP1NQ6JGFB0Z')->sole(); $stats=app(App\Services\DeclaredOriginStatistics::class)->forManager($u,'BR'); $p=['at_UTC'=>gmdate('c'),'SQL_read_only'=>true,'target'=>$target,'QA17_name_matches_UI'=>$u->name==='Synthetic cartography manager QA','reference'=>$r->reference,'entity_name_matches'=>$r->full_name==='QA negocio paises legado','type'=>$r->investor_type,'country'=>$r->country,'origin'=>$r->metadata['declared_origin_country_code']??null,'business_matches'=>$r->existing_business_id==='67d80699-1b0d-43e2-959d-5e1ad956dc74','MZ_BR_receipt_matches'=>App\Models\InterestRequest::where('reference',$r->reference)->where('country','MZ')->where('metadata->declared_origin_country_code','BR')->count(),'aggregates_BR'=>$stats,'period'=>'No date filter: all current eligible records at observation; not a daily or monthly report','aggregate_scope'=>'Only origin filters aggregates; country, receipt search, status and follow-up filter list only','collections'=>'interests: non-soft-deleted; desk and businesses: exclude draft/cancelled; business repository scopes retained','distinct_people'=>false,'interest_denominator'=>$db->table('interest_requests')->whereNull('deleted_at')->count(),'reused_idempotency_evidence'=>'business-country-after.json: same_key_reuses_reference and unchanged statistics after replay; no replay now','submissions_this_verification'=>0,'active_changes'=>0]; $path=__DIR__.'/line08-QA17-statistics-20261015.json';if(is_file($path))throw new RuntimeException('Preserve evidence');file_put_contents($path,json_encode($p,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE).PHP_EOL);echo json_encode($p,JSON_UNESCAPED_UNICODE); }finally{$db->rollBack();}