<?php
declare(strict_types=1);
require __DIR__.'/bootstrap.php';require __DIR__.'/StrictWire.php';$p=json_decode(file_get_contents($runtime.'/private-cli-before.json'),true);$original=json_decode(file_get_contents($p['original_runtime'].'/private-retention.json'),true);$owned=$original['owned_unique_tuples'];$fresh=$connect();$n=0;foreach($p['rows'] as $module=>$families)foreach($families as $family=>$keys)foreach($keys as $key=>$before){$s=$fresh->prepare('SELECT * FROM yoshop_'.($family==='h5'?'h5_setting':'wxapp_setting').' WHERE '.$qkey.'=? AND store_id=?');$s->execute([$key,$tenants[$module]]);$rows=$s->fetchAll(PDO::FETCH_ASSOC);foreach($rows as &$r)foreach($r as &$v)if(is_resource($v))$v=stream_get_contents($v);unset($r,$v);$check(count($rows)===1&&$rows[0]===$before,'CLI fresh physical full row unchanged including epoch');$n++;}$check($snapshot()===$p['natural'],'CLI full natural SHA unchanged');$dml=0;$select=0;foreach(file($runtime.'/queries.jsonl',FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)?:[] as $line){$e=json_decode($line,true);if(strpos($e['scenario']??'','PILOT_CS_CLI_')!==0)continue;$op=strtoupper((string)($e['operation']??''));if(in_array($op,['INSERT','UPDATE','DELETE','REPLACE','MERGE','CREATE','ALTER','DROP'],true))$dml++;if($op==='SELECT')$select++;}$check($dml===0&&$select>0,'CLI real DB SELECT and DML0');
define('TP_ENV','poc');define('BUSINESS','aizhct');define('ENTERPRISE_NO','10001');require $root.'/vendor/autoload.php';$app=new \think\App($root);$app->setEnvName('poc');$app->setRuntimePath($runtime.'/cli-fixture-runtime/');$app->initialize();$cache=new \think\cache\driver\File($app,['path'=>$runtime.'/cache/','prefix'=>'','expire'=>0]);foreach($p['tokens'] as $token)$cache->delete($token);$cache->clear();$r=['lane'=>$lane,'native_read_requests'=>6,'expected_named_assertions'=>36,'independent_fresh_exact_six_full_original_rows_unchanged'=>true,'natural_two_full_sha_unchanged'=>true,'actual_SQL_SELECT'=>$select,'actual_DML'=>0,'tokens_cache_reclaimed'=>true,'loaded_boundary'=>$p['loaded_boundary']];file_put_contents($runtime.'/cli-db-evidence.json',json_encode($r,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));echo json_encode($r),"\n";
