Skip to content

[translation]: Add a library for substituting one gRPC method for ano… - #152

Open
Vaughan-Temporal wants to merge 1 commit into
mainfrom
vaughan/translation-library
Open

[translation]: Add a library for substituting one gRPC method for ano…#152
Vaughan-Temporal wants to merge 1 commit into
mainfrom
vaughan/translation-library

Conversation

@Vaughan-Temporal

Copy link
Copy Markdown

Adds Method Translation Library. Review focus should generally be on the typing and structure of this, since this is establishing a new pattern.

The core idea here is we do full message capture instead of frame by frame capture. We can not know the details of what we are translating, so that falls upon the Actual translation integration for each message set.

…ther

Some upstreams do not serve a method under the name a caller knows it by. The
proxy can forward a method or refuse it, but it has no way to answer one call
with a different one, which is what an upstream that exposes the same capability
under another service requires.

Add internal/translation. A Translation names the inbound method, the method
that stands in for it, and the conversions between their message types; a
Registry indexes them by inbound method; and a unary client interceptor converts
the request, sends it under the substituted method, and folds the reply back into
the message the caller is waiting on. Nothing else on the connection needs to
know a substitution happened.

Adapt builds a Translation from two typed conversions, so a mapping is written
against concrete message types and never asserts on proto.Message itself. The
response conversion is given the original request as well as the upstream reply,
because a request field the upstream has no equivalent for can only be honoured
on the way back. WithHeader stamps metadata the substituted API requires, set
rather than appended, and only on a call that was actually substituted.

Via sends the substituted call over a different connection, for an upstream
method the original connection's service does not serve at all. It leaves the
interceptor chain at that point, which is why callers install this innermost:
everything above then sees the method and message types the caller asked for.

No translations are registered yet, so nothing changes.
@Vaughan-Temporal
Vaughan-Temporal requested review from a team and pseudomuto as code owners September 4, 2026 16:37
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.46018% with 4 lines in your changes missing coverage. Please review.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants