Skip to content

Handle non-finite floats in JSON encoder - #2009

Merged
alexmojaki merged 2 commits into
mainfrom
codex/json-non-finite-floats
Jun 10, 2026
Merged

alexmojaki merged 2 commits into
mainfrom
codex/json-non-finite-floats

Conversation

@alexmojaki

@alexmojaki alexmojaki commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reject non-standard JSON NaN and Infinity output from logfire_json_dumps
  • Encode non-finite floats as strings when normalizing values for JSON serialization
  • Normalize bare non-finite float span attributes to strings while preserving finite floats as numbers
  • Add regression coverage for list attributes and bare scalar attributes containing nan, inf, and -inf

Tests

  • uv run pytest tests/test_json_args.py -k list_non_finite_floats
  • uv run pytest tests/test_json_args.py -k test_log_non_scalar_args
  • uv run pytest tests/test_json_args.py -k test_log_non_finite_scalar_float_args
  • uv run pytest tests/test_json_args.py -k "test_log_non_finite_scalar_float_args or test_log_non_scalar_args"

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 2 additional findings in Devin Review.

Open in Devin Review

Comment thread logfire/_internal/json_encoder.py Resolved
@alexmojaki
alexmojaki merged commit 747548e into main Jun 10, 2026
17 checks passed
@alexmojaki
alexmojaki deleted the codex/json-non-finite-floats branch June 10, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant