Skip to content

Enable serde_json float_roundtrip so float payload values survive decode/re-encode #181

Closed

Description

@rmcdaniel

Found in the interim review of cli#79, and confirmed on the native Server as server#1010 (fix server#1011, going into Server 3.1.0).

Cargo.toml:138 has serde_json = "1" without the float_roundtrip feature. Without it, serde_json's float parser isn't correctly rounded, so some 16–17-significant-digit doubles decode 1 ULP off. For example, 1.4820142857142857 re-encodes as 1.4820142857142855.

  • Measured: about 2.7k of 20k shortest-form doubles mismatched against PHP 8.4 in the CLI fuzz, and 5.8k of 20k changed in a round trip on the Server.
  • Impact on the SDK: any float the SDK decodes and re-emits (activity results and arguments, memos, search attributes, heartbeat details, query and update results) can come back with different digits than the client or the PHP/Python SDKs sent. User code that deserializes f64 also sees the off-by-one-ULP value.
  • Fix: serde_json = { version = "1", features = ["float_roundtrip"] }. Cargo features are unified across the graph, so this applies to every serde_json user in a worker binary. The only cost is slightly slower float parsing.
  • Tests:
    • a round-trip test that decodes and re-encodes [1.4820142857142857, 124435.71428571429, 0.7071067811865476] and gets the digits back unchanged;
    • a payload test through the codec path.
      Each should fail without the feature.

Release: after #178 and 4.11.2, as 4.11.3. If it's ready before 4.11.2's head is frozen, it can go in 4.11.2 instead.

Activity

  1. added a commit that references this issue on Nov 13, 2026
    f335d26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions