Skip to content

chore: migration trace - rich error model client API#654

Closed
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:port/migration-trace-rich-error-model
Closed

chore: migration trace - rich error model client API#654
He-Pin wants to merge 1 commit intoapache:mainfrom
He-Pin:port/migration-trace-rich-error-model

Conversation

@He-Pin
Copy link
Member

@He-Pin He-Pin commented Mar 8, 2026

Motivation

This PR tracks the migration of upstream akka/akka-grpc commits 1c08d131 and 40fb2f2c which together add first-class client-side support for the gRPC Rich Error Model.

Previously, when a gRPC call failed with a StatusRuntimeException containing rich error details (as defined by Google's API Design Guide error model), there was no first-class API to access the structured com.google.rpc.Status from the client side. Users had to manually inspect trailers using grpc-java internals.

Note: This feature was independently ported to apache/pekko-grpc as PR #645 (merged as commit 82300037). This PR exists solely for migration audit trail purposes.

Modification

  • Added scaladsl.MetadataStatus trait with status, code, message, details, getParsedDetails[K] methods
  • Added javadsl.MetadataStatus trait with Java-style getter methods
  • Added RichGrpcMetadataImpl (internal) that extracts com.google.rpc.Status from StatusRuntimeException trailers via StatusProto.fromStatusAndTrailers
  • Changed GrpcServiceException.apply(StatusRuntimeException) to wrap metadata in RichGrpcMetadataImpl
  • Added GrpcServiceException.create() Java API accepting java.util.List
  • Added .recoverWith(richError) / .recoverWithRetries(1, richErrorStream) to all RequestBuilderImpl invocation paths
  • New RichErrorModelNativeSpec.scala and RichErrorModelNativeTest.java integration tests
  • RichErrorModelSpec refactored from abstract to concrete

Result

Clients can pattern-match GrpcServiceException.metadata as MetadataStatus and call getParsedDetails[LocalizedMessage] (or similar) to access structured error details without touching grpc-java internals.

References

This commit marks the migration of akka/akka-grpc commits 1c08d131 and 40fb2f2c
into pekko-grpc. The feature was independently ported to apache/pekko-grpc as PR apache#645
(commit 8230003).

Local migration commit: 7fe45e6b

Upstream: akka/akka-grpc@1c08d131 akka/akka-grpc@40fb2f2c

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@He-Pin He-Pin closed this Mar 8, 2026
@He-Pin He-Pin deleted the port/migration-trace-rich-error-model branch March 8, 2026 11:45
@He-Pin He-Pin restored the port/migration-trace-rich-error-model branch March 8, 2026 11:55
@He-Pin He-Pin reopened this Mar 8, 2026
@He-Pin
Copy link
Member Author

He-Pin commented Mar 8, 2026

Investigation: Why this PR has no file changes

After investigation, this PR contains zero file changes because the Rich Error Model client API feature was already independently merged into apache/pekko-grpc as PR #645 (commit 82300037).

Our migration commit 7fe45e6b on branch port-2.3.0 implements the same feature ported from akka/akka-grpc commits 1c08d131 and 40fb2f2c. Since PR #645 was already merged before we could submit our migration PR, there are no new changes to contribute.

Closing this PR as the feature is already available in main. The migration is tracked in our migration-checklist.md for audit purposes.

@He-Pin He-Pin closed this Mar 8, 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