<?php
declare(strict_types=1);
require __DIR__.'/bootstrap.php';require __DIR__.'/StrictWire.php';
define('TP_ENV','poc');define('BUSINESS','aizhct');define('ENTERPRISE_NO','10001');require $root.'/vendor/autoload.php';$app=new \think\App($root);$app->setEnvName('poc');$app->setRuntimePath($runtime.'/fixture-runtime/');$app->initialize();$cache=new \think\cache\driver\File($app,['path'=>$runtime.'/cache/','prefix'=>'','expire'=>0]);
try {
 $check($lane==='B','Only failed B recovery');
 $expected=['enabled'=>false,'baseUrl'=>'https://'.strtolower($marker).'-S.invalid/initial/'];$count=0;
 foreach($tables as $t)foreach($query('SELECT * FROM yoshop_'.$t.' WHERE store_id IN (?,?)',array_values($tenants)) as $r){
  $check($t==='h5_setting'&&$r['key']==='basic'&&(int)$r['store_id']===$tenants['store']&&$r['describe']==='基础设置','Exact independently owned only first tuple');
  $check(is_string($r['values'])&&strictWireEqual(json_decode($r['values']),json_decode(json_encode($expected))),'Exact first submitted original payload');
  $check((int)$r['update_time']>0,'Real original Unix timestamp');$owned[$t][(string)$r['store_id']][$r['key']]=true;$count++;
 }
 $check($count===1,'Exactly one committed tuple');
 $before=['h5_setting'=>['natural_rows'=>2,'sha256'=>'fdcf06b13096c7ffb6c5550c5c8ec74781cb1d81299975c1a9f3854d608b2d11'],'wxapp_setting'=>['natural_rows'=>7,'sha256'=>'302aacad6a623a2aea5f495077149fc15a41b4ae23f2918431d8fcc41bb6e455']];
 $after=$snapshot();$check($before===$after,'Original preflight full natural snapshot unchanged excluding only independently proven tuple');
 $record=['lane'=>$lane,'owned'=>$owned,'expected'=>$expected,'before'=>$before,'after'=>$after,'only_one_committed_tuple'=>true,'raw_initial_default_and_create_lost'=>true,'tool_failure'=>'case-sensitive ownership marker against deliberately lowercase H5 URL'];
 file_put_contents($runtime.'/private-recovery.json',json_encode($record,JSON_PRETTY_PRINT));chmod($runtime.'/private-recovery.json',0600);
 echo json_encode(['recovered_owned_tuples'=>$count,'natural_full_sha_unchanged'=>true,'initial_raw_not_claimed'=>true]),"\n";
} finally {$cache->clear();echo '{"private_cache_cleared":true}',"\n";}
