<?php
declare(strict_types=1);
require __DIR__.'/bootstrap.php';
if(($argv[1]??'')==='audit'){echo json_encode(['lane'=>$lane,'owned_counts'=>$counts()]),"\n";exit(array_sum($counts())?1:0);}
$check(array_sum($counts())===0,'Owned collision');
// The preflight is a read-only live gate. Assert all nondefault input requirements.
$required=['user'=>['nick_name','store_id'],'staff'=>['name','gender','birthday','height','weight','staff_type','user_id','store_id','create_by'],
    'habit'=>['staff_id','habit','store_id','create_by'],'user_weight_status'=>['user_id','store_id','status','adjust_speed'],
    'nurtition_target'=>['staff_id','set_date','recommend_energy','morning_ratio','noon_ratio','night_ratio','carbohydrate_ratio','protein_ratio','fat_ratio','store_id','create_by']];
foreach($metadata as $table=>$meta){foreach($meta['columns'] as $col){$key=strtolower($col['column_name']);$type=strtolower($col['data_type']);
    $nullable=$dm?$col['nullable']!=='N':$col['is_nullable']!=='NO';$default=$dm?$col['data_default']:$col['column_default'];
    $id=$key===($pk[$table]??'id');
    $check($id||$nullable||$default!==null||in_array($key,$required[$table]??[],true),'Unknown required input '.$table.'.'.$key);
    if($type==='decimal'){$precision=(int)($dm?$col['data_precision']:$col['numeric_precision']);$scale=(int)($dm?$col['data_scale']:$col['numeric_scale']);
        $check($scale===2&&in_array($precision,[5,10],true),'Unexpected decimal scale '.$table.'.'.$key);}
}}
$before=$snapshot();$outputCounts=[];foreach(['meal_recommend','meal_recommend_history'] as $table)$outputCounts[$table]=(int)$query('SELECT COUNT(*) n FROM yoshop_'.$table)[0]['n'];
$boundary=json_decode((string)file_get_contents($base.'/__poc_boundary'),true);
$check(($boundary['robot_capture_mode']??'')==='OWN_STAFF_POWER_ONLY_NO_NETWORK_V1'&&!empty($boundary['external_stubs']),'Private actual boundary');
$root=(string)getenv('CATEGORY_ROOT');define('TP_ENV','poc');define('BUSINESS','aizhct');define('ENTERPRISE_NO','10001');require $root.'/vendor/autoload.php';
spl_autoload_register(static function(string $class)use($root):void{foreach(['app\\'=>'app/','cores\\'=>'cores/'] as $prefix=>$dir){if(strpos($class,$prefix)!==0)continue;
    $file=$root.'/'.$dir.str_replace('\\','/',substr($class,strlen($prefix))).'.php';if(is_file($file))require $file;}},true,true);
require __DIR__.'/external_boundary.php';require __DIR__.'/SqlCoverageRecorder.php';require __DIR__.'/DbWriteAudit.php';
$app=new \think\App($root);$app->setEnvName('poc');$app->setRuntimePath($runtime.'/fixture-runtime/');$app->initialize();\think\App::$store_id=$tenant;
$cfg=$app->config->get('database');foreach($cfg['connections'] as &$connection){$connection['trigger_sql']=true;$connection['debug']=false;}unset($connection);$app->config->set($cfg,'database');$app->db->setConfig($app->config);
$log=$app->config->get('log');$log['close']=true;foreach($log['channels'] as &$channel)$channel['close']=true;unset($channel);$app->config->set($log,'log');
$cache=new \think\cache\driver\File($app,['path'=>$runtime.'/cache/','prefix'=>'','expire'=>0]);$token=bin2hex(random_bytes(24));
$cache->set($token,['user'=>['store_user_id'=>$tenant,'store_id'=>$tenant,'real_name'=>$marker,'user_name'=>$marker,'is_super'=>1],'store_id'=>$tenant,'is_login'=>true],1800);
file_put_contents($runtime.'/queries.jsonl','');file_put_contents($runtime.'/robot-captures.jsonl','');file_put_contents($runtime.'/write-audit.jsonl','');file_put_contents($runtime.'/private-dml-audit-sql.jsonl','');
$writeAudit=new DbWriteAudit($runtime);$activeRecorder=null;
$app->db->listen(static function($sql,$ms=null)use($writeAudit,&$activeRecorder){$writeAudit->observe($sql);
    if($activeRecorder!==null&&strpos((string)$sql,'CONNECT:')!==0)$activeRecorder->observe($sql,$ms);});
