Repository navigation
feat(pubsub): promote BulkPublishEventAlpha1 to stable BulkPublishEvent - #1
Merged
Merged
Conversation
Dapr promoted the bulk publish API out of alpha in runtime 1.17, but the JS
SDK still targeted the alpha1 variants over both transports. Move to the
stable API while keeping older sidecars working.
- gRPC: call BulkPublishEvent, falling back to BulkPublishEventAlpha1 when
the sidecar answers UNIMPLEMENTED.
- HTTP: call v1.0/publish/bulk/{pubsubName}/{topic}, falling back to
v1.0-alpha1 on a 404. A 404 also signals an unknown pub/sub component, so
the downgrade is only remembered once the alpha1 endpoint has answered.
- Vendored proto: backport the stable BulkPublishEvent RPC and mark the
alpha1 RPC deprecated, matching upstream dapr/dapr, and regenerate the
affected stubs.
The public surface is unchanged: publishBulk keeps the same name, parameters
and return type. The fallback is remembered per client, so a pre-1.17 sidecar
costs at most one extra round trip, and it matches the behaviour the Go,
Python and Java SDKs already ship for this RPC.
Fixes dapr#786
Signed-off-by: Mark Gardner <mark.gardner@microsoft.com>
3 tasks done
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.
Description
Dapr promoted the bulk publish API out of alpha in runtime 1.17, but the JS SDK still called the alpha1 variants on both transports. This moves
client.pubsub.publishBulk(...)onto the stable API without dropping support for the runtimes people are actually on.Approach: stable first, with a transparent fallback.
BulkPublishEventand retriesBulkPublishEventAlpha1when the sidecar answersUNIMPLEMENTED.v1.0/publish/bulk/{pubsubName}/{topic}and retriesv1.0-alpha1on a 404.BulkPublishEventRPC and marks alpha1deprecated, matching upstream dapr/dapr byte for byte. Affected stubs were regenerated.The public surface does not change.
publishBulkkeeps the same name, parameters, and return type, so no consumer code needs updating. The downgrade is remembered per client, so a pre-1.17 sidecar costs at most one extra round trip rather than one per call.Why a fallback rather than a hard switch. A hard switch is not actually available here. The stable RPC is absent from the pinned v1.16.0 proto, so it would require bumping the pin, and Dapr 1.17 split
dapr.protointo 14 files. That relocates message types out ofdapr_pbinto new modules and breaks imports across the whole SDK. Separately, this repo's e2e defaults toDAPR_RUNTIME_VER=1.16.12, so a hard switch would fail its own CI, and 1.16.x is still actively patched. Since 1.17 and 1.18 still register alpha1 on both transports, the fallback never becomes dead code that silently breaks. This also matches what the Go, Python, and Java SDKs already ship for this exact RPC.Things worth a careful look
The vendored proto is hand-edited. The sanctioned path is bumping
DAPR_VERSIONinscripts/fetch-proto.js, which is what chore(proto): update protos and point Workflow to beta APIs dapr/js-sdk#531 did for workflow. I did not, because of the 14-file split described above. The backported RPC is byte-exact with upstream includingoption deprecated = true, so a later fetch at v1.17+ converges rather than conflicts. If maintainers would rather see the pin bump land first as its own PR, that is a reasonable ask and I am happy to rework.npx buf generateis not reproducible on main today. It resolves protoc-gen-es v2.11.0 to v2.15.0 and silently flips the committed stubs from ESM to CommonJS, about 750 lines of unrelated churn. I used a pinned config that reproduces the committed stubs exactly, keeping the codegen diff to the 43-line bulk publish delta. This looks like a pre-existing bug worth its own issue.E2E was not run. No live Dapr sidecar was available. Unit tests, typecheck, and build all pass. Note that CI e2e at 1.16.12 exercises the fallback path, not the stable path. Bumping
DAPR_RUNTIME_VERto 1.17+ would cover stable but risks surfacing unrelated e2e failures, so I left it alone deliberately.HTTP 404 is ambiguous, since it is also how the sidecar reports an unknown pub/sub component. The fallback is therefore only remembered once the alpha1 endpoint has actually answered, which is the only real proof the runtime predates 1.17. There is a unit test covering this.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: dapr#786
(Fully qualified because this PR targets the fork. Retarget to
dapr/js-sdkand it becomesFixes #786.)Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:
tsc --noEmitclean,npm run buildsucceeds)publishBulkJSDoc remarks plus a CHANGELOG entry)