nan-hidden-by-builtin-min
Validate floating candidates before a built-in min/max can hide a NaN.
Why
Python's min/max compares operands in order. A later NaN can be ignored, leaving a finite result that passes a finiteness check even though an original candidate was invalid.
Fix
Check every floating candidate before reducing it, or use a deliberately NaN-propagating reduction and validate its result.
Examples
import math
def validate(single: float, batched: float) -> None: lowest = min(single, batched) if not math.isfinite(lowest) or lowest < 0.99: raise ValueError("Invalid export")import math
def validate(single: float, batched: float) -> None: if not math.isfinite(single) or not math.isfinite(batched): raise ValueError("Invalid export") lowest = min(single, batched) if lowest < 0.99: raise ValueError("Invalid export")