Skip to content

feat(release): one gated Worker release, and the Pages and Strapi path removed (WP12) - #75

Open
wojciechszyjka wants to merge 10 commits into
mainfrom
claude/wp12-worker-release-89e040
Open

wojciechszyjka wants to merge 10 commits into
mainfrom
claude/wp12-worker-release-89e040

Conversation

@wojciechszyjka

@wojciechszyjka wojciechszyjka commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

WP12 of docs/specs/2026-11-29-unified-astro-emdash.md (PR 56, Implementation Plan 4.1 and 4.3): the release and the cleanup.

Status: complete. Main (with PR 71, the WP11 harness, and PR 74) is merged in. Merge this after PR 71, which it needs (RUNBOOK, the freeze day, step 2). Tracking plan: kept outside the repository (AGENTS.md rule 1), in the session notes (runs/wp12/PLAN.md).

The release

.github/workflows/release.yml replaces pages.yml. Same triggers: after watch, sync and collect on main, push to main, daily at 05:47 UTC, by hand. A code change and a data refresh each release a new version. No editorial trigger: a publication commits to D1 with the Worker in place.

Job Environment Steps
build none settings from repository variables only, data branch (fail closed), yarn build:worker once, the files released clients read, wrangler deploy --dry-run, limits (10 MiB compressed, 20,000 assets of 25 MiB), the WP11 harness --no-browser judged by yarn om release gate, upload of the kept build
release www, main only secrets check, the downloaded build (no second build), production config, D1 Time Travel bookmark, wrangler d1 migrations apply DB --remote, wrangler deploy --secrets-file (purge token), summary with the version id
  • The gate passes only when every check that ran passed and the only checks not run are the four browser checks (real / calculator, real / e2e, stale / e2e, templates / e2e). The browser run is an owner step on the Mac (RUNBOOK, The release).
  • No settings: the run builds, checks, runs the harness and ends green with "Not released" and the list of what is missing. A partial or malformed set fails red. No value is ever printed.
  • A release attaches no route and no domain, and refuses a built config with workers_dev, preview_urls or routes. The hosts move by the operator's switch.

New: lib/release/settings.ts, lib/release/gate.ts, lib/commands/release.ts (yarn om release settings|write|secrets|gate|limits), tests in test/release/.

Settings that do not exist yet (named here, created by the infrastructure owner)

Name Kind What
CLOUDFLARE_ACCOUNT_ID repository variable (exists) the account, shared with mcp-deploy
SITE_D1_DATABASE_ID, SITE_D1_DATABASE_NAME repository variables production D1 (binding DB)
SITE_R2_BUCKET repository variable private R2 bucket (binding MEDIA)
SITE_KV_ID repository variable sessions (binding SESSION)
CF_ACCESS_TEAM_DOMAIN, CF_ACCESS_AUDIENCE repository variables Access application of /_emdash (team domain, AUD)
OM_PURGE_ZONE_ID repository variable zone of the purge by tag
CLOUDFLARE_API_TOKEN secret of environment www Workers Scripts, D1, Workers KV edit
OM_PURGE_TOKEN secret of environment www Cache Purge, uploaded as a Worker secret

Environment www: deployment branches main only, the owner as required reviewer, no variables of its own (the release job stops when its variables differ from the build job's). The variables are repository variables because the build job decides without an environment. They are set only at step 6 of the freeze day, after production D1 holds the import, so the first release finds the site's migrations recorded.

Removed from the production path

  • pages.yml (all eight jobs: deploy, www-snapshot push, www-issue, both previews).
  • cms.yml, the www-content job of validate.yml, yarn om www-content, yarn om www-pr-check, lib/www-cms/{source,snapshot,issue,pr-check}.ts and their tests.

Kept, and why:

  • The Pages deployment itself: the rollback target of the old hosts for 30 days (RUNBOOK, Rollback). No code is needed for it: the recorded deployment is re-pointed, not rebuilt.
  • astro.config.ts, www/astro.config.ts, lib/emit/pages-merge.ts, lib/emit/pages-layout.ts, lib/commands/pages-site.ts, functions/, scripts/pages-smoke.sh: off the production path, but the WP11 harness builds the static Run and www sites as its parity reference, emdash-import reads the image derivatives of dist-www, the Worker build reuses functions of pages-merge.ts (redirect table, robots, sitemaps), and the route matrix baseline (WP00) is built from the Pages layout. package.json (build, build:run, build:www, astro check --root www) is WP01's.
  • cms/, lib/www-cms/{files,model,pull,push,rest,strapi,tree}.ts, yarn om www-pull and www-push: files.ts and model.ts are read by the EmDash import, and www-pull --check inspects Strapi for editor work the files lack on the freeze day (spec, Reconcile and import). Strapi is retired after the window (RUNBOOK, After the freeze day).

RUNBOOK

"Main site content in Strapi", "Main site switch (C1 to C10)" and "push and prune" are replaced by Main site on the Worker (EmDash): the release, Setup (resources, variables, secrets), the freeze day in 11 steps (0 to 10), each with owner, command and pass check (freeze record, retire the Pages writer by merging this PR, final webflow-export and reconcile, emdash-import run twice + verify + backup, load of production D1 and R2, first release, Access and owner bootstrap, switch www, switch the old hosts, editor checks and lifting the freeze), After the freeze day, Rollback (Access first, old hosts to the recorded Pages deployment, www to Webflow, purge, keep D1 and R2) and Recovery (bad edit, Worker version rollback, D1 Time Travel and R2 backup into new bindings, backups). The Pages-era sections carry a note that they describe the rollback target.

The Delta is archived into docs/specs/capabilities/unified-site-publishing.md, with "Frozen by" re-pointed to the Worker tests and the harness phases (test/www-cms/source.test.ts is gone with the Strapi source).

Evidence (owner's Mac, sandboxed session, head 188393b with main 132d47f)

  • The build job of release.yml run step by step as GitHub runs it (bash -eo pipefail, no variables, no secrets) on data 45cef12: Check release settings exits 0, release=false, the summary "Not released. No release settings are set" with the 8 variables named; Build the Worker 0; Check the Worker 0 (release limits: 7377.62 KiB compressed, 3053 asset files); Run the harness 0: the harness exits 3 and the gate reads "Harness: 16 checks ran and passed; 4 browser checks not run here are the owner's (RUNBOOK)." The release job does not start (release != 'true'); its Check secrets exits 1 naming what is missing.
  • Harness counts (node scripts/worker-harness.ts --no-browser --data .data): worker harness: 16 of 20 checks passed, 0 failed, 4 not run. matrix: route matrix 280 of 284 (4 named, WP04), smoke 37 of 37, access 1940 of 1940, media 10 of 10; noindex: route matrix 280 of 284 (4 named); real: concurrent walk 2722 of 2722, run parity 6024 of 6024, editorial parity 164 of 168 (4 named, WP05), compare-live 168 of 168, seo 424 of 424, og cards 34 of 34, www build tests 184 of 184, og publish 13 of 13; publish: publish guard 35 of 35, outage 3 of 3, guard config 6 of 6. Not run: real / calculator, real / e2e, stale / e2e, templates / e2e (the owner's browser run, RUNBOOK, The release).
  • yarn check: green (0 errors, Prettier clean, check-text: 827 files), with dist-worker and dist-www removed (WP04 note).
  • yarn test: 3166 passed, 10 failed in 4 files this PR does not touch (test/rentgen/golden, test/proxy/check-sh, test/receipts/presets-r2, test/receipts/harness): the sandbox refuses mktemp, the set PR 63 recorded on main.
  • wrangler deploy --dry-run of a config written by yarn om release write with made-up ids lists DB, MEDIA, SESSION, IMAGES, ASSETS, the Access vars and OM_PURGE_ZONE_ID, and no route.
  • test/validate/workflow-run.test.ts runs the shell steps of both jobs with a fake yarn and a fake harness: no settings (the account id alone), all settings, another ref, a partial set, a failed check, no report, missing files, an unreadable data branch, release variables that differ from the build's, the order time travel, migrations, deploy, and the secrets file removed after the step.
  • Review (om-auto-review-pr): 1 blocker, 3 majors, 3 minors, 4 nits; the dispositions are in the PR comment. Fixed: the shared account id counted as a partial setup, the gate passing a check that counted nothing, the artifact retention, the release job reading other variables than the build, the two recovery paths. Waived: the harness rebuilds dist-worker/ with its own environment, so the copy released gets Check the Worker (files, server card, dry run, limits); a --dist option of the harness is a WP11 follow-up.

Notes for owners of other paths

  • WP11 (scripts/worker-harness.ts): an option to run the checks against a given build (--dist) would let the gate judge the exact copy released.
  • WP01 (package.json): build, build:run and build:www stay for the harness; nothing in CI deploys them. check-text still lists cms/src and cms/config (harmless) and has no dist-worker in SKIP_DIRS (WP04 note).
  • WP06 (lib/emdash): emdash-import writes only to local D1 and R2. The RUNBOOK loads production with wrangler d1 export --local and execute --remote, then the objects of the backup folder with wrangler r2 object put. A command that does both and verifies against the remote would make step 5 shorter.
  • mcp/wrangler.toml still mentions pages.yml in a comment.

@wojciechszyjka

Copy link
Copy Markdown
Collaborator Author

🤖 om-auto-review-pr review of PR 75 at bc202ae (own PR, autofix). Verdict at that head: changes requested (1 blocker, 3 majors). Fixed at f88778e unless noted.

# Severity Finding Disposition
1 blocker CLOUDFLARE_ACCOUNT_ID exists already (mcp-deploy), so 1 of 8 set made every run partial and red fixed (9c21ebd): a shared setting alone counts as none; tests with the account id alone
2 major the harness rebuilds dist-worker/ with its own environment, so the gate judges a sibling build, not the copy released waived, see below
3 major until PR 71 merges, scripts/worker-harness.ts is absent and every run fails the gate documented: RUNBOOK step 2 names PR 71 as a precondition of the merge; this PR merges after it
4 major a check that counted nothing (total 0) or lost counts without a named failure passed the gate fixed (9c21ebd): a check that ran needs total > 0 and passed + named = total; tests
5 minor the Worker artifact kept 1 day, the www approval may come later fixed: 7 days
6 minor Recovery said "never restore into the live database" next to an in-place Time Travel restore fixed (f88778e): two paths, Time Travel in place, a backup into new resources
7 minor wrangler d1 export --local reads only .wrangler/state, the restore wrote elsewhere fixed: restore into .wrangler/state of a checkout used for nothing else
8 nit a variable of environment www would override the repository one in the release job only fixed: the build job outputs a digest of the variables, the release job stops on a difference; RUNBOOK: no variables on www
9 nit release missing from COMMANDS fixed
10 nit pages.yml still named in cms/src/hook/dispatch.ts, its tests and comments of functions/, docs/proxy/README.md, mcp/wrangler.toml not changed: other owners' paths and the Pages rollback code; RUNBOOK step 1 turns the Strapi hook off
11 nit wrangler inside while read loops can swallow stdin fixed: </dev/null

Waiver of 2. The release build and the harness builds come from the same commit, data and BUILD_ENV; they differ only in MCP_URL, WEBMCP_OT_TOKENS, GITHUB_SHA and CF_ACCESS_TEAM_DOMAIN, which the harness unsets on purpose (WP11). The copy released is checked by Check the Worker (the files released clients read, the MCP server card with MCP_URL, wrangler deploy --dry-run, limits). A harness option to serve a given build (--dist) belongs to WP11's scripts/worker-harness.ts; noted for its owner.

Validation at f88778e: yarn vitest run test/release test/validate test/schema 484 passed; yarn tsc --noEmit clean; Prettier and check-text clean on the changed files. Full yarn check and yarn test ran at bc202ae (see the PR description) and are rerun after main with PR 71 is merged in. No CI checks are reported for this branch yet.

@wojciechszyjka
wojciechszyjka marked this pull request as ready for review November 30, 2026 03:13

This branch has not been deployed

No deployments
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