<?php
declare(strict_types=1);require __DIR__.'/app.php';require __DIR__.'/data.php';require __DIR__.'/dto.php';$app=coreApp('RESOLVE');$s=json_decode(file_get_contents($runtime.'/fast-scope.json'),true);$snap=json_decode(file_get_contents($runtime.'/source-snapshot.json'),true);$days=[];foreach($snap['health'] as $r)if($r['metric_code']==='activity_duration')$days[]=substr($r['start_time'],0,10);if($days){sort($days);$s['day']=$days[count($days)-1];}$s['original_preflight_day']=json_decode(file_get_contents($runtime.'/fast-scope.json'),true)['day'];$s['day_reason']='Prefer actual existing bounded global Rank data; own Sports may legitimately be empty';$s['sign_negative']=false;if(!$s['sign_id']){$s['sign_id']=2147000117;$rows=readNative('AI','SELECT * FROM yoshop_sign_action WHERE id=? AND store_id=?',[$s['sign_id'],10001]);ck($rows===[],'Frozen positive integer genuinely absent Sign action');$s['sign_negative']=true;}saveOnce('resolved-scope.json',$s);$expected=[];$cases=[];$spec=[['R1_SPORTS_RECORD','/api/yingjiduo.Sports/record',['userId'=>actor()['user_id'],'type'=>$s['type'],'pageNum'=>1,'pageSize'=>5,'from'=>$s['day'],'to'=>$s['day']]],['R2_SPORTS_TOTAL','/api/yingjiduo.Sports/total',['userId'=>actor()['user_id'],'type'=>$s['type']]],['R3_RANK_CURRENT','/api/yingjiduo.Rank/current',['userId'=>actor()['user_id'],'type'=>$s['type'],'period'=>4,'sort'=>0]],['R4_RANK_BY_DATE','/api/yingjiduo.Rank/byDate',['from'=>$s['day'],'to'=>$s['day'],'type'=>$s['type']]],['R5_SIGN_DETAIL','/api/Sign/detail',['signId'=>$s['sign_id']]]];foreach($spec as [$label,$path,$params]){$c=['label'=>$label,'method'=>'GET','path'=>$path,'params'=>$params,'query'=>http_build_query($params,'','&',PHP_QUERY_RFC3986),'body_raw'=>''];$cases[]=$c;$expected[$label]=independentDTO($c,$s,$snap);}saveOnce('cases.json',$cases);saveOnce('expected-DTO.json',$expected);saveOnce('resolved-plan.json',['cases'=>$cases,'scope'=>$s,'oracle'=>'Frozen before Auth/HTTP, independent original fullrows and source field/schema mapping','SQL'=>count(file($runtime.'/sql-budget.jsonl')),'HTTP'=>0,'DMLDDL'=>0]);echo json_encode(['lane'=>$lane,'day'=>$s['day'],'sign_negative'=>$s['sign_negative'],'cases'=>count($cases),'SQL'=>count(file($runtime.'/sql-budget.jsonl'))]),"\n";
