queue: let accept_and_handle pick the transport - #262
Open
fantix wants to merge 1 commit into
Open
Conversation
The receive codec could only be inferred from the subscriber's payload annotation, which has no way to name a format such as CBOR: an untyped handler always decodes JSON. A caller that already knows the wire format of a delivery now passes it in. Exports the Transport protocol, which the new parameter is typed with.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
elprans
reviewed
Aug 7, 2026
| @@ -0,0 +1,4 @@ | |||
| `accept_and_handle()` now takes a `transport`, so a caller that knows the wire | |||
Collaborator
There was a problem hiding this comment.
The intended mechanism for overriding of the transport is to use Topic[T] in the annotation instead of T and then pass the transport as a kwarg in the topic constructor, (Topic[T]("topic", transport=special))
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.
The receive codec is inferred from the subscriber's payload annotation, which
has no way to name a format such as CBOR —
payload_transport_kind()mapsevery structured annotation onto
RawJsonTransport, and an untyped handlergets it unconditionally. A caller that already knows the wire format of a
delivery had nowhere to say so: the
transportargument existed on the private_accept_and_handle, but not on the public entry points.Adds
transporttoaccept_and_handleon the async client, the sync client,and both module-level functions, and exports the
Transportprotocol theparameter is typed with.
The codec is all it replaces — payload validation is separate
(
InvocationPlan.payload_adapterrunsvalidate_pythonon whatever thetransport returned), so a typed subscriber is still validated. There is a test
for that.
No behaviour change when the argument is omitted.
First of three:
accept_and_handle(transport=...)subscribe(transport=...), so a delivery dispatched by a client the SDK didnot construct also decodes correctly