Skip to content

feat(pm-console): Actions stands the Worker up from nothing, and deploys the latest version onto it - #12765

Merged
dezren39 merged 2 commits into
mainfrom
claude/pm-edge-standup
Nov 23, 2026
Merged

dezren39 merged 2 commits into
mainfrom
claude/pm-edge-standup

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What was asked

"Stand up an empty worker init using actions, deploy latest version using actions."

What this does

The deploy was one wrangler deploy. It is now pm-stack/console/edge/release.mjs, run by the same workflow, and it starts from whatever is there, including nothing:

  1. No Worker of that name: an empty one is stood up (edge/init/: the Durable Object's class, and an answer that says it is empty). A version cannot be uploaded to a Worker that does not exist, and the storage behind the class is only made by a deploy.
  2. This commit is uploaded as a version. It serves nothing yet.
  3. That version is put at 100%.
  4. The Worker is asked which version it is. If it does not answer as this commit, the version that was serving is put back and the run fails. Until now a bad deploy stayed in service until someone noticed.

A new Durable Object migration cannot travel in a version, so then steps 2 and 3 are one full deploy.

The stand-up from nothing is run, not assumed

Whenever a push changes the release itself (release.mjs, release-plan.mjs, init/, wrangler.jsonc, the lockfile, the workflow), and on a manual run with scratch, the same steps first run on pm-console-edge-scratch: removed before, so the start is nothing; stood up empty and heard to answer as empty; given this commit as a version; heard to answer as this commit; removed again. Merging this pull request is such a push, so the first run after the merge shows it.

The real Worker is not touched by the scratch run. Two guards:

  • The scratch Worker is the only one the script will delete, and its name is made in the script, not taken from an input.
  • Absence of the real Worker is answered by deploying an empty Worker under its name, so it is only believed when two different questions to Cloudflare agree, and only on the two error codes that mean "no such Worker". A refusal, an error, or answers that disagree stop the run with nothing done.

The empty Worker answers 503 with ok: false, so the laptop's expose.py, which routes the hostname only to a Worker whose health says ok, can never route to it.

Checked

  • bun test: 177 pass. 21 new: the decisions (release-plan.mjs), and the script itself run against a stand-in for Cloudflare's API and a stand-in for wrangler that records every command: an existing Worker, no Worker, changed classes, a version that never answers (put back), a failed upload, a refusal, answers that disagree, the scratch run, the scratch run failing three ways.
  • Seventeen planted faults, each caught: the real Worker removable, no stand-up, a migration sent as a version, any 404 or any refusal taken as absence, absence believed on one answer, nothing put back, scratch left behind or not cleared first, the empty Worker not waited for, another version counted as this one, a failed check passing (two ways), the version id unchecked, a split deployment put back as one, the scratch run on the real name, delete without force.
  • wrangler deploy --dry-run for both configurations and wrangler versions upload --dry-run for the real one. A test holds the two configurations together on everything that is not a version's own.
  • The repository's workflow lint (check-workflows.sh with actionlint and shellcheck) and CI policy check pass.

Not checked

The script against the real Cloudflare API. That cannot be done from here; it is what the scratch run on the first push is for. If Cloudflare answers the existence question with a code other than the two expected, that run stops with the code in its log and nothing done, and the real Worker stays on its present version.


Generated by Claude Code


Show it working
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…f-written copy is no copy

Found by reading the last three commits of #12723 again after they
merged unreviewed.

The host's reports are how the edge knows the laptop is there. A
report that carries the build is hundreds of kilobytes; on a connection
too slow to send it in the twenty seconds a report is given it failed,
and the next was built the same way, for as long as the edge lacked the
build. Meanwhile nothing arrived, and the edge took the laptop for gone.

- A report that carried the build and did not get through (cut off or
  turned away) is followed at once by one without it; the build is
  tried again ten minutes later.
- A build file that cannot be read is left out the same way instead of
  stopping the report.
- Whether the build and the changed sections fit one report is measured
  on the report as sent, in bytes. It was estimated in characters, and
  text outside ASCII is up to three bytes each.
- When the build goes alone, the sections it displaced follow at once.
- The edge removes the record of its copy before writing a new build
  over the copy's pieces, so a write that stops half-way cannot leave
  pieces of two builds to be handed out under the old record, and it
  removes a larger build's leftover pieces whether or not that record
  survived.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
…oys the latest version onto it

The deploy was one `wrangler deploy`. It is now edge/release.mjs, run
by the same workflow, and it starts from whatever is there:

1. no Worker of that name: an empty one is stood up (edge/init: the
   Durable Object's class and an answer that says it is empty);
2. this commit is uploaded as a version, which serves nothing yet;
3. that version is put at 100%;
4. the Worker is asked which version it is, and if it does not answer
   as this commit the version that was serving is put back and the run
   fails. A bad deploy used to stay in service until someone noticed.

A new Durable Object migration cannot travel in a version, so then the
upload and the promotion are one full deploy.

That an account with no Worker needs only this workflow is not taken on
trust. Whenever a push changes the release itself, and on a manual run
with `scratch`, the same steps first run on pm-console-edge-scratch,
which is removed before (so the start is nothing) and after. It is the
only Worker the script will delete, and absence of the real one is only
believed on two answers that agree.

The decisions are in release-plan.mjs and tested; the script is run in
the tests against a stand-in for Cloudflare's API and one for wrangler.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YLT5K1QVuzZjfWGFhXSSNF
@dezren39
dezren39 requested a review from a team as a code owner November 23, 2026 01:46
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ceaad28-b621-478f-8dac-c8a029d62dec
Commits

Reviewing files that changed from the base of the PR and between 8f07c02 and 60d5b47.

Files selected for processing: 12

  • .github/workflows/pm-console-edge-deploy.yml
  • doc/2026-11-22T11-10-00Z_architecture_pm_console_edge/2026-11-22T11-10-00Z_architecture_pm_console_edge.md
  • pm-stack/console/edge/README.md
  • pm-stack/console/edge/init/worker.ts
  • pm-stack/console/edge/init/wrangler.jsonc
  • pm-stack/console/edge/release-plan.mjs
  • pm-stack/console/edge/release.mjs
  • pm-stack/console/edge/src/edge.ts
  • pm-stack/console/edge/wrangler.jsonc
  • pm-stack/console/src/sync.ts
  • pm-stack/console/test/edge.test.ts
  • pm-stack/console/test/release.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit 2bec21c into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the claude/pm-edge-standup branch November 23, 2026 02:05
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.

2 participants