Skip to content

Report malformed response messages as internal on clients - #455

Draft
stefanvanburen wants to merge 1 commit into
mainfrom
svanburen/client-decode-internal
Draft

stefanvanburen wants to merge 1 commit into
mainfrom
svanburen/client-decode-internal

Conversation

@stefanvanburen

@stefanvanburen stefanvanburen commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Client-side half of connectrpc/conformance#1190: a response message that fails to decode (or decompress) is now internal on the client instead of invalid_argument, while servers keep invalid_argument for malformed requests (connectrpc/conformance#1142). The envelope readers already had a per-side _protocol_error_code for bad flags and truncated frames, so this just routes decode and decompress failures through it too.

With this, the sync and async clients pass all 24 of connectrpc/conformance#1190's cases (up from 0). Leaving it as a draft until connectrpc/conformance#1190 settles on a code; if it lands, this should also bump the conformance version so those cases run in CI.

The decompress change isn't covered by connectrpc/conformance#1190 yet (it only sends uncompressed messages), so that part is only exercised by test_reject_malformed_message[malformed-compressed] for now.

`decode_message` and `decompress` reported every malformed message as
`invalid_argument`, which is right for a server reading a request but
tells a client that its own request was bad when the server sent a
response it can't decode. Both now take the code to report: the
envelope readers pass their `_protocol_error_code`, which is already
`internal` on the client and `invalid_argument` on the server, and the
unary clients pass `internal`.

This matches what grpc-go, connect-es, connect-rust, and connect-dart
return for the cases in connectrpc/conformance#1190.

Signed-off-by: Stefan VanBuren <stefan@vanburen.xyz>
@stefanvanburen
stefanvanburen force-pushed the svanburen/client-decode-internal branch from bc03f2a to cdb2c2d Compare November 20, 2026 13:16

This branch has not been deployed

No deployments
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