Skip to content

fix(a2a-pb): decode integral Value numbers as integers - #440

Merged
muscariello merged 1 commit into
stack/01-client-jsonrpc-http-statusfrom
stack/02-pb-integral-numbers
Nov 2, 2026
Merged

muscariello merged 1 commit into
stack/01-client-jsonrpc-http-statusfrom
stack/02-pb-integral-numbers

Conversation

@muscariello

Copy link
Copy Markdown
Member

Fixes #399. Replaces #405. Stacked on #439: review only the last commit.

Cause: google.protobuf.Value stores every number as a double, and proto_value_to_json_value turned each one back into a JSON float. An integer in a data part or in metadata therefore reached the executor as 3600.0, and serde_json::from_value::<u32> rejected it. Every binding decodes through this function.

Fix: a whole number within ±2^53, where a double is exact, is returned as an integer (json_number in pbconv.rs). Fractions, larger magnitudes and non-finite values behave as before, and the protojson wire form is unchanged.

Tests: new integers_in_data_parts_stay_integers; the two round-trip tests no longer avoid integers.

Unproven: the failure on main and the fuzz-idempotence claim in #405 were not run locally. CI is the check.

@codecov

codecov Bot commented Nov 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

google.protobuf.Value carries every number as a double, and
proto_value_to_json_value turned each one back into a JSON float, so
an integer in a data part or in metadata reached the executor, and a
client's decoded response, as 3600.0. serde then refuses it for an
integer type ("invalid type: floating point `3600.0`, expected u32").

A whole number within +-2^53, where a double is exact, is now given
back as an integer; other numbers stay floats. The round-trip tests
that used floats to work around this now use integers, and a new
protojson test decodes a JSON-RPC SendMessage whose data part holds an
integer and deserializes it into u32.

Fixes: #399

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: gulldan <[email protected]>
@muscariello
muscariello force-pushed the stack/02-pb-integral-numbers branch from 3e5e2eb to 8068070 Compare November 2, 2026 12:02
@muscariello
muscariello removed this pull request from stack #442 November 2, 2026 15:00
@muscariello
muscariello added this pull request to stack #456 November 2, 2026 15:01
@muscariello
muscariello added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 90e2876 Nov 2, 2026
25 checks passed
@muscariello
muscariello deleted the stack/02-pb-integral-numbers branch November 2, 2026 17:44
@github-actions github-actions Bot mentioned this pull request Nov 2, 2026
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.

[Bug]: a2a-pb: integers in data parts and metadata are decoded as floats (3600 → 3600.0)

3 participants