NaN in the trailing return window causes np.std to produce NaN; the prior guard `pv <= 1e-12` is False for NaN, so `min(max_leverage, nan)` resolved to max_leverage (3.0) — pinning leverage to max on dirty data. The guard now checks `math.isfinite(pv)` first, returning the safe unlevered fallback (1.0). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>