Skip to content

Make the rename deployable onto an existing Worker - #11

Merged
codeyogi911 merged 1 commit into
mainfrom
fix/deployable-onto-existing-worker
Aug 7, 2026
Merged

Make the rename deployable onto an existing Worker#11
codeyogi911 merged 1 commit into
mainfrom
fix/deployable-onto-existing-worker

Conversation

@codeyogi911

Copy link
Copy Markdown
Owner

Two defects stood between the renamed suite and any deployment that already exists. Both were introduced or exposed by the Morrow → Able rename.

The rename rewrote an applied migration tag

v1_voice_demo was edited in place to declare AbleDeskAgent. Cloudflare records migration tags as applied, so on a Worker that already ran v1_voice_demo the tag would never re-run, the Durable Object class would never exist under its new name, and the AbleDeskAgent binding would resolve to nothing.

v1 is restored to the class as first created, and the rename becomes a new tag:

{ "tag": "v1_voice_demo", "new_sqlite_classes": ["AbleDeskVoiceDemoAgent"] },
{ "tag": "v2_rename_desk_agent", "renamed_classes": [{ "from": "AbleDeskVoiceDemoAgent", "to": "AbleDeskAgent" }] }

Correct in both directions: a fresh install applies both in sequence and lands on AbleDeskAgent; a Worker that already applied v1 applies only v2 and keeps its Durable Object state.

A Worker cannot be renamed in place

A deployment already serving custom domains, a Cloudflare Access application and email routing from a Worker named before the rename should keep serving from it, rather than moving all of that to a differently named Worker. ABLE_WORKER_NAME supplies the name exactly the way ABLE_D1_DATABASE_ID and its siblings already do, so the committed default stays able and nothing deployment-specific enters source. The Worker name is not customer-visible when custom domains front it.

Verification

  • npm run check — 206 + 4 tests pass, all typechecks clean
  • New coverage at the existing createProductionConfig seam: default name preserved, override applied, blank ignored, source not mutated, and invalid names rejected
  • Writing that last case found a real gap — the first regex accepted a trailing hyphen, which Cloudflare rejects because the name becomes a DNS label

🤖 Generated with Claude Code

Two things stood between the renamed suite and a deployment that already
exists.

Migration tags are an immutable contract. The rename rewrote the contents
of v1_voice_demo, which Cloudflare has already recorded as applied on any
deployed Worker: the tag would never re-run, the class would never be
created under its new name, and the AbleDeskAgent binding would resolve to
nothing. v1 is restored to the class as first created and the rename is
expressed as a new v2_rename_desk_agent tag. A fresh install applies both
and lands on AbleDeskAgent; a Worker that already applied v1 applies only
v2 and keeps its Durable Object state.

A Worker also cannot be renamed in place. A deployment already serving
custom domains, an Access application and email routing from a Worker
named before this rename should keep serving from it rather than moving
all of that to a new name. ABLE_WORKER_NAME supplies the name the same way
every other deployment coordinate is supplied, so the committed default
stays "able" and nothing deployment-specific enters source.

The name is validated as the DNS label it becomes: no leading or trailing
hyphen, 63 characters at most.
@codeyogi911
codeyogi911 merged commit 6143eb7 into main Aug 7, 2026
5 checks passed
@codeyogi911
codeyogi911 deleted the fix/deployable-onto-existing-worker branch August 7, 2026 09:37
codeyogi911 added a commit that referenced this pull request Aug 7, 2026
#12)

The committed Wrangler configuration gained comments in #11, but the
production deploy path still read it with `JSON.parse`, so every
`deploy:production` run failed before reaching Wrangler.

- Parse the source with `jsonc-parser` (new dev dependency of
`@able/desk`, per the package-first policy) and reject invalid or
non-object JSONC.
- Cover the committed `wrangler.jsonc` itself in the projection tests so
the deploy path can never drift from the source format again, alongside
an invalid-source rejection test.

`npm run check` passes, and a local dry run of `build:production-config`
produces a correct projection for a predecessor-named Worker.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Morrow Contributors <codeyogi911@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant