<?php
declare(strict_types=1);require __DIR__.'/common.php';$scenario=getenv('INV_CASE');$cases=finishCases($runtime);$check(isset($cases[$scenario]),'Frozen case exists');$case=$cases[$scenario];$original=json_decode(file_get_contents($prior.'/cases-original.json'),true);$check(!isset($original[$scenario])||!file_exists($prior.'/client-original-'.$scenario.'.json'),'Never repeat prior successful HTTP');$check(!file_exists($runtime.'/client-'.$scenario.'.json'),'No finish replay');$token=json_decode(file_get_contents($runtime.'/tokens.json'),true)['one'];$headers=['Host: '.$case['host'],'Platform: POC','Content-Type: application/json','Access-Token: '.$token,'X-Pilot-Scenario: '.$scenario];$ctx=stream_context_create(['http'=>['method'=>'POST','header'=>implode("\r\n",$headers),'content'=>$case['body_raw'],'timeout'=>120,'ignore_errors'=>true]]);$raw=file_get_contents('http://127.0.0.1:'.($lane==='B'?18911:18912).$case['path'],false,$ctx);$persist('client-'.$scenario.'.json',['case'=>$case,'response_headers'=>$http_response_header,'raw'=>$raw]);$body=json_decode($raw,true);echo json_encode(['lane'=>$lane,'case'=>$scenario,'status'=>$body['status']??null,'message'=>$body['message']??null,'harness_error'=>$body['harness_error']??null],JSON_UNESCAPED_UNICODE),"\n";
