[wrangler] GA auto-provision: refactor, expand binding support, add interactivity#13352
[wrangler] GA auto-provision: refactor, expand binding support, add interactivity#13352
Conversation
…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
|
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
There was a problem hiding this comment.
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
-
Dead
configPathcomputation and assertion —configPathis 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. -
Unused
autoCreateparameter —provisionBindingsstill accepts anautoCreateparameter (line 154) that is never read. Both callers (deploy.ts:1001andupload.ts:799) passprops.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.)
| assert( | ||
| configPath, | ||
| "Provisioning resources is not possible without a config file" | ||
| ); |
There was a problem hiding this comment.
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.
| assert( | |
| configPath, | |
| "Provisioning resources is not possible without a config file" | |
| ); |
|
Review posted successfully on PR #13352. I found two actionable issues:
|
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.
f3adcc7 to
22100b3
Compare
GA the auto-provisioning feature with expanded binding support, interactive UX, and refactored architecture.
Refactoring:
bindings.tsinto one handler file per binding type underprovision/bindingType,friendlyName,load,create)HANDLERSregistry is now a simple map from binding type to handler classNew binding types:
Interactivity:
bucket_name,database_name)Pre-flight check:
Bug fixes:
Removed:
Known follow-ups:
Cf*TypeScript types to match new optional validationautoCreateparameter fromprovisionBindingssignature