<?php
declare(strict_types=1);require __DIR__.'/app.php';$app=coreApp('R3_RANK_CURRENT_RETEST');$count=0;foreach(file($runtime.'/business-native.jsonl') as $line){$r=json_decode($line,true);if(($r['scenario']??'')==='R3_RANK_CURRENT'&&($r['layer']??'')==='source gate/plan error'&&stripos($r['queryString'],'HAVING')!==false){CoreGate::plan('ZHCT',$r['queryString'],$r['bind_plan']);$count++;$bad=false;try{CoreGate::plan('ZHCT',str_replace("'yingjiduo'","'foreign_vendor'",$r['queryString']),$r['bind_plan']);}catch(Throwable $e){$bad=true;}ck($bad,'Different literal vendor rejected');$count++;}if(($r['scenario']??'')==='R4_RANK_BY_DATE'&&($r['layer']??'')==='source gate/plan error'){CoreGate::$scenario='R4_RANK_BY_DATE_RETEST';CoreGate::plan('ZHCT',$r['queryString'],$r['bind_plan']);$count++;}}ck($count>=3,'Original two gate failures reproduced positively plus literal-negative');foreach(['INSERT INTO ydy_staff VALUES(1)','DELETE FROM yoshop_user','SELECT * FROM ydy_config'] as $sql){$bad=false;try{CoreGate::kind(strpos($sql,'yoshop_')!==false?'AI':'ZHCT',$sql);}catch(Throwable $e){$bad=true;}ck($bad,'Writes and unrelated data still refused');$count++;}saveOnce('retest-pure-gate.json',['checks'=>$count,'passed'=>true,'SQL'=>0,'HTTP'=>0,'DMLDDL'=>0,'actual_original_failed_SQL_reused'=>true]);echo json_encode(['lane'=>$lane,'checks'=>$count,'SQL'=>0,'HTTP'=>0]),"\n";
