Skip to content

[wrangler] GA auto-provision: refactor, expand binding support, add interactivity#13352

Draft
penalosa wants to merge 8 commits intomainfrom
penalosa/ga-auto-provision
Draft

[wrangler] GA auto-provision: refactor, expand binding support, add interactivity#13352
penalosa wants to merge 8 commits intomainfrom
penalosa/ga-auto-provision

Conversation

@penalosa
Copy link
Copy Markdown
Contributor

@penalosa penalosa commented Apr 8, 2026

GA the auto-provisioning feature with expanded binding support, interactive UX, and refactored architecture.

Refactoring:

  • Split monolithic bindings.ts into one handler file per binding type under provision/
  • Each handler class owns its static metadata (bindingType, friendlyName, load, create)
  • HANDLERS registry is now a simple map from binding type to handler class

New binding types:

  • Queues, Dispatch Namespaces (CI-safe, auto-create with just a name)
  • Vectorize (interactive: prompts for dimensions + metric)
  • Hyperdrive (interactive: connection string wizard with 3 origin types, passwords masked)
  • Pipelines (interactive: prompts for SQL query)
  • VPC Services (interactive: type, tunnel, host config wizard)
  • mTLS Certificates (interactive: cert + key file paths)

Interactivity:

  • Interactive by default with search-as-you-type (autocomplete) for existing resources
  • Non-interactive when all details supplied in config (e.g. bucket_name, database_name)
  • CI-safe bindings auto-create in CI with random-suffixed names
  • Non-CI-safe bindings show actionable provisioning hints (useful for both humans and AI agents)

Pre-flight check:

  • All-or-nothing: if any binding can't be auto-provisioned in CI, nothing is created
  • Error message lists all blocked bindings with hints, plus what would auto-provision once resolved

Bug fixes:

  • Random suffix on auto-generated names to prevent collisions
  • Validation relaxed to allow omitting ID fields for provisionable bindings

Removed:

  • Config file patching (inheritance handles subsequent deploys)

Known follow-ups:


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because:

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

⚠️ No Changeset found

Latest commit: 59f83eb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 8, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13352

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13352

miniflare

npm i https://pkg.pr.new/miniflare@13352

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13352

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13352

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13352

@cloudflare/vitest-pool-workers

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

@cloudflare/workers-editor-shared

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

wrangler

npm i https://pkg.pr.new/wrangler@13352

commit: 879e241

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

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

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

This PR refactors auto-provisioning into per-binding-type handler files, adds 7 new binding types with interactive/CI flows, and introduces a pre-flight check for non-CI-safe bindings.

Issues

  1. Dead configPath computation and assertionconfigPath is computed on line 158 and asserted on lines 171–174, but is never used afterward (config write-back was removed in this PR). This is dead code that will confuse future readers and causes a spurious assertion failure for programmatic callers that don't set a config file path.

  2. Unused autoCreate parameterprovisionBindings still accepts an autoCreate parameter (line 154) that is never read. Both callers (deploy.ts:1001 and upload.ts:799) pass props.experimentalAutoCreate, but the function body ignores it. The PR description acknowledges this as a known follow-up, but since the parameter actively misleads readers into thinking there's an opt-in gate, it would be cleaner to remove it in this PR. (Can't leave a line-level comment since the signature is outside the diff — just flagging it here.)

Comment on lines +171 to +174
assert(
configPath,
"Provisioning resources is not possible without a config file"
);
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.

configPath is computed (line 158) and asserted here, but it's never used — the config-write-back code that consumed it was removed in this PR. This dead assertion could fail for programmatic callers that don't have a config file path.

Suggested change
assert(
configPath,
"Provisioning resources is not possible without a config file"
);

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Apr 8, 2026

Review posted successfully on PR #13352. I found two actionable issues:

  1. Dead configPath assertion (lines 158/171-174 in bindings.ts) — configPath is computed and asserted but never used since the config write-back code was removed in this PR. Posted as an inline suggestion to remove the dead code.

  2. Unused autoCreate parameter (line 154 in bindings.ts) — The function still accepts this parameter but never reads it, while both callers still pass it. Flagged in the review body since the function signature was outside the diff range for inline comments.

github run

Move KV, D1, R2, and AI Search handlers from the monolithic bindings.ts
into individual files under provision/. Each handler class now owns its
static metadata (bindingType, friendlyName, load, create).

Other changes in this refactor:
- Search-as-you-type autocomplete replaces the old fixed-list select
- Pre-flight check prevents orphaned resources (all-or-nothing in CI)
- Random suffix on auto-generated names to prevent collisions
- Remove config file write-back (inheritance handles subsequent deploys)
- Remove autoCreate/experimentalAutoCreate flag and CLI option
- Rewrite provision tests for the new flow
- Add QueueHandler in provision/queue.ts
- Make queue_name optional + INHERIT_SYMBOL in Cf types and config
- Add INHERIT_SYMBOL handling in upload form
- Gate ensureQueuesExistByConfig behind RESOURCES_PROVISION flag
- Provision consumer-only queues, de-duplicate by queue_name
- Filter undefined producer.queue from trigger display
- Add queue provisioning tests
- Add DispatchNamespaceHandler in provision/dispatch-namespace.ts
- Export createWorkerNamespace, listWorkerNamespaces, Namespace type
- Make namespace optional + INHERIT_SYMBOL in Cf types and config
- Add INHERIT_SYMBOL handling in upload form
- Add VectorizeHandler in provision/vectorize.ts
- Interactive prompts for dimensions and distance metric
- Make index_name optional + INHERIT_SYMBOL in Cf types and config
- Add INHERIT_SYMBOL handling in upload form
- Add HyperdriveHandler in provision/hyperdrive.ts
- Interactive wizard for connection string, host+port, Access, and VPC origins
- Passwords prompted with isSecret: true
- Make id optional + INHERIT_SYMBOL in Cf types and config
- Add INHERIT_SYMBOL handling in upload form
- Add PipelineHandler in provision/pipeline.ts
- Interactive prompt for SQL query
- Make pipeline field optional + INHERIT_SYMBOL in Cf types and config
- Add INHERIT_SYMBOL handling in upload form
- Add VpcServiceHandler in provision/vpc-service.ts
- Interactive wizard for service type, tunnel ID, and origin config
- Make service_id optional + INHERIT_SYMBOL in Cf types and config
- Add INHERIT_SYMBOL handling in upload form
- Add MtlsCertificateHandler in provision/mtls-certificate.ts
- Interactive prompts for cert and key file paths
- Make certificate_id optional + INHERIT_SYMBOL in Cf types and config
- Add INHERIT_SYMBOL handling in upload form
- Fix symbol-to-string coercion in print-bindings
@penalosa penalosa force-pushed the penalosa/ga-auto-provision branch from 879e241 to 59f83eb Compare April 17, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants