<?php
require __DIR__.'/oracle.php';$auditSource=$source;
try{require __DIR__.'/init.php';$logic=new \app\p\logic\AgentConversationLog();$rows=$auditSource();$checks=[];
foreach(json_decode(file_get_contents(__DIR__.'/private-spec.json'),true)as $s){if($s['label']==='missing_id')continue;if($s['method']==='detail'){$value=$logic->getDetail($business,(int)$s['params']['id']);$checks[$s['label'].'_8_fields']=$value===$projection($rows[0]);}else{$f=['keyword'=>$s['params']['keyword']??'','user_name'=>'','date_start'=>$scope['date'],'date_end'=>$scope['date']];$value=$logic->getList($business,$f,(int)$s['params']['page'],2);$checks[$s['label'].'_8_fields']=$value===['data'=>$s['label']==='no_match'?[]:array_map($projection,array_slice($rows,((int)$s['params']['page']-1)*2,2)),'total'=>$s['label']==='no_match'?0:count($rows),'page'=>(int)$s['params']['page'],'page_size'=>2];}}
$checks['source_unchanged']=$rows===$auditSource();$checks['actor_unchanged']=$actor===$actorNow();$checks['effective_business_unchanged']=(defined('BUSINESS')&&BUSINESS!=='BUSINESS_VALUE'?(string)BUSINESS:'')===$business;$report=['lane'=>$lane,'passed'=>!in_array(false,$checks,true),'checks'=>$checks];$save('private-runtime-gate.json',$report);echo json_encode($report),"\n";exit($report['passed']?0:2);
}catch(Throwable $e){$save('private-init-error.json',['class'=>get_class($e),'message'=>$e->getMessage(),'file'=>$e->getFile(),'line'=>$e->getLine()]);echo json_encode(['class'=>get_class($e),'reason_sha256'=>hash('sha256',$e->getMessage())]),"\n";exit(2);}
