feat: blacklist-based Worker config types + adopt existing remote resources#2
Merged
Conversation
Switch from a Pick whitelist to an Omit blacklist so that new wrangler config options (and binding types without an oblaka resource yet) fall through automatically as a fallback. The blacklist excludes only fields managed by oblaka resources, identity fields handled at the top level, and hidden internal fields. Co-Authored-By: Claude Opus 4.6 <[email protected]>
fc5fbc5 to
9f9eea6
Compare
… level Add @ts-expect-error coverage proving kv_namespaces is rejected by the Omit blacklist (and that non-managed raw config fields still pass through), locking in the contract introduced by the whitelist-to-blacklist refactor. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Cover remote-state adoption and create paths using the shared mock-client helper, mirroring the Worker resource tests. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
On lost state, a blind create either fails with a conflict (Worker, R2, Queues) or silently spawns a duplicate (D1 allows same-name databases, risking data loss). Look each resource up by name first and adopt it. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The Worker, Queues, and R2 list endpoints were fetched with the default page size, so an existing resource past page one would be missed and the adopt-on-create path would fall through to a conflicting blind create. Request per_page=1000 (matching the KV namespace lookup in state.ts) so adoption sees the full set. D1 already filters server-side by name. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch bundles a config-type refactor with a resource-adoption fix and supporting tests.
Worker config types (blacklist)
Pick<Config, …>whitelist of allowed Worker config fields with anOmit<Config, …>blacklist of oblaka-managed fields.hyperdrive,pipelines,mtls_certificates,ratelimits,tail_consumers,dispatch_namespaces,secrets_store_secrets,unsafe, …) now fall through as raw config until a dedicated oblaka resource is added.name,compatibility_flags,account_id), resource-managed bindings (kv_namespaces,r2_buckets,d1_databases,queues,durable_objects,migrations,workflows,containers,send_email,services,vectorize,analytics_engine_datasets,browser,images,version_metadata,worker_loaders,vpc_networks,ai_search_namespaces,flagship) and hiddencache.Adopt existing remote resources instead of failing on create
per_page=1000(matching the KV namespace lookup instate.ts) so an existing resource past the default first page is still found; D1 filters server-side by name.Tests
mock-clienttest helper.@ts-expect-errorassertion proving the Worker blacklist rejects oblaka-managed fields (e.g.kv_namespaces) while still accepting raw passthrough fields.Release
0.0.15.Known limitations
per_page=1000raises the adoption ceiling to 1000 resources per type per account rather than doing unbounded cursor pagination (consistent with existing code).Test plan
bun run typecheckbun run format:checkbun run lintbun test(87 pass)🤖 Generated with Claude Code