Skip to content

queue: let accept_and_handle pick the transport - #262

Open
fantix wants to merge 1 commit into
mainfrom
fantix/queue-accept-transport
Open

queue: let accept_and_handle pick the transport#262
fantix wants to merge 1 commit into
mainfrom
fantix/queue-accept-transport

Conversation

@fantix

@fantix fantix commented Aug 7, 2026

Copy link
Copy Markdown
Member

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() maps
every structured annotation onto RawJsonTransport, and an untyped handler
gets it unconditionally. A caller that already knows the wire format of a
delivery had nowhere to say so: the transport argument existed on the private
_accept_and_handle, but not on the public entry points.

Adds transport to accept_and_handle on the async client, the sync client,
and both module-level functions, and exports the Transport protocol the
parameter is typed with.

The codec is all it replaces — payload validation is separate
(InvocationPlan.payload_adapter runs validate_python on whatever the
transport 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:

  1. this PRaccept_and_handle(transport=...)
  2. subscribe(transport=...), so a delivery dispatched by a client the SDK did
    not construct also decodes correctly
  3. the Vercel workflow world's CBOR transport, which is what needs both

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.
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-py Ready Ready Preview Aug 7, 2026 3:08pm

Request Review

@fantix
fantix requested a review from a team August 7, 2026 15:12
@@ -0,0 +1,4 @@
`accept_and_handle()` now takes a `transport`, so a caller that knows the wire

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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))

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.

2 participants