fix(cloudflare/workers-for-platforms): type getDispatchNamespaceScriptSetting errors + loosen placement#361
Merged
sam-goodwin merged 4 commits intoJun 30, 2026
Conversation
…tSetting errors + loosen placement
Add a patch for `getDispatchNamespaceScriptSetting`:
- type the `DispatchNamespaceNotFound` (100119) / `DispatchNamespaceScriptNotFound` (10007) / `Forbidden` (403) errors into its union
- loosen `placement` to `unknown` — the live endpoint 200s with `placement: {}`, which the strict union rejected (matches the account-level `getScriptScriptAndVersionSetting`)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: @distilled.cloud/core bun add @distilled.cloud/core@https://pkg.distilled.cloud/core/e824e87@distilled.cloud/aws bun add @distilled.cloud/aws@https://pkg.distilled.cloud/aws/e824e87@distilled.cloud/cloudflare bun add @distilled.cloud/cloudflare@https://pkg.distilled.cloud/cloudflare/e824e87 |
…ptSetting placement properly
The script-settings response reused the *request* placement union (every
variant requires mode/region/hostname/host), so the real response — `{}` when
unset, or `{ mode, status, last_analyzed_at }` — failed to decode. Replace it
with the actual all-optional placement-status object instead of falling back to
`unknown`.
Also teach the generator's response/request patch DSL to honour `definition` as
a type *replacement* for an existing property (previously it only added missing
properties), which is what this fix — and existing patches like
connectivity/getDirectoryService — rely on.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…stead of replacing it
Keep the upstream placement union verbatim and append the one variant upstream
omits for the *response*: the all-optional placement-status object
(`{ mode?, status?, last_analyzed_at? }`) that the real API returns (or `{}`
when unset). This decodes every real response without dropping the targeted /
region / hostname / host variants, and uses the existing `appendUnion` patch op
— so the earlier generator change (definition-as-replace) is reverted; no
codegen change is needed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The placement fix needs no codegen change; restore generate.ts to pristine. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Make the Workers for Platforms script-settings endpoint usable from typed consumers.
getDispatchNamespaceScriptSetting:{ "errors": { "DispatchNamespaceNotFound": [{ "code": 100119 }], "DispatchNamespaceScriptNotFound": [{ "code": 10007 }], "Forbidden": [{ "status": 403 }] } }Fix
placementdecoding. The vendor SDK models the response placement with the request union — every variant requiresmode/region/hostname/host— so the real response ({}when unset, or{ mode, status, last_analyzed_at }) matches no variant and fails to decode. The vendor SDK only gets away with it because it never validates the response at runtime.We keep the upstream union verbatim and append the one variant it omits for the response — the all-optional placement-status object:
Uses the existing
appendUnionpatch op — no parser/model/codegen change. (This is a semantic gap in the vendor spec, not a representation gap on our side; the generator already reproduces upstream's union faithfully — which is exactly why it failed.)Found while wiring the alchemy Cloudflare Worker resource to deploy into a dispatch namespace: the post-upload settings read needed both the typed not-found tags and a response that actually decodes.
🤖 Generated with Claude Code