feat(cloudflare/workers): worker versions and gradual deployments - #948
Open
sam-goodwin wants to merge 1 commit into
Open
feat(cloudflare/workers): worker versions and gradual deployments#948sam-goodwin wants to merge 1 commit into
sam-goodwin wants to merge 1 commit into
Conversation
Adds a version prop to Cloudflare.Worker mapping Cloudflare's versions and gradual deployments onto alchemy stages: - version.parent uploads this Worker as an immutable version of another Worker's script (PR previews via preview URL, canaries via traffic) - version.traffic on a self-owned Worker deploys gradually, splitting traffic between the new and previously-live version Includes distilled patch typing createScriptVersion's binding-validation errors (alchemy-run/distilled#389). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/5a5eb63@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/5a5eb63@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/5a5eb63 |
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.
Adds a
versionprop toCloudflare.Workermapping Cloudflare's versions & gradual deployments onto alchemy stages.parentaccepts a Worker ref (yield* Worker.ref(id, { stage, stack })), a locally-declared Worker, or a literal script name as an escape hatch. Changing parent (or mode) replaces the resource.readverifies the version exists on the parent (never adopts the parent's script),deleterestores 100% of traffic to the surviving version and leaves the parent untouched,precreateskips the placeholder script.routes,domain,crons,tags,observability,logpush,placement,limits,subdomain,assets,name,namespace) are rejected on version workers with a typedWorkerVersionConfigError, as are locally-hosted Durable Object / Workflow classes (their migrations would mutate the parent).createScriptVersion+createScriptDeploymentinstead of the full-cutoverputScript; the first deploy of a script always goes to 100%. Assets and pending DO migrations can't ride a rollout (typed error).versionOf,versionId,deploymentId. The metadata hash reducesversion.parentto the parent's script name so parent redeploys don't spuriously re-version children.Depends on alchemy-run/distilled#389 (typed binding-validation errors on
createScriptVersion, submodule bumped here).Live-tested in
test/Cloudflare/Workers/WorkerVersion.test.ts: preview URL serves the version's code while the parent's deployment is untouched, canary split asserted at 25/75 out-of-band vialistScriptDeployments, canary removal restores 100%, string-name parent, rollout 100 → 50/50 → 100, and the validation error.Worker.test.tspasses unchanged.Docs:
Versions & Gradual DeploymentsJSDoc section on the Worker resource plus a new section in the Workers guide.🤖 Generated with Claude Code