[wrangler] GA auto-provision: refactor, expand binding support, add interactivity#13352
[wrangler] GA auto-provision: refactor, expand binding support, add interactivity#13352
Conversation
|
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:
|
f3adcc7 to
22100b3
Compare
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
879e241 to
59f83eb
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