Skip to content

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

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

[wrangler] GA auto-provision: refactor, expand binding support, add interactivity#13352
penalosa wants to merge 6 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:

…nteractivity

- Refactor provisioning into one handler file per binding type (provision/*.ts)
- Add provisioning support for Queues, Dispatch Namespaces, Vectorize, Hyperdrive, Pipelines, VPC Services, and mTLS Certificates
- Make provisioning interactive by default with search-as-you-type
- CI-safe bindings (KV, R2, D1, AI Search, Queues, Dispatch Namespaces) auto-create in CI
- Non-CI-safe bindings show actionable provisioning hints
- Pre-flight check prevents orphaned resources (all-or-nothing)
- Add random suffix to auto-generated names to prevent collisions
- Remove config file patching (inheritance handles subsequent deploys)
- Rewrite provision tests for new flow
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 8, 2026

⚠️ No Changeset found

Latest commit: 22100b3

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: f3adcc7

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

penalosa added 5 commits April 9, 2026 01:23
The auto-provision feature no longer uses a flag to control behavior.
CI-safe bindings auto-create, others require interactive prompts or
pre-supplied config. The --x-auto-create CLI flag and AUTOCREATE_RESOURCES
experimental flag are removed.
Handlers for new binding types (dispatch_namespace, queue, vectorize,
pipeline, ai_search) now return isFullySpecified()=true when the user
has provided the resource identifier in config. This prevents the
provisioning flow from making API calls to verify existence, which
broke existing deploy tests that don't mock those APIs.
…load form

- Update Cf* interfaces in worker.ts: ID fields now optional + INHERIT_SYMBOL
- Update config types in environment.ts: ID fields now optional
- Add INHERIT_SYMBOL handling in create-worker-upload-form.ts for all 7 new
  provisionable binding types (queue, vectorize, hyperdrive, dispatch_namespace,
  pipeline, vpc_service, mtls_certificate)
- Fix downstream type errors in miniflare, queues client, type-generation,
  and print-bindings

This ensures the type system accurately reflects that provisionable bindings
may not have their ID field set in config, and that INHERIT_SYMBOL flows
correctly through the entire pipeline from config -> binding -> upload form.
@penalosa penalosa force-pushed the penalosa/ga-auto-provision branch from f3adcc7 to 22100b3 Compare April 9, 2026 11:40
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