fix(client): export TenantTransportDecorator and fix docstring#915
Open
4444J99 wants to merge 1 commit intoa2aproject:1.0-devfrom
Open
fix(client): export TenantTransportDecorator and fix docstring#9154444J99 wants to merge 1 commit intoa2aproject:1.0-devfrom
4444J99 wants to merge 1 commit intoa2aproject:1.0-devfrom
Conversation
- Add TenantTransportDecorator to transports __init__.py __all__ so it is importable via `from a2a.client.transports import TenantTransportDecorator` alongside the other transports. - Fix send_message() docstring that incorrectly described it as a streaming method (copy-paste from send_message_streaming). - Add test coverage for close() delegation and async context manager usage, verifying the decorator properly delegates lifecycle management to the underlying transport.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/transports/tenant_decorator.py | 97.87% | 100.00% | 🟢 +2.13% |
| Total | 91.59% | 91.60% | 🟢 +0.01% |
Generated by coverage-comment.yml
Contributor
There was a problem hiding this comment.
Code Review
This pull request exports the TenantTransportDecorator in the transports package, corrects a docstring in the decorator to accurately describe the non-streaming nature of the send_message method, and adds unit tests to verify that the decorator correctly delegates the close method and functions as an async context manager. I have no feedback to provide.
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.
Summary
TenantTransportDecoratoris used internally byClientFactoryto wrap transports when anAgentInterfacespecifies a tenant, but it is not exported from thea2a.client.transportspackage. This means users who need to compose transport decorators manually (e.g. stacking tenant resolution with a futureRetryTransport) must import from the private module path.This PR:
TenantTransportDecoratorfroma2a.client.transports.__init__and adds it to__all__, consistent with howClientTransport,JsonRpcTransport,RestTransport, andGrpcTransportare exported.send_message()docstring which incorrectly read "Sends a streaming message request to the agent and yields responses as they arrive" — a copy-paste fromsend_message_streaming(). Corrected to "Sends a non-streaming message request to the agent."close()delegation and async context manager usage, verifying the decorator properly delegates lifecycle management to the underlying transport.Test plan
test_tenant_decorator.pytests pass (12 existing + 2 new)from a2a.client.transports import TenantTransportDecoratorresolves correctly