Repository navigation
fix(serializer): sanitize NaN/Inf nested in converted containers - #1878
Conversation
EventSerializer already converted non-finite floats and JS-unsafe integers for values that reached _default_inner directly, and for Pydantic model_dump() output. tuple/set/frozenset, numpy scalars and arrays, dataclasses, enum values, and LangChain to_json() returned converted containers without routing them back through default(), so nested NaN/Infinity leaked as invalid JSON tokens. Route those branches through default() the same way Pydantic dumps already do. Co-authored-by: hassieb.pakzad <hassieb.pakzad@clickhouse.com>
|
@claude review |
There was a problem hiding this comment.
Claude Code Review
No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.
Tip: disable this comment in your organization's Code Review settings.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 653c06c52a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What does this PR do?
EventSerializeralready turnsNaN/Infinity/-Infinityand JavaScript-unsafe integers into JSON-safe strings for values that hit_default_innerdirectly, and for Pydanticmodel_dump()output. Several other conversion branches returned a container or scalar without routing it back throughdefault(), so nested non-finite floats were emitted as bareNaN/Infinitytokens that strict JSON parsers reject.This routes the remaining branches through
default()the same way Pydantic dumps already do:tuple/set/frozensetndarray/genericasdict)enum.EnumvaluesSerializable.to_json()Fixes #1876
Type of change
Verification
Wrote failing unit tests first, then the production change.
All checks passed!(ruff)44 passed(vitest/pytest serializer + json unit tests)Checklist
code_review.md..env.templateif needed.The behavioral fix appears correct, but the explicit module-level import requirement must be satisfied before merging.
Summary
Reviews (1) · Last reviewed commit: "fix(serializer): sanitize NaN/Inf nested..."