Skip to content

fix: decode whole-number JSON literals as Float64 values - #12

Draft
Kayvan-Zahiri wants to merge 1 commit into
convex:mainfrom
Kayvan-Zahiri:codex/decode-whole-json-numbers
Draft

Kayvan-Zahiri wants to merge 1 commit into
convex:mainfrom
Kayvan-Zahiri:codex/decode-whole-json-numbers

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

json_to_convex() rejects Python int values even though they are part of its JsonValue input type. Whole-number JSON literals therefore raise ValueError, including when nested in a successful ConvexHttpClient response.

Decode untagged integer literals as Float64 values, matching Convex's JSON number representation. Keep the existing boolean branch first and preserve the separate tagged $integer → ConvexInt64 behavior. This also accepts exactly representable Float64 values above 2^53 on decode; it does not change outgoing Python integer coercion rules.

Adds 18 offline regression/control cases: scalar and nested integer literals, all three public HTTP methods with real Requests JSON decoding, booleans, other primitives, and tagged Int64. Requests are intercepted before network I/O.

Validation:

  • Before: 12 failures and 6 passing controls in the new tests.
  • After: 22 Python tests and doctests pass (pytest tests python/convex python/_convex).
  • Native extension built from this checkout with maturin and the already-installed nightly-2026-09-01 toolchain (the repository pins nightly-2026-06-28).
  • Changed-file Ruff formatting, strict mypy, and git diff --check pass.
  • Broader Python mypy retains two no-any-return findings in python/convex/__init__.py, reproduced with the original decoder.

No live deployment was called. The WebSocket client's Rust conversion path is unchanged.

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