<?php
// Pure original-type contract: this candidate is scoped to known physical projections only.
$checks=0;$negative=0;$b=json_decode(file_get_contents(__DIR__.'/private/B/numeric-zero-diagnostic.json'),true);$c=json_decode(file_get_contents(__DIR__.'/private/C/numeric-zero-diagnostic.json'),true);$mysqlZero=$b['joined'][0]['raw_flag_weight'];$dmZero=$c['joined'][0]['raw_flag_weight'];if(!is_string($mysqlZero)||!is_float($dmZero))throw new RuntimeException('Real native types not reproduced');$cases=[['mysql'=>$mysqlZero,'dm'=>$dmZero],['mysql'=>'100.00','dm'=>100.0],['mysql'=>'0.10','dm'=>0.1],['mysql'=>'0.01','dm'=>0.01],['mysql'=>'99999999.99','dm'=>99999999.99],['mysql'=>null,'dm'=>null]];
foreach($cases as $case){$source=$case['mysql'];$dm=$case['dm'];$expected=empty($source);$before=empty($dm);$candidate=$dm===null?null:number_format((float)$dm,2,'.','');$after=empty($candidate);if($after!==$expected||$candidate!==$source)throw new RuntimeException('Fixedscale candidate mismatch');$checks+=2;if($before!==$expected)$negative++;}
if($negative!==1)throw new RuntimeException('Did not reproduce physical zero type branch RED');
// All four active call sites receive b.raw_flag_weight physical DECIMAL(10,2).
$sites=['Stageanalyze::TeamProtein'=>3598,'Stageanalyze::StageTeamProtein'=>3996,'Ontoanalysis::Protein'=>2321,'Ontoanalysis::Stage_protein'=>4106];
echo json_encode(['mode'=>'pure type contract, no production patch','original_MySQL_zero'=>'0.00','original_DM_zero'=>0.0,'original_MySQL_empty'=>empty('0.00'),'original_DM_empty'=>empty(0.0),'known_physical_projection_candidate'=>number_format(0.0,2,'.',''),'RED_type_branch_counterexamples'=>$negative,'GREEN_preserved_type_and_empty_checks'=>$checks,'static_active_sites'=>$sites,'HTTP'=>0,'DML'=>0,'DB_connections'=>0]),"\n";
