<?php
declare(strict_types=1);
require __DIR__.'/bootstrap.php';$p=json_decode((string)file_get_contents($runtime.'/private-retention.json'),true);$report=json_decode((string)file_get_contents($runtime.'/report.json'),true);$check($p['marker']===$marker&&$p['tenants']===$tenants,'Final own identity');$owned=$p['owned_pk_tenants'];$fresh=$connect();$verified=[];
foreach($tenants as $module=>$tenant){$s=$fresh->prepare('SELECT * FROM yoshop_express WHERE store_id=? ORDER BY express_id');$s->execute([$tenant]);$rows=$s->fetchAll(PDO::FETCH_ASSOC);$check(count($rows)===3,'Three retained original rows');foreach($rows as $r){$id=(int)$r['express_id'];$check(($owned[(string)$id]??0)===$tenant&&strpos($r['express_name'],$marker)===0,'Final exact owned PK/name/store');$creationFound=false;foreach($p['cases'] as $c){if($c['path']!=='/'.$module.'/setting.Express/add')continue;$t=$p['responses'][$c['scenario']];if((int)$r['create_time']>=$t['start']-2&&(int)$r['create_time']<=$t['end']+2)$creationFound=true;}$check($creationFound,'Exact create epoch has successful original HTTP window');$edit=$p['responses']['PILOT_EX_'.strtoupper($module).'_EDIT_OWN'];if(strpos($r['express_name'],"_改'中文")!==false)$check((int)$r['update_time']>=$edit['start']-2&&(int)$r['update_time']<=$edit['end']+2,'Original edited epoch window');else $check((int)$r['update_time']===(int)$r['create_time'],'Unedited own time unchanged');}$verified[$module]=count($rows);}
$check($snapshot()===$p['before'],'Final precise owned-PK exclusion natural SHA');
foreach($report['cases'] as &$c){if(!preg_match('/^PILOT_EX_(STORE|TERMINAL)_DELETE_OWN$/D',$c['scenario']))continue;$check($c['body']['status']===500&&is_string($c['body']['message']),'Known original delete error');$c['original_error_evidence']=['raw_response_private'=>true,'original_message_sha256'=>hash('sha256',$c['body']['message']),'mentions_missing_express_id'=>stripos($c['body']['message'],'express_id')!==false];$c['body']['message']='SHARED_ORIGINAL_ORDER_EXPRESS_ID_SCHEMA_ERROR_NOT_POSITIVE';}unset($c);
$report['independent_final_original']=['new_pdo_owned_counts'=>$verified,'all_pk_name_store_verified'=>true,'original_integer_epoch_windows_verified'=>true,'natural_express_sha_unchanged'=>true,'business_physical_delete_performed'=>false,'all_remaining_active'=>true,'private_error_wire_retained'=>true];file_put_contents($runtime.'/evidence.json',json_encode($report,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE));echo json_encode(['lane'=>$lane,'new_pdo_counts'=>$verified,'all_ownership_times_natural_sha_verified'=>true,'known_delete_errors'=>2]),"\n";