$fixtureAudit=[];
$insert=static function(string $table,array $data)use($db,$query,$check,$tenant,$marker,&$fixtureAudit):int{
    $check(in_array($table,['user','staff','habit','user_weight_status','nurtition_target'],true)&&($data['store_id']??null)===$tenant,'Fixture insert frozen table/store');
    if($table==='user')$check(($data['nick_name']??'')===$marker.'_USER','Own user marker');
    if(in_array($table,['staff','user_weight_status'],true)){$u=$query('SELECT user_id FROM yoshop_user WHERE user_id=? AND store_id=? AND nick_name=?',[$data['user_id'],$tenant,$marker.'_USER']);$check(count($u)===1&&(int)$data['user_id']>0,'Fixture positive owned user');}
    if(in_array($table,['habit','nurtition_target'],true)){$s=$query('SELECT id FROM yoshop_staff WHERE id=? AND store_id=? AND name=? AND create_by=?',[$data['staff_id'],$tenant,$marker.'_STAFF',$marker]);$check(count($s)===1&&(int)$data['staff_id']>0,'Fixture owned staff');}
    $s=$db->prepare('INSERT INTO yoshop_'.$table.' ('.implode(',',array_keys($data)).') VALUES ('.implode(',',array_fill(0,count($data),'?')).')');$s->execute(array_values($data));
    $where=[];foreach(array_keys($data) as $k)$where[]=$k.'=?';$row=$query('SELECT '.($table==='user'?'user_id':'id').' AS owned_id FROM yoshop_'.$table.' WHERE '.implode(' AND ',$where),array_values($data));
    $check(count($row)===1&&(int)$row[0]['owned_id']>0,'Owned inserted row '.$table);$fixtureAudit[]=['operation'=>'INSERT','table'=>$table,'bound_owner_and_marker_verified'=>true,'original_readback_verified'=>true];return (int)$row[0]['owned_id'];};
$uid=0;$sid=0;$cases=[];$jobs=[];$error=null;$responses=[];$proofs=[];
$money=static function($v):string{$s=(string)$v;$adj=bccomp($s,'0',12)<0?'-0.005':'0.005';return bcadd(bcadd($s,$adj,12),'0',2);};
$expected=static function(int $status=1,int $speed=1,?array $target=null)use($query,$check,$money,$tenant,$marker):array{
    $en=$query('SELECT ratio FROM yoshop_config_enum WHERE enum_type=2 AND enum_key=3 AND is_delete=0');$check(count($en)===1,'Unique general habit enum');$ratio=bcadd((string)$en[0]['ratio'],'0',2);
    $age=(int)date('Y')-1990;$check($age>30&&$age<60,'Stable adult age bracket');$ree=bcmul(bcadd(bcmul('11.472','60',12),'873.1',12),'0.95',12);
    $sp=[1=>'0.25',2=>'0.50',3=>'1.00'][$speed];$offset=$status===2?bcmul('785',$sp,12):($status===3?bcmul('-1100',$sp,12):'0');
    $consume=$money(bcadd(bcmul($ree,$ratio,12),$offset,12));if(bccomp($consume,'0',2)<0)$consume='0.00';
    $power=$target!==null?$target['recommend_energy']:($status===2?bcadd($consume,'300',12):($status===3?bcsub($consume,'300',12):$consume));
    if($target===null&&$status===3&&bccomp($power,'1200',12)<0)$power='1200';
    $macro=$target??(['carbohydrate_ratio'=>$status===1?'55':($status===2?'60':'50'),'protein_ratio'=>$status===3?'25':'20','fat_ratio'=>$status===2?'20':'25',
        'morning_ratio'=>'30','noon_ratio'=>'40','night_ratio'=>'30']);
    $out=['gender'=>1,'birthday'=>'1990-01-01','height'=>'170.00','weight'=>'60.00','staff_type'=>1,'sport_id'=>0,'sport_event_id'=>0,
        'age'=>$age,'ree'=>$money($ree),'habit'=>3,'habit_ratio'=>$ratio,'consume_power'=>$money($consume),'weight_status'=>$status,
        'energy_value'=>'300.00','recommend_energy'=>$target===null?'-1.00':$money($target['recommend_energy']),'recommend_power'=>$money($power),
        'bm'=>'0.00','bmr'=>'0.00','food_hot'=>'0.00','night_expend'=>'0.00','daily_consume'=>'0.00','active_power'=>'0.00','active_time'=>0,'recommend_ratio'=>'0.00',
        'dietary_fiber'=>'25.00','store_id'=>$tenant,'is_delete'=>0,'create_by'=>'system'];
    foreach(['carbohydrate'=>4,'protein'=>4,'fat'=>9] as $n=>$div){$r=bcdiv($macro[$n.'_ratio'],'100',12);$p=bcmul($power,$r,12);$w=bcdiv($p,(string)$div,12);
        $out[$n.'_ratio']=$money($r);$out['recommend_'.$n.'_power']=$money($p);$out['recommend_'.$n.'_weight']=$money($w);
        foreach(['morning','noon','night'] as $meal)$out[$meal.'_'.$n.'_weight']=$money(bcmul($w,bcdiv($macro[$meal.'_ratio'],'100',12),12));}
    foreach(['morning','noon','night'] as $meal){$r=bcdiv($macro[$meal.'_ratio'],'100',12);$out[$meal.'_ratio']=$money($r);$out[$meal.'_power']=$money(bcmul($power,$r,12));}
    $vm=$query('SELECT * FROM yoshop_general_vm WHERE gender=1 AND start_age<=? AND end_age>=?',[$age,$age]);$check(count($vm)===1,'Unique GeneralVm source');
    foreach(['va','vb1','vb2','vpp','vc','ve','potassium','sodium','calcium','magnesium','iron','zinc'] as $key)$out[$key]=bcadd((string)$vm[0][$key],'0',2);
    return $out;
};
$historySnapshots=[];
$readOutput=static function(string $date,array $wanted,int $historyExpected,?int $sameCurrent=null)use($query,$check,$tenant,$runtime,&$sid,&$proofs,&$historySnapshots):array{
    $current=$query('SELECT * FROM yoshop_meal_recommend WHERE staff_id=? AND store_id=? AND meal_date=? ORDER BY id',[$sid,$tenant,$date]);
    $history=$query('SELECT * FROM yoshop_meal_recommend_history WHERE staff_id=? AND store_id=? AND meal_date=? ORDER BY id',[$sid,$tenant,$date]);
    $check(count($current)===1&&count($history)===$historyExpected,'Current/history physical row increments');$row=$current[0];$wanted['staff_id']=$sid;$wanted['meal_date']=$date;
    if(isset($historySnapshots[$date]))$check(array_slice($history,0,count($historySnapshots[$date]))===$historySnapshots[$date],'Earlier history original rows mutated');$historySnapshots[$date]=$history;
    $check($sameCurrent===null||(int)$row['id']===$sameCurrent,'Current row primary key changed');
    $normalized=$row;foreach(['id','create_time','update_time'] as $key)unset($normalized[$key]);
    $a=array_keys($normalized);$b=array_keys($wanted);sort($a);sort($b);$check($a===$b,'All original recommendation fields');
    // Independent PDO drivers expose DECIMAL natively as string (MySQL) or
    // numeric (DM). Compare only metadata-verified DECIMAL columns at physical
    // scale; this conversion NEVER applies to the HTTP wire/type comparison.
    $physical=static function($actual,$expected){if(is_int($expected))return (int)$actual;
        if(is_string($expected)&&preg_match('/^-?[0-9]+\.[0-9]{2}$/D',$expected))return bcadd((string)$actual,'0',2);return $actual;};
    foreach($wanted as $k=>$v){$actual=$physical($row[$k],$v);$check($actual===$v,'Independent decimal/value '.$k.' actual='.json_encode($actual).' expected='.json_encode($v));$normalized[$k]=$actual;}
    $last=$history[count($history)-1];foreach($wanted as $k=>$v)$check($physical($last[$k],$v)===$v,'History full field '.$k);
    $map=json_decode((string)file_get_contents($runtime.'/private-owned-map.json'),true);$map['current_ids']=array_values(array_unique(array_merge($map['current_ids']??[],[(int)$row['id']])));file_put_contents($runtime.'/private-owned-map.json',json_encode($map));
    $proofs[]=['date'=>$date,'current_rows'=>1,'history_rows'=>$historyExpected,'current_id'=>(int)$row['id'],'latest_history_id'=>(int)$last['id'],'all_original_fields_independently_equal'=>true,'earlier_history_original_rows_unchanged'=>true,
        'values'=>$normalized,'raw_physical_values'=>$row];return ['id'=>(int)$row['id'],'history_ids'=>array_column($history,'id')];
};
$shape=static function($v)use(&$shape){if(is_object($v)){$o=[];foreach(get_object_vars($v) as $k=>$x)$o[$k]=$shape($x);ksort($o);return ['object'=>$o];}if(is_array($v))return ['array'=>array_map($shape,$v)];return gettype($v);};
$request=static function(string $scenario,string $action,string $date)use($base,$token,$check,$shape,&$sid,&$cases,&$responses):void{
    $scenario='PILOT_SP_'.$scenario;$headers="Host: store.staff-power.invalid\r\nAccess-Token: ".$token."\r\nPlatform: POC\r\nX-Pilot-Scenario: ".$scenario."\r\nContent-Type: application/json\r\n";
    $raw=file_get_contents($base.'/store/meal.Meals/'.$action,false,stream_context_create(['http'=>['method'=>'POST','header'=>$headers,'content'=>json_encode(['staff_id'=>$sid,'meal_date'=>$date,'dishes'=>[]]),'ignore_errors'=>true,'timeout'=>30]]));
    $check(is_string($raw)&&strlen($raw)<1048576,'HTTP wire');$body=json_decode($raw,true);$check(is_array($body),'JSON HTTP');$responses[$scenario]=$raw;
    preg_match('#^HTTP/\S+\s+(\d+)#',$http_response_header[0]??'',$m);$http=(int)($m[1]??0);
    $case=['scenario'=>$scenario,'method'=>'POST','path'=>'/store/meal.Meals/'.$action,'http_status'=>$http,'body'=>$body,'raw_json_shape'=>$shape(json_decode($raw))];$cases[]=$case;
    $check($http===200&&($body['status']??0)===200,'HTTP business failure '.$scenario);
    $data=$action==='countNutrition'?($body['data']['list']??null):($body['data']['nutrition_value']??null);
    $check(is_array($data)&&array_keys($data)===['power_wire','carbohydrate_wire','protein_wire','fat_wire'],'Not swallowed empty calculation');
    foreach($data as $wire){$check(is_array($wire)&&array_keys($wire)===['wa','wb','wc','wd','wx','a','b','c','d'],'Wire full field/order');foreach($wire as $v)$check($v===0,'Zero input wire must int0');}
    if($action==='countListsValue'){$meals=$body['data']['lists']??[];$check(count($meals)===4,'Four actual meal structures');
        foreach(['早餐','午餐','晚餐','夜宵'] as $i=>$name)$check($meals[$i]===['name'=>$name,'meal_times'=>$i+1,'data'=>[]],'Complete four meal structure');}
};
$job=static function(string $scenario,string $date)use($app,$runtime,$root,$tenant,$check,&$sid,&$jobs,&$activeRecorder):void{
    $recorder=new SqlCoverageRecorder($runtime.'/queries.jsonl',$root,'PILOT_SP_JOB_'.$scenario);$activeRecorder=$recorder;
    ob_start();try{$result=(new \app\timer\service\Serve)->doJob(['action'=>'staffPower','data'=>['storeId'=>$tenant,'staffId'=>$sid,'date'=>$date]]);}
    finally{$output=ob_get_clean();$recorder->finish();$activeRecorder=null;file_put_contents($runtime.'/private-job-'.$scenario.'.log',$output);}
    $check($result===true,'Real job return (not sufficient alone)');$jobs[]=['scenario'=>$scenario,'date'=>$date,'real_serve_service_called'=>true,'http_count'=>0,'robot_only_stubbed'=>true];
};
try{
    $uid=$insert('user',['nick_name'=>$marker.'_USER','store_id'=>$tenant]);
    $u=$query('SELECT * FROM yoshop_user WHERE user_id=? AND store_id=? AND nick_name=?',[$uid,$tenant,$marker.'_USER']);$check(count($u)===1,'Owned positive user');
    foreach($u[0] as $key=>$value)if(strpos($key,'balance')!==false||in_array($key,['points','pay_money','expend_money'],true))$check((float)$value===0.0,'Zero self money');
    $sid=$insert('staff',['name'=>$marker.'_STAFF','gender'=>1,'birthday'=>'1990-01-01','height'=>'170.00','weight'=>'60.00','staff_type'=>1,'user_id'=>$uid,'store_id'=>$tenant,'create_by'=>$marker]);
    $insert('habit',['staff_id'=>$sid,'habit'=>3,'store_id'=>$tenant,'create_by'=>$marker]);
    file_put_contents($runtime.'/private-owned-map.json',json_encode(['staff_id'=>$sid,'user_id'=>$uid,'tenant'=>$tenant]));chmod($runtime.'/private-owned-map.json',0600);
    $date='2030-03-02';$wanted=$expected();
    $request('PC_FIRST','countListsValue',$date);$first=$readOutput($date,$wanted,1);
    $request('PC_REPEAT','countListsValue',$date);$readOutput($date,$wanted,1,$first['id']);
    $request('NARROW_READ','countNutrition',$date);$readOutput($date,$wanted,1,$first['id']);
    $request('NARROW_NEW_DATE','countNutrition','2030-03-03');$second=$readOutput('2030-03-03',$wanted,1);
    $job('RECOMPUTE_SAME',$date);$readOutput($date,$wanted,2,$first['id']);
    $wid=$insert('user_weight_status',['user_id'=>$uid,'store_id'=>$tenant,'status'=>1,'adjust_speed'=>1]);
    $history=2;
    foreach([[1,1],[2,1],[2,2],[2,3],[3,1],[3,2],[3,3]] as $state){$s=$db->prepare('UPDATE yoshop_user_weight_status SET status=?,adjust_speed=? WHERE id=? AND user_id=? AND store_id=?');$s->execute([$state[0],$state[1],$wid,$uid,$tenant]);
        $w=$query('SELECT status,adjust_speed FROM yoshop_user_weight_status WHERE id=? AND user_id=? AND store_id=?',[$wid,$uid,$tenant]);$check(count($w)===1&&(int)$w[0]['status']===$state[0]&&(int)$w[0]['adjust_speed']===$state[1],'Weight state fixture readback');
        $fixtureAudit[]=['operation'=>'UPDATE','table'=>'user_weight_status','bound_pk_user_store_verified'=>true,'original_readback_verified'=>true];
        $name='WEIGHT_'.$state[0].'_'.$state[1];$job($name,$date);$readOutput($date,$expected($state[0],$state[1]),++$history,$first['id']);
        $request($name.'_READ','countNutrition',$date);$readOutput($date,$expected($state[0],$state[1]),$history,$first['id']);}
    $target=['recommend_energy'=>'2345.67','morning_ratio'=>'25.50','noon_ratio'=>'44.50','night_ratio'=>'30.00','carbohydrate_ratio'=>'52.50','protein_ratio'=>'22.50','fat_ratio'=>'25.00'];
    $tid=$insert('nurtition_target',array_merge(['staff_id'=>$sid,'set_date'=>$date],$target,['store_id'=>$tenant,'create_by'=>$marker]));
    $t=$query('SELECT * FROM yoshop_nurtition_target WHERE id=? AND staff_id=? AND store_id=? AND create_by=?',[$tid,$sid,$tenant,$marker]);$check(count($t)===1,'Target fixture ownership');foreach($target as $key=>$v)$check(bcadd((string)$t[0][$key],'0',2)===$v,'Target decimal input '.$key);
    $job('EXPLICIT_TARGET',$date);$readOutput($date,$expected(3,3,$target),++$history,$first['id']);
    $request('EXPLICIT_TARGET_PC_READ','countListsValue',$date);$readOutput($date,$expected(3,3,$target),$history,$first['id']);
}catch(Throwable $caught){$error=['class'=>get_class($caught),'message'=>$caught->getMessage(),'file'=>basename($caught->getFile()),'line'=>$caught->getLine()];}
// New PDO sees committed original rows; cleanup by owned positive IDs + full owner.
$clean=$connect();
if($sid>0){foreach(['meal_recommend_history','meal_recommend','nurtition_target','habit'] as $table){$s=$clean->prepare('DELETE FROM yoshop_'.$table.' WHERE staff_id=? AND store_id=?'.(in_array($table,['habit','nurtition_target'],true)?' AND create_by=?':''));$args=[$sid,$tenant];if(in_array($table,['habit','nurtition_target'],true))$args[]=$marker;$s->execute($args);}}
if($uid>0){$s=$clean->prepare('DELETE FROM yoshop_user_weight_status WHERE user_id=? AND store_id=?');$s->execute([$uid,$tenant]);}
if($sid>0){$s=$clean->prepare('DELETE FROM yoshop_staff WHERE id=? AND store_id=? AND name=? AND user_id=? AND create_by=?');$s->execute([$sid,$tenant,$marker.'_STAFF',$uid,$marker]);}
if($uid>0){$s=$clean->prepare('DELETE FROM yoshop_user WHERE user_id=? AND store_id=? AND nick_name=?');$s->execute([$uid,$tenant,$marker.'_USER']);}
$cache->delete($token);$fresh=$connect();$remaining=[];foreach($tables as $table){$s=$fresh->prepare('SELECT COUNT(*) FROM yoshop_'.$table.' WHERE store_id=?');$s->execute([$tenant]);$remaining[$table]=(int)$s->fetchColumn();}
$after=$snapshot();$outputAfter=[];foreach(['meal_recommend','meal_recommend_history'] as $table)$outputAfter[$table]=(int)$query('SELECT COUNT(*) n FROM yoshop_'.$table)[0]['n'];
$audit=[];foreach(file($runtime.'/write-audit.jsonl',FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)?:[] as $line)$audit[]=json_decode($line,true);
$cleanup=['fresh_pdo_owned_rows'=>$remaining,'token_absent'=>$cache->get($token)===null,'five_input_tables_and_dictionaries_full_sha_unchanged'=>$before===$after,
    'large_output_counts_restored'=>$outputCounts===$outputAfter,'large_output_before_counts'=>$outputCounts,'large_output_after_counts'=>$outputAfter,
    'large_output_full_sha_performed'=>false,'framework_dml_all_owned'=>!in_array(false,array_column($audit,'owned_scope_verified'),true)];
$captures=[];foreach(file($runtime.'/robot-captures.jsonl',FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)?:[] as $line){$r=json_decode($line,true);$check($sid>0&&(int)$r['staff_id']===$sid&&(int)$r['store_id']===$tenant,'Robot actual owned');$r['staff_id']=1;$captures[]=$r;}
foreach($cases as &$case){$trace=$case['body']['trace_id']??null;$case['trace_format_valid']=is_string($trace)&&preg_match('/^[0-9a-f]{13}$/D',$trace)===1;if($case['trace_format_valid'])$case['body']['trace_id']='VALID_DYNAMIC_TRACE';}unset($case);
file_put_contents($runtime.'/private-responses.json',json_encode($responses,JSON_UNESCAPED_UNICODE));
file_put_contents($runtime.'/private-proof-original.json',json_encode($proofs,JSON_UNESCAPED_UNICODE));
foreach($proofs as &$proof){$proof['current_id']=$proof['date']==='2030-03-02'?1:2;unset($proof['latest_history_id']);$proof['values']['staff_id']=1;unset($proof['raw_physical_values']);}unset($proof);
$events=[];foreach(file($runtime.'/queries.jsonl',FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)?:[] as $line)$events[]=json_decode($line,true);
$report=['lane'=>$lane,'cases'=>$cases,'jobs'=>$jobs,'proofs'=>$proofs,'robot_captures'=>$captures,'write_audit'=>$audit,'fixture_audit'=>$fixtureAudit,'real_queue_executed'=>false,'fresh_pdo_cleanup'=>$cleanup,'natural_before'=>$before,'scan_metrics'=>$scanMetrics,'error'=>$error,'events'=>$events];
file_put_contents($runtime.'/report.json',json_encode($report,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES));
echo json_encode(['lane'=>$lane,'http_cases'=>count($cases),'job_cases'=>count($jobs),'independent_output_proofs'=>count($proofs),'cleanup'=>$cleanup,'error'=>$error,'report'=>$runtime.'/report.json']),"\n";
exit($error!==null||array_sum($remaining)!==0||!$cleanup['token_absent']||!$cleanup['five_input_tables_and_dictionaries_full_sha_unchanged']||!$cleanup['large_output_counts_restored']||!$cleanup['framework_dml_all_owned']?1:0);
