<?php
$lane=getenv('CITY_LANE');$parent=getenv('CITY_PARENT');$assets=__DIR__;
if(!in_array($lane,['B','C'],true)||getenv('POC_EXTERNAL_STUBS')!=='1')exit;
$path=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);
if($path!=='/p/city/lists'||$_SERVER['REQUEST_METHOD']!=='POST'){http_response_code(403);exit;}
$_SERVER['PATH_INFO']=$path;require $parent.'/env.php';
require $parent.'/external_stubs.php';define('APP_PATH',$assets.'/source/application/');define('RUNTIME_PATH',$assets.'/runtime/');
if(!function_exists('json')){function json($data=[],$code=200,array $header=[],$options=[]){return \think\Response::create($data,'json',$code,$header,$options);}}
require $parent.'/thinkphp/base.php';\think\App::initCommon();\think\Request::instance()->pathinfo();
\think\Log::init(['type'=>'File','path'=>$assets.'/runtime/safe-log/','level'=>['no_raw_application_logs']]);
\think\Config::set(['type'=>'File','path'=>$assets.'/cache/','prefix'=>'CITY10_'],'cache');
$database=require $assets.'/config.php';$database['debug']=true;$database['sql_explain']=false;
\think\Config::set($database,'database');\think\Db::clear();
require $assets.'/SqlCoverageRecorder.php';$observer=new SqlCoverageRecorder($assets.'/events.jsonl',$assets.'/source','PILOT_CITY_POST_READ');
\think\Db::listen(static function($sql,$ms=null)use($observer):void{
    if(preg_match('/^\s*(INSERT|UPDATE|DELETE|MERGE|REPLACE|ALTER|CREATE|DROP|TRUNCATE)\b/i',(string)$sql))throw new RuntimeException('Read-only boundary violated');
    $observer->observe($sql,$ms);
});register_shutdown_function([$observer,'finish']);\think\App::run()->send();
