-
[OPIK-6425] [FE] harden finiteOrNull: clamp negatives + coerce numeric strings
发布于
2026-06-25 20:48:09 +00:00 Review follow-up. finiteOrNull is the single coercion point for explain metric
payloads, so it must only emit a backend-validnumber | null(backend models
arefloat | Nonewithge=0):- negatives now → null. lodash isFinite is true for negatives, so a corrupt
negative duration/cost (e.g. clock-skew) used to pass through and 422 against
the backend'sge=0— the same broken Explain button the fix removed. - numeric strings now coerced. A non-conforming API value ("5") collapsed to
null ("not recorded") for a row that has a real value; coercing preserves the
pre-fix behaviour where the backend parsed it.
Direct unit test added pinning the helper's contract (0/positive pass, negatives
/ NaN / Infinity / absent → null, numeric strings coerced).Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
下载附件
- negatives now → null. lodash isFinite is true for negatives, so a corrupt