Skip to content

[wrangler] Move binding local-development support into a single registry - #13728

Merged
penalosa merged 4 commits into
mainfrom
penalosa/rename-always-remote
May 26, 2026
Merged

[wrangler] Move binding local-development support into a single registry#13728
penalosa merged 4 commits into
mainfrom
penalosa/rename-always-remote

Conversation

@penalosa

@penalosa penalosa commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Consolidates the per-binding-type local-dev support classification into a single source-of-truth registry, and makes adding a new always-remote binding deliberately friction-y.

The "is this binding type always-remote / has a local simulator / accepts remote: true" knowledge was previously fragmented across three places that had to be kept in sync by hand:

  1. The hard-coded if chain inside pickRemoteBindings() (packages/wrangler/src/api/remoteBindings/index.ts).
  2. The supports literal threaded through every warnOrError(...) call site in packages/wrangler/src/dev/miniflare/index.ts.
  3. JSDoc strings on the various binding type fields in workers-utils.

This PR introduces getBindingLocalSupport() in @cloudflare/workers-utils as the single registry. pickRemoteBindings() and warnOrError() both consult it. Adding a new always-remote binding is now a one-line edit in one obvious file, and the type-level variant for "no local simulator, ever" is the deliberately verbose DO-NOT-USE-this-resource-will-never-have-a-local-simulator so that adding to it shows up in PR diffs as an obvious red flag for reviewers. The neighbouring remote variant carries a temporal "no local simulator yet" connotation — bindings there should move to local-and-remote once a local sim lands.

The exhaustive Record<Binding["type"], BindingLocalSupport> constraint catches drift at compile time: adding a new variant to Binding["type"] forces an accompanying registry entry.

Also fixes a latent bug noticed during the refactor: remote: false on always-remote bindings (AI, AI Search, Media, Artifacts, Flagship, VPC Service, VPC Network) was previously silently accepted and produced a non-functional binding. wrangler dev now fails with a clear error directing users to either remove the remote field or set it to true. By symmetry with remote: true on bindings that lack remote support, an explicit contradiction in the config is now reported instead of silently no-oped.

While auditing classifications, also surfaced #13727 — Miniflare's queues plugin silently ignores remote: true on queue producers (separate bug, separate fix).


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: existing 3774 wrangler unit tests + 544 workers-utils tests cover the affected code paths and all pass; the e2e warning-text snapshot in e2e/remote-binding/dev-remote-bindings.test.ts:182 is byte-identical; and the remote: false throw is the symmetric counterpart of an existing throw with identical telemetry plumbing.
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: the internal classification is not user-facing. The new remote: false-on-always-remote error message is self-explanatory and changeset-documented.

Open in Devin Review

Adds a `getBindingLocalSupport()` helper in workers-utils as the
source of truth for whether each binding type has a local simulator,
optional remote proxy, or no local sim at all. `pickRemoteBindings()`
and `warnOrError()` now both consult this helper instead of duplicating
hard-coded type lists. Adding a new always-remote binding is now a
single, auditable edit guarded by a deliberately verbose
`DO-NOT-USE-this-resource-will-never-have-a-local-simulator` discriminator.

Also fixes a latent bug: `remote: false` on always-remote bindings
(AI, AI Search, Media, Artifacts, Flagship, VPC) was previously silently
accepted and produced a non-functional binding. `wrangler dev` now fails
with a clear error directing users to either remove the `remote` field
or set it to `true`.
@changeset-bot

changeset-bot Bot commented Apr 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8d5be82

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
wrangler Patch
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Apr 29, 2026
@workers-devprod
workers-devprod requested review from a team and ascorbic and removed request for a team April 29, 2026 15:14
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • packages/workers-utils/src/config/binding-local-support.ts: [@cloudflare/wrangler]
  • packages/workers-utils/src/index.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/api/remoteBindings/index.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/dev/miniflare/index.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/utils/print-bindings.ts: [@cloudflare/wrangler]

@github-actions

github-actions Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One syntax error that will prevent compilation.

Comment thread packages/wrangler/src/utils/print-bindings.ts Outdated
@ask-bonk

ask-bonk Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

This PR consolidates per-binding-type local-dev support classification into a single registry in @cloudflare/workers-utils and adds a new remote: false error for always-remote bindings.

Issues found:

  1. Syntax error (will not compile): In packages/wrangler/src/utils/print-bindings.ts line 1033, the DO-NOT-USE-this-resource-will-never-have-a-local-simulator / remote === false branch is missing a comma between the template literal string and the { telemetryMessage: true } options object passed to new UserError(...). I posted a suggestion comment with the fix.

github run

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@pkg-pr-new

pkg-pr-new Bot commented Apr 29, 2026

Copy link
Copy Markdown
create-cloudflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/create-cloudflare@13728

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/deploy-helpers@13728

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/kv-asset-handler@13728

miniflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/miniflare@13728

@cloudflare/pages-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/pages-shared@13728

@cloudflare/unenv-preset

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/unenv-preset@13728

@cloudflare/vite-plugin

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vite-plugin@13728

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vitest-pool-workers@13728

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/workers-editor-shared@13728

@cloudflare/workers-utils

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/workers-utils@13728

wrangler

npm i https://pkg.pr.new/cloudflare/workers-sdk/wrangler@13728

commit: 8d5be82

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry for the delay in getting to this! It looks good (subject to the merge conflict), though it doesn't look there is a test that exercises the remote: false+ remote only path, so it might be good to add one to check the thrown error.

Comment thread packages/workers-utils/src/config/binding-local-support.ts
…s-remote

# Conflicts:
#	packages/wrangler/src/utils/print-bindings.ts
@workers-devprod

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codeowners reviews satisfied

@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk May 26, 2026
@penalosa
penalosa enabled auto-merge (squash) May 26, 2026 13:38
@penalosa
penalosa merged commit 49c1a59 into main May 26, 2026
53 checks passed
@penalosa
penalosa deleted the penalosa/rename-always-remote branch May 26, 2026 14:37
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants