Skip to content

fix: map no trailers ok status to internal#2543

Open
rumenov wants to merge 1 commit intohyperium:masterfrom
qube-rt:master
Open

fix: map no trailers ok status to internal#2543
rumenov wants to merge 1 commit intohyperium:masterfrom
qube-rt:master

Conversation

@rumenov
Copy link

@rumenov rumenov commented Mar 10, 2026

Motivation

The change updates gRPC status handling so that HTTP 200 responses missing grpc-status trailers are treated as internal errors instead of silently completing. A new integration test simulates a truncated response to ensure clients surface the issue. This prevents data loss scenarios from being masked as successful completions.
Clients will now see explicit internal errors when a streaming response ends without grpc-status trailers, preventing silent data loss. The new integration test guards this behavior against future regressions.

Solution

  1. gRPC Status Mapping
    Adjusted tonic’s infer_grpc_status logic to treat missing trailers as protocol violations.
    http 200 responses without grpc-status trailers now return an internal Status error instead of appearing as clean end-of-stream.
    Expanded comments explaining protocol expectations and rationale for mapping to Internal.
    Clarified that h2::Reason::NO_ERROR on RST_STREAM signals missing grpc-status trailers.

  2. Integration Test Coverage
    Added an integration test that simulates a truncated server response to verify the new error mapping.
    Introduced TruncatedBody and tower layer to cut off the response before trailers.
    Created missing_grpc_status_trailer_is_internal_error test ensuring client surfaces tonic::Code::Internal.
    Verified error message contains 'missing grpc-status trailer' to guard against regressions.

@rumenov rumenov changed the title map no trailers ok status to internal fix: map no trailers ok status to internal Mar 10, 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.

1 participant