From f3c2b792c1e9a6659a66504ccb80091f3ac5a148 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 25 Nov 2026 20:22:38 -0800 Subject: [PATCH 1/4] quest(m2): plan auto-deploy from main and release Co-Authored-By: Claude Opus 5.5 --- quest/m2/auto-deploy.md | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 quest/m2/auto-deploy.md diff --git a/quest/m2/auto-deploy.md b/quest/m2/auto-deploy.md new file mode 100644 index 0000000..cc6b2ae --- /dev/null +++ b/quest/m2/auto-deploy.md @@ -0,0 +1,56 @@ +# [S] Deploy staging from main and live from release + +## Goal + +Every push to `main` deploys moq.dev, moq.pub and moq.watch to staging from +GitHub Actions, and every push to a protected `release` branch deploys them +live, so production changes only when `release` moves. Today every deploy is +a manual `just deploy [live]` from a laptop's wrangler login, so merged work +sits undeployed until someone remembers. + +Non-goals: what each mode builds (the unreleased-route gate from +[#300](https://github.com/moq-dev/moq.dev/pull/300) stays, so `/huh` ships to +staging and not live), and moq.pro's deploys. + +## Plan + +Decided 2026-11-25 (maintainer, `/quest-run` then `/quest-plan`): + +- ✅ Staging on every push to `main`, live on every push to `release` + (rejected: live behind a protected-environment approval on `main`'s + workflow; staging only; dropping it). This keeps the intent of + [#102](https://github.com/moq-dev/moq.dev/pull/102), which removed the old + live-on-`main` workflow: production still moves only on a person's merge. +- ✅ `main` reaches `release` through a PR that the maintainer merges, and + backports go in as PRs onto `release`, as in moq.pro (rejected: a + workflow_dispatch that fast-forwards `release`; direct pushes). +- ✅ Reword the AGENTS.md deploy rule to: "Merging to main deploys staging. + Ask before merging into or pushing to `release`, or running + `just deploy`." (rejected: keeping staging behind explicit permission, + which defeats deploy-on-push). + +Recommendations: + +- One workflow on `push` to `main` and `release` that runs the `just deploy` + steps with `staging` or `live`, so the laptop path and CI share one recipe. + Use one GitHub environment per target, each limited to its branch, holding + the Cloudflare token. A GitHub-hosted runner fits a short deploy job. + Serialize runs per environment and don't cancel one mid-upload. +- Credentials: `bws` holds `cloudflare-admin-token`, which can reach the + `moq.dev` account (`dd618f5d…`, the `account_id` in `wrangler.jsonc`). + Try minting an account-owned token with it, scoped to deploying these + Workers and their custom domains, and store that token as the environments' + secret. If the admin token can't mint one, add a `Maintainer:` item naming + the exact scopes. +- Create `release` at the commit live runs now; the 2026-11-25 deploy was + `e67ab91`. Protect it the way moq.pro's `release` is protected, through + the org rulesets in dotfiles' `bin/repo-settings`, not per repo. +- `pr.yml` checks only PRs into `main`; make it check PRs into `release` too. +- Update README's Deploy section to match. +- The README says to deploy moq.pro's `try` project before these clients. + Staging may now briefly run a client ahead of moq.pro staging; that's + acceptable. The release PR is where the maintainer checks the moq.pro side + before going live. +- Verify each half on its real surface: a merge to `main` updates + new.moq.dev, and a release PR's merge updates moq.dev. Both need the + maintainer's merge. From 497471b0aa2b132bf16d10d040046f9fa3d0e761 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 25 Nov 2026 20:23:59 -0800 Subject: [PATCH 2/4] quest(m2): auto-deploy recommendations match the repo's merge and ruleset setup Co-Authored-By: Claude Opus 5.5 --- quest/m2/auto-deploy.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/quest/m2/auto-deploy.md b/quest/m2/auto-deploy.md index cc6b2ae..69cbe62 100644 --- a/quest/m2/auto-deploy.md +++ b/quest/m2/auto-deploy.md @@ -35,7 +35,11 @@ Recommendations: steps with `staging` or `live`, so the laptop path and CI share one recipe. Use one GitHub environment per target, each limited to its branch, holding the Cloudflare token. A GitHub-hosted runner fits a short deploy job. - Serialize runs per environment and don't cancel one mid-upload. + Serialize runs per environment and don't cancel one mid-upload (the + workflow [#102](https://github.com/moq-dev/moq.dev/pull/102) removed set `cancel-in-progress: true`). The job needs what + `pr.yml`'s `check` job sets up: submodules, Nix with + `accept-flake-config` (`bun install` builds `@moq/libav` from the `moq` + submodule's flake), and Bun, plus `just`. - Credentials: `bws` holds `cloudflare-admin-token`, which can reach the `moq.dev` account (`dd618f5d…`, the `account_id` in `wrangler.jsonc`). Try minting an account-owned token with it, scoped to deploying these @@ -43,8 +47,16 @@ Recommendations: secret. If the admin token can't mint one, add a `Maintainer:` item naming the exact scopes. - Create `release` at the commit live runs now; the 2026-11-25 deploy was - `e67ab91`. Protect it the way moq.pro's `release` is protected, through - the org rulesets in dotfiles' `bin/repo-settings`, not per repo. + `e67ab91`. moq.pro protects its `release` with a per-repo ruleset + (no deletion, no force push, required checks); dotfiles' + `bin/repo-settings` has no `release` branch standard yet. Add one there + that both repos share rather than copying moq.pro's by hand. +- This repo allows only squash merges. Squash-merging a `main` to `release` + PR leaves `release` off `main`'s history, so each later release PR + re-diffs from the old merge base and conflicts with backports. Allow merge + commits for PRs into `release` (moq.pro allows them; `main`'s ruleset + already requires linear history), and merge release PRs with a merge + commit. - `pr.yml` checks only PRs into `main`; make it check PRs into `release` too. - Update README's Deploy section to match. - The README says to deploy moq.pro's `try` project before these clients. From b951deb300c913ed02ef178493759826e60f05a6 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 25 Nov 2026 20:30:35 -0800 Subject: [PATCH 3/4] quest(m2): auto-deploy skips a run whose commit is no longer the branch tip CodeRabbit on #303: a concurrency group runs waiting jobs in the order they start waiting, so an older push could deploy last. Co-Authored-By: Claude Opus 5.5 --- quest/m2/auto-deploy.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quest/m2/auto-deploy.md b/quest/m2/auto-deploy.md index 69cbe62..d13be9a 100644 --- a/quest/m2/auto-deploy.md +++ b/quest/m2/auto-deploy.md @@ -36,7 +36,10 @@ Recommendations: Use one GitHub environment per target, each limited to its branch, holding the Cloudflare token. A GitHub-hosted runner fits a short deploy job. Serialize runs per environment and don't cancel one mid-upload (the - workflow [#102](https://github.com/moq-dev/moq.dev/pull/102) removed set `cancel-in-progress: true`). The job needs what + workflow [#102](https://github.com/moq-dev/moq.dev/pull/102) removed set + `cancel-in-progress: true`). A concurrency group doesn't keep pushes in + order, so right before uploading, a run skips the upload when its commit is + no longer its branch's tip; the newer push's run deploys instead. The job needs what `pr.yml`'s `check` job sets up: submodules, Nix with `accept-flake-config` (`bun install` builds `@moq/libav` from the `moq` submodule's flake), and Bun, plus `just`. From 856fbd96975d3e72a12602cf72fe834255e508aa Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 25 Nov 2026 20:31:11 -0800 Subject: [PATCH 4/4] quest(m2): auto-deploy queues every pending run so the tip's run isn't evicted Co-Authored-By: Claude Opus 5.5 --- quest/m2/auto-deploy.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quest/m2/auto-deploy.md b/quest/m2/auto-deploy.md index d13be9a..502789b 100644 --- a/quest/m2/auto-deploy.md +++ b/quest/m2/auto-deploy.md @@ -38,8 +38,10 @@ Recommendations: Serialize runs per environment and don't cancel one mid-upload (the workflow [#102](https://github.com/moq-dev/moq.dev/pull/102) removed set `cancel-in-progress: true`). A concurrency group doesn't keep pushes in - order, so right before uploading, a run skips the upload when its commit is - no longer its branch's tip; the newer push's run deploys instead. The job needs what + order, and its default single pending slot lets a late run for an older + push evict the tip's queued run. So queue every pending run, and right + before uploading, skip the upload when the run's commit is no longer its + branch's tip; the tip's run then always deploys last. The job needs what `pr.yml`'s `check` job sets up: submodules, Nix with `accept-flake-config` (`bun install` builds `@moq/libav` from the `moq` submodule's flake), and Bun, plus `just`.