fix: map no trailers ok status to internal#2543
Open
rumenov wants to merge 1 commit intohyperium:masterfrom
Open
fix: map no trailers ok status to internal#2543rumenov wants to merge 1 commit intohyperium:masterfrom
rumenov wants to merge 1 commit intohyperium:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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.
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.