Skip to content

feat(deploy): deploy the edge from a release's bundle, prove it on the shared hostname, and roll it back when it fails - #295

Merged
aRustyDev merged 2 commits into
mainfrom
feat/deploy-edge
Nov 18, 2026
Merged

aRustyDev merged 2 commits into
mainfrom
feat/deploy-edge

Conversation

@aRustyDev

Copy link
Copy Markdown
Owner

Stacked on #294 (the edge says which build of it answered; the bundle carries the edge).

The second part of deploying the edge Worker (#195 stage E3, ADR-0111). It holds the scripts and their tests. No workflow runs
them yet: that is the next pull request.

What changes

scripts/deploy-edge.sh deploys the edge from the release's bundle, every release, after production. A path rule would
fire on every release anyway, because each one bumps the workspace version and the lock. In order:

  1. The configuration: the edge's template is rendered.
  2. What is live: its version is read. A split or unreadable live edge stops the deploy, with nothing done.
  3. The deploy: wrangler deploy --tag <sha>.
    • The secrets: the edge's three go up with the version, in a --secrets-file.
    • The file: only its owner can read it, and it is removed before anything else runs. No secret is in an argv or in
      wrangler's environment.
  4. The first deploy stops here, green. The edge has no hostname until the cut-over moves thrust.sow.foo to it.
  5. The smoke through the edge:
    • the answering edge is this version (SMOKE_EXPECT_EDGE);
    • the request went to production (SMOKE_EXPECT_ROUTE=prod);
    • production is at the release;
    • production's smoke account reads its project.
  6. The controls:
    • the smoke's own: an edge nobody deployed must fail;
    • scripts/edge-controls.sh: a forged pin goes to production, and the opt-in gives no pin to a request Access did not
      admit (made-up service token and Access token headers must get 302, 401 or 403 and no __Host-thrust_edge cookie).
  7. On any failure after the deploy: wrangler rollback to the edge that was live, then a probe that it answers again.
    The run stays red.

smoke-deploy.sh gains SMOKE_EXPECT_EDGE.

smoke_stub.py gains:

  • an edge version header;
  • --route without --pin, which stands for production behind the edge;
  • three broken edges, one per control: --honour-any-pin, --opt-in-open and --no-edge-paths;
  • --unavailable-first-gets.

Docs: cicd.md's row, and G-45 in docs/src/testing/status.md.

Tests

test-deploy-edge.sh, 96 checks against edge_fakes.py. The fakes are a wrangler that keeps the edge's versions, plus a
truthful smoke and truthful controls; the render and active-version.py are the real ones.

  • A deploy over a live edge:
    • the calls come in order;
    • the version carries the tag;
    • the secrets file holds the three names with the values given, at mode 600;
    • the file is gone before the smoke runs, and after a failed deploy;
    • the smoke's arguments and the outputs are as expected.
  • Secrets: each reaches only its step, and no value is in any argv or in the output.
  • The first deploy is tested.
  • Rollbacks: every failure after the deploy rolls back and proves the previous edge again, by its tag, or by its id
    when it had none. A rollback that fails or cannot be confirmed says so, and AUTO_ROLLBACK=false rolls nothing back.
  • Stops before the deploy: a failed deploy, a split edge, a listing that keeps failing (and one that fails once, then
    answers) and a refused render.
  • Usage errors: each one deploys nothing and calls nothing. They include a pin key of 31 bytes (refused) and of 32
    (taken), and the edge named as production.

test-smoke-deploy.sh, 74 checks, with the new cases for SMOKE_EXPECT_EDGE and edge-controls.sh:

  • the controls pass against an edge that refuses Access's way;
  • each broken edge fails its control;
  • a 5xx is asked again, and two 5xx are the answer.

Hand mutants: each of 45 mutants of the three scripts fails its test.

  • Three survived the first round:
    • the removal of the secrets file after the deploy;
    • the trap that removes it on exit, which covered for the first;
    • the controls' retry.
  • The cases that kill them are now in the tests.

Also passing: every deps step and all 47 ci-scripts commands, each run under dash.

Not verified

Wrangler itself:

  • that --secrets-file satisfies secrets.required on a Worker that does not exist yet;
  • the edge's deployments list. It is read by the same reader as production's, which has been read live.

The edge on the hostname. That waits for the cut-over. The first live runs will be:

  • the first edge deploy, whose smoke is skipped;
  • then the next release, which runs the whole proof.

Refs #195

🤖 Generated with Claude Code

aRustyDev and others added 2 commits November 17, 2026 20:13
…in the attested deploy bundle

The first part of #195's stage E3 (deploying the edge, ADR-0111).

- Every answer of the edge, its own and a forwarded one, carries x-thrust-edge-version: its version's tag (the release's
  commit), else its id, by thrust's x-thrust-version rule. A WebSocket upgrade passes as it came, and an upstream cannot set
  the header. The template declares [version_metadata], and check-edge-config.sh requires exactly one.
- build-bundle builds the edge with worker-build and puts it in deploy-bundle.tar.gz under edge/build/. release.yml
  therefore builds and attests it with the release, and a release candidate's bundle proves it builds.
- The deploy dry run renders the edge's template with made-up values and runs wrangler deploy --dry-run on it, against that
  build.

Refs: #195
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e shared hostname, and roll it back when it fails

The second part of #195's stage E3 (ADR-0111). No workflow runs it yet.

scripts/deploy-edge.sh deploys the edge every release, after production. It renders the edge's template and reads the
live version; a split or unreadable one stops it. It then runs wrangler deploy --tag <sha>, with the edge's three secrets in
a --secrets-file that only its owner can read, removed before anything else runs. The first deploy stops green, because the
edge has no hostname until the cut-over. Every later deploy is proved:
- the smoke through the edge (SMOKE_EXPECT_EDGE: this edge answers, routed to production, production at the release, a
  real read);
- the smoke's control (an edge nobody deployed must fail);
- scripts/edge-controls.sh: a forged pin goes to production, and the opt-in gives no pin to a request Access did not
  admit.
Any failure rolls back to the edge that was live and proves it answers again, and the run stays red.

Tests: test-deploy-edge.sh (96, against edge_fakes.py) and test-smoke-deploy.sh (74, against smoke_stub.py with a broken
edge per control). Each of 45 hand mutants of the three scripts fails its test.

Refs: #195
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base automatically changed from feat/edge-in-bundle to main November 18, 2026 04:15
@aRustyDev
aRustyDev merged commit 0058422 into main Nov 18, 2026
93 of 96 checks passed
@aRustyDev
aRustyDev deleted the feat/deploy-edge branch November 18, 2026 04:15
aRustyDev added a commit that referenced this pull request Nov 18, 2026
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