<?php
declare(strict_types=1);
require __DIR__.'/contract.php';require __DIR__.'/cases.php';$db=smPdo();$actor=smLoad('actor-private.json');n6Actor($db);n6Sha();$runtime=getenv('SM7_RUNTIME');if(is_file($runtime.'/boundary-version-overflow-private.json')){throw new RuntimeException('Do not replay overflow boundary');}$case=null;foreach(n6Cases(smLoad('preflight-private.json')) as $c){if($c['name']==='VERSION_CODE_EMPTY'){$case=$c;}}if(!$case||(int)$case['params']['type']!==2147483646){throw new RuntimeException('Frozen overflow case');}
require getenv('SM7_ROOT').'/application/base/Security.php';$token=\app\base\Security::encrypt(implode("\t",[(string)$actor['id'],$actor['uuid'],$actor['marker'],'0','','',$actor['marker']]));$raw=file_get_contents(getenv('SM7_BASE').$case['path'],false,stream_context_create(['http'=>['method'=>'POST','header'=>"Host: cdx-next6.invalid\r\nContent-Type: application/x-www-form-urlencoded;charset=UTF-8\r\ntoken: ".$token."\r\nX-Pilot-Scenario: PILOT_N6_VERSION_CODE_EMPTY\r\n",'content'=>http_build_query($case['params']),'ignore_errors'=>true,'follow_location'=>0,'timeout'=>25]]));preg_match('~^HTTP/\S+ (\d+)~',$http_response_header[0]??'',$m);$body=json_decode((string)$raw,false);n6Actor($db);$out=['method'=>'POST','path'=>$case['path'],'type'=>2147483646,'http_status'=>(int)($m[1]??0),'body'=>$body,'raw_wire'=>(string)$raw,'wire_sha256'=>hash('sha256',(string)$raw),'oracle_preflight_failed'=>true,'positive_claimed'=>false,'actor_unchanged'=>true,'new_fixture_dml'=>0,'ddl'=>0];smSave('boundary-version-overflow-private.json',$out);echo json_encode(['http_status'=>$out['http_status'],'json_body'=>$body!==null,'code'=>$body->code??null,'message_sha256'=>isset($body->message)?hash('sha256',(string)$body->message):null,'positive_claimed'=>false]),PHP_EOL;
