Add CBOR queue transport helpers for Workflow SDK spec v3#40
Draft
VaguelySerious wants to merge 1 commit intomizzle-dev:mainfrom
Draft
Add CBOR queue transport helpers for Workflow SDK spec v3#40VaguelySerious wants to merge 1 commit intomizzle-dev:mainfrom
VaguelySerious wants to merge 1 commit intomizzle-dev:mainfrom
Conversation
Workflow SDK runs at spec version 3 (see vercel/workflow#1627) carry a `runInput` on the first queue delivery whose `input` field is a `Uint8Array`. JSON serialization does not round-trip `Uint8Array`, so worlds that want to opt in to `SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT` need to serialize queue payloads with CBOR instead. This adds `CborTransport` + `DualTransport` helpers to each world package (turso, mongodb, redis) so the queue transport can be switched over without changing the public API. The Redis helper additionally provides a small `encodeForBullMq`/`decodeFromBullMq` wrapper because BullMQ stores `job.data` as a JSON value and needs the CBOR payload base64-wrapped to survive its internal serialization. Nothing is wired in yet — the follow-up work is described in the PR description and includes bumping `@workflow/world`, migrating to the restructured streams interface, wiring these transports into the queue and HTTP handler, and declaring `specVersion: 3` on each world. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Workflow SDK recently moved the `@workflow/world-vercel` queue transport from JSON to CBOR (vercel/workflow#1627). The move is gated behind `SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT` (spec version 3) so worlds that don't declare support stay on JSON.
This PR adds the CBOR transport building blocks to each world in this repo so they can eventually opt in. It intentionally does not flip any of the queues over — the full migration is larger than this and deserves careful review on a per-world basis.
What's in the PR
Background from upstream
In short: nothing is breaking today because these worlds haven't declared `specVersion`. But they also can't opt in to resilient start (or any future CBOR-only feature) until a transport like this is wired up.
Why not wire it in here?
These packages currently pin `@workflow/world: 4.1.0-beta.2`, which is a pre-v5 shape (flat `writeToStream`/`readFromStream` on the `World`). `@workflow/world@5.x` restructures streams into a nested `streams.{ write, close, get, list, getChunks, getInfo }` interface and requires `runId` on reads. Migrating to v5 is a prerequisite for spec v3 and I didn't want to bundle that migration into this PR — it's significant enough to deserve its own review pass (and will break the current consumer story on 4.1.x betas).
Suggested follow-up checklist
For each world (turso, mongodb, redis):
Happy to split out per-world follow-up PRs if that's easier to review.
Test plan
🤖 Generated with Claude Code