From b686df994696b1c4ed407e12a4572811e7eeca1b Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Wed, 28 Oct 2026 22:45:39 +1100 Subject: [PATCH 01/25] docs(ci): record the decisions that bring CI spending under budget CI for this repository cost about $4,000 a month on Blacksmith at the pace of October 2026. The budget for this repository and the others that share it is $1,000 a month. ADR 0002 moves light jobs to GitHub-hosted runners and heavy jobs to RunsOn machines in our own AWS account. ADR 0003 runs the expensive checks once, in merge queues on main and next, not on every push. The glossary at .github/CONTEXT.md defines the terms both records use. CONTEXT-MAP.md links to it. --- .github/CONTEXT.md | 87 ++++++++++ CONTEXT-MAP.md | 2 + ...ub-hosted-runners-heavy-jobs-on-runs-on.md | 55 ++++++ ...ks-run-in-merge-queues-on-main-and-next.md | 158 ++++++++++++++++++ 4 files changed, 302 insertions(+) create mode 100644 .github/CONTEXT.md create mode 100644 docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md create mode 100644 docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md new file mode 100644 index 0000000000..9d9b099a09 --- /dev/null +++ b/.github/CONTEXT.md @@ -0,0 +1,87 @@ +# CI + +This context covers the checks that verify a change, and the machines that run +them. It covers the GitHub Actions workflows of `cipherstash/stack`. It also +covers the CI spend of the other repositories that share its budget. + +## Language + +**CI budget**: +The most that the repositories sharing it may spend on CI in one calendar +month. Vendor invoices measure it, including fixed costs such as licences and +cloud infrastructure. When an invoice also covers other repositories, only the +part for these repositories counts. List-price estimates track it between +invoices, but do not replace it. +_Avoid_: build minutes, runner minutes + +**PR push**: +A new head commit on a pull request's branch. Each one starts the push checks +again. +_Avoid_: PR run, CI run + +**Push check**: +A check that runs on every PR push, so the author learns of a failure while +still working on the change. +_Avoid_: fast check, PR check + +**Gate check**: +A check that runs when a pull request is in a merge queue, instead of on every +PR push. `main` and `next` each have a merge queue. An author can ask for a +gate check to run earlier on the pull request. A failed gate check blocks the +merge. +_Avoid_: heavy check, full CI, merge check + +**Early run**: +A run of the gate checks on a pull request before it joins a merge queue. An +author asks for one by adding the `ci:full` label. Each time the label is +added gives one early run. +_Avoid_: full run, ci:full run + +**Queue commit**: +The commit GitHub builds for a pull request in a merge queue. It contains +the entry ahead of it, plus the pull request. Checks in the queue test this commit. +_Avoid_: merge group commit, temporary branch + +**Trigger paths**: +The paths whose change makes a check run, on PR pushes and in the merge queue. +Every check has them, or a written reason for running on every change. +_Avoid_: path filter, relevance filter, affected checks + +**Selector job**: +The first job of a workflow. It selects the checks that run, by comparing the +files a change touches with each check's trigger paths. When it cannot decide, +it fails. The change then cannot merge until someone runs it again. +_Avoid_: path-filter job, decider, router + +**Summary job**: +The last job of a workflow. It passes when every check that the selector job +selected has passed. It is the only job of the workflow that branch rules +require. +_Avoid_: required job, status job + +**Failsafe**: +The test that fails when the selector job does not decide whether a job runs. +A job with a written exemption passes. The failsafe reads workflow files. It +does not act while a workflow runs. +_Avoid_: lint, selector guard, path-filter lint + +**Light job**: +A job that runs acceptably on a GitHub-hosted standard runner. Whether a job is +light says where it runs, not when: a light job can be a gate check. +_Avoid_: small job, cheap job + +**Heavy job**: +A job that needs more machine than a GitHub-hosted standard runner gives it, +and runs on a self-provisioned cloud runner instead. Whether a job is heavy +says where it runs, not when: a heavy job can be a push check. +_Avoid_: big job, 16-core job + +## Relationships + +- Three separate choices apply to each check. Its trigger paths decide whether + it runs at all. Being a push check or a gate check decides when it runs. + Being a light job or a heavy job decides where it runs. +- The fuzz regression replay, for example, is a light job and a gate check. +- Mutation testing is expensive but important. So it runs only once the + design and implementation of a change are settled. Its failures must be + fixed before the change merges. That makes it a heavy job and a gate check. diff --git a/CONTEXT-MAP.md b/CONTEXT-MAP.md index 7c2ee257e5..7fed0c1e4f 100644 --- a/CONTEXT-MAP.md +++ b/CONTEXT-MAP.md @@ -14,6 +14,8 @@ Stack CLI and customer workers. - [Migration Harness](./e2e/migration-harness/CONTEXT.md) — tests the Protect.js upgrade guide by having agents follow it and judging the result. +- [CI](./.github/CONTEXT.md) — runs the checks that verify a change, and pays + for the machines that run them, within a shared monthly budget. ## Relationships diff --git a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md new file mode 100644 index 0000000000..65cc84528f --- /dev/null +++ b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md @@ -0,0 +1,55 @@ +--- +status: accepted +--- + +# Move CI from Blacksmith to GitHub-hosted runners and RunsOn + +We decided in October 2026 to stop running CI on Blacksmith. Light jobs run on +GitHub-hosted standard runners. Those runners cost nothing for this public +repository. + +Heavy jobs run on RunsOn. RunsOn starts a machine in our own AWS account for +each job. Heavy jobs use c8a machines with 8 vCPUs. Mutants uses a +c8a machine with 16 vCPUs. The other repositories that share the CI budget +move their Blacksmith jobs to RunsOn too. + +We made the change because of cost. CI for this repository cost about $3,865 a +month on Blacksmith at October 2026's pace. That was 20 times September's +cost. The CI budget for this repository and the others that share it is +$1,000 a month. + +```mermaid +flowchart LR + job[A CI job] --> size{Does a GitHub-hosted standard runner give it enough machine?} + size -- "Yes: light job" --> gh[GitHub-hosted runner. Free for this public repository. At most 60 jobs at a time for the organisation.] + size -- "No: heavy job" --> ro[RunsOn machine in our AWS account. c8a with 8 vCPUs. Mutants uses 16 vCPUs.] +``` + +## Considered options + +- **Stay on Blacksmith and run fewer jobs.** We modelled October's jobs with + gate checks in place. This repository alone still came to about $2,000 a + month at Blacksmith's prices. +- **Run every job on RunsOn.** Light jobs would then cost money. GitHub-hosted + runners run them for nothing. +- **Run every job on GitHub-hosted runners.** In the runner trial in pull + request #1297, jobs took 2.46 times as long overall. The integration suites + took up to 4.8 times as long. + +## Consequences + +- GitHub runs at most 60 jobs at a time for the organisation on the Team plan. + Light jobs wait for a runner when more than 60 jobs are queued. +- We simulated October's light jobs against that limit, with gate checks in + place. One job in a hundred waited between 7 and 11 minutes. +- A RunsOn job starts 40 to 50 seconds later than a Blacksmith job did. +- RunsOn uses discounted spot machines. When AWS has no spare c8a machines, a + job runs at the full price. The full price is more than twice the spot + price. The `family=c8a+m8a` label lets RunsOn try a second machine type + first. +- Every job sets `timeout-minutes`. In the trial, one job without a limit ran + for over 2 hours. +- We maintain the RunsOn resources in AWS. They cost $40 to $60 a month. +- RunsOn's pricing page limits its free licence to non-commercial use. The + trial licence ends in November 2026. Buying a licence is a separate + decision. diff --git a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md new file mode 100644 index 0000000000..deab67402f --- /dev/null +++ b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md @@ -0,0 +1,158 @@ +--- +status: accepted +--- + +# Run the expensive CI checks in merge queues on `main` and `next` + +We decided in October 2026 to split this repository's CI checks into push +checks and gate checks. Push checks run on every push to a pull request. Gate +checks run once, when the pull request is in a merge queue. `main` and `next` +each get a merge queue. + +We made the change because of cost. From 1 to 20 October 2026, 89% of this +repository's CI spending came from pull request runs. Each push ran the +expensive checks again. ADR 0002 moves jobs to cheaper machines. This decision +runs the expensive jobs less often. + +`.github/CONTEXT.md` defines the terms used here. + +```mermaid +flowchart TD + push["An author pushes to a pull request"] --> sel1{"Selector job: does the pull request have the ci:full label?"} + sel1 -- "No" --> pc["The push checks whose trigger paths changed run"] + sel1 -- "Yes" --> early["Push checks and gate checks run once. A job removes the label."] + pc --> ready["The pull request is approved. Its summary jobs pass."] + early --> ready + ready --> queue["The pull request joins the merge queue of main or next"] + queue --> sel2["Selector job compares the queue commit with the entry ahead of it"] + sel2 --> all["Push checks and gate checks run. Mutants starts at once."] + all --> sum{"Does every summary job pass?"} + sum -- "Yes" --> merge["GitHub merges the tested commit"] + sum -- "No" --> out["The pull request leaves the queue"] +``` + +## What runs where + +These are the gate checks: + +- the Test EQL suites that need a database: the PostgreSQL shards, the e2e + property suite, and the test archive build +- Mutants +- CRAP +- the fuzz regression replay +- Go on Windows and macOS, and the Go live tests +- the Drizzle, prisma-next, Supabase, and protect-ffi integration suites +- the two Prisma E2E suites +- udeps and Miri + +Every other check is a push check. + +- The merge queue runs the push checks and the gate checks against the queue + commit. A failure removes the pull request from the queue. +- Pushes to `main` no longer run the tests. The queue has already tested the + commit that GitHub merges. +- `next` gets the same branch rules as `main`, including the merge queue. + Until now, `next` had no protection. Pushes to it ran no workflows. +- Each queue builds at most 3 entries at once. The weekly cost report will + show whether to change this. +- The queues merge with merge commits, as `main` does today. The comparison + with the entry ahead needs merge commits or squash merges. + +## How a workflow decides what runs + +- A selector job starts every workflow, on a GitHub-hosted runner. It selects + the checks whose trigger paths the change touches. +- In a merge queue, the selector job compares the queue commit with its + parent. The parent is the entry ahead, so the difference is this pull + request alone. The entries ahead run their own checks. If one fails, GitHub + rebuilds the entries behind it. +- When the selector job cannot decide, it fails. The change cannot merge until + someone runs it again. So a fault in the selector job is seen at once. +- A summary job ends every workflow. It is the only job of the workflow that + branch rules require. +- The failsafe is a test in `scripts/__tests__/`, run by + `pnpm run test:scripts`. It fails when the selector job does not decide + whether a job runs. A job is exempt only with a written reason. An exemption + that matches no job also fails. + +## Early runs + +An author can add the `ci:full` label to run the gate checks early on the pull +request. A job removes the label when the early run starts. So each early run +is a deliberate request. The queue still runs the gate checks again. + +## Mutants + +- Mutants is a required gate check. It tests only the lines that the pull + request changes. In a merge queue, it finds them the same way as the + selector job. +- It runs in every queue entry except the merge of `next` into `main`. Each + change on `next` has already passed Mutants in the `next` queue. +- It runs as 4 parallel shards on c8a machines with 16 vCPUs. +- It starts at the same time as the push checks, in the queue and on early + runs. A watcher job cancels it when a push check fails. +- On an early run, a cancelled Mutants run counts as a failure. The pull + request cannot join the queue until Mutants runs again. +- The other heavy gate checks also start at once. + +## Considered options + +- **Run gate checks when a draft pull request becomes ready for review.** + Agents push to pull requests that are already ready. So most pushes would + still run everything. +- **Run gate checks when a pull request is approved.** On `main`, an approval + stays valid after later pushes. So code pushed after an approval would merge + without gate checks. +- **Run gate checks only when an author adds a label, with no merge queue.** + That depends on people remembering to add it. +- **Filter workflows by path in `on:`, not in a selector job.** GitHub cannot + filter `merge_group` events by path. A workflow that a path filter skips + leaves its required checks pending. GitHub's documentation on required + status checks says that blocks the merge. +- **Compare each queue commit with the base branch.** With 3 entries + building, the third entry's difference includes the two ahead of it. + Mutants would test their lines again. A failure could point to another + author's lines. +- **Run every check when the selector job cannot decide.** No needed check + would be skipped. But nobody would notice a fault in the selector job. Each + fault would also cost a full run. +- **Run Mutants on the merge of `next` into `main` as well.** That run tests + every line `next` added, a second time. In October 2026, it reached its + 120-minute timeout at least twice on pull request #1229. +- **Run Mutants only in the `main` queue.** All of `next` would be tested at + once, when it merges into `main`. A failure would then point to anyone who + changed `next`. +- **Start Mutants after every push check passes.** That spends nothing on + failing commits. But it adds up to 14 minutes to each queue entry and early + run. In the queue, push checks rarely fail. A pull request joins only after + its required checks pass. +- **Keep the `ci:full` label until the author removes it.** A forgotten label + would run every gate check on every later push. + +## Consequences + +- Authors learn of a gate check failure in the queue, unless they ask for an + early run. +- A merge waits for the slowest gate check. Each queue's status check timeout + must be longer than that check takes. +- Every workflow with a required summary job must also run on `merge_group`. + GitHub's merge queue documentation says the queue starts no workflow + without it. The queue would then wait for a check that never reports. +- The queue setting "Only merge non-failing pull requests" stays on. Without + it, a pull request that failed could merge with the one behind it. +- The smallest group the queue merges is 1 pull request. So a lone pull + request never waits for others. +- Workflows must start when any label is added, because GitHub cannot filter + that event by label name. That run reports under the same check names as + the push run. A test branch must show that it cannot replace an earlier + failure. +- Commits made by the merge queue must pass the rule that requires signed + commits. A test branch must show this before the queues start. +- A test branch must also confirm that a queue commit's parent is the entry + ahead of it. GitHub's webhook schema calls `base_sha` the merge group's + parent commit. It does not say which commit that is. +- After a flaky push check on an early run, the author must re-run Mutants as + well. +- While it waits, the watcher holds one of the organisation's 60 + GitHub-hosted job slots. It waits up to about 14 minutes. +- This decision covers this repository only. `proxy` may follow later. From 3cd11cb6ed2533a334774e32f65beb3645e6e11d Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Thu, 29 Oct 2026 00:23:27 +1100 Subject: [PATCH 02/25] docs(ci): record the arm64 exception and fork approval in ADR 0002 Some jobs must run on arm64, such as native arm64 image builds. They now run on RunsOn's arm64 machines. Every other heavy job stays on x64. With RunsOn, a pull request from a fork would run its code in our AWS account. The repository now requires approval before any outside contributor's workflows run. --- ...-github-hosted-runners-heavy-jobs-on-runs-on.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md index 65cc84528f..2e11f25b66 100644 --- a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md +++ b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md @@ -13,6 +13,10 @@ each job. Heavy jobs use c8a machines with 8 vCPUs. Mutants uses a c8a machine with 16 vCPUs. The other repositories that share the CI budget move their Blacksmith jobs to RunsOn too. +Heavy jobs stay on x64, because arm64 machines were slower and not cheaper in +the trial. Jobs that must run on arm64, such as native arm64 container image +builds, are the exception. They run on RunsOn's arm64 machines. + We made the change because of cost. CI for this repository cost about $3,865 a month on Blacksmith at October 2026's pace. That was 20 times September's cost. The CI budget for this repository and the others that share it is @@ -35,6 +39,10 @@ flowchart LR - **Run every job on GitHub-hosted runners.** In the runner trial in pull request #1297, jobs took 2.46 times as long overall. The integration suites took up to 4.8 times as long. +- **Build arm64 images on x64 machines.** Cross-compiling Rust for another + architecture is slow. +- **Run arm64 jobs on GitHub-hosted arm64 runners.** Those runners cost money + for private repositories. ## Consequences @@ -50,6 +58,6 @@ flowchart LR - Every job sets `timeout-minutes`. In the trial, one job without a limit ran for over 2 hours. - We maintain the RunsOn resources in AWS. They cost $40 to $60 a month. -- RunsOn's pricing page limits its free licence to non-commercial use. The - trial licence ends in November 2026. Buying a licence is a separate - decision. +- A pull request from a fork would run its code on a machine in our AWS + account. So this repository requires approval before any outside + contributor's workflows run, not only a first-time contributor's. From 1b0be48d1b42a4507933f170ee45248a92ca0050 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Thu, 29 Oct 2026 20:41:41 +1100 Subject: [PATCH 03/25] docs(ci): record the merge queue test and the Docker Hub login A merge queue test on 28 October 2026 settled four questions in ADR 0003. Queue commits pass the signed-commit rule. A queue commit's parent is the entry ahead of it. GitHub does not cancel a run when its entry leaves the queue. The fourth result changed the design. A run started by a label can replace an earlier failed result. So every label run now selects the push checks again, and gives fresh results. ADR 0002 now records that RunsOn jobs log in to Docker Hub. Docker Hub limits anonymous pulls per address, and all RunsOn machines share one. --- ...ub-hosted-runners-heavy-jobs-on-runs-on.md | 9 +++++ ...ks-run-in-merge-queues-on-main-and-next.md | 33 ++++++++++++++----- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md index 2e11f25b66..7f2ecbe588 100644 --- a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md +++ b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md @@ -43,6 +43,11 @@ flowchart LR architecture is slow. - **Run arm64 jobs on GitHub-hosted arm64 runners.** Those runners cost money for private repositories. +- **Pull Docker Hub images through a cache in RunsOn's AWS setup.** RunsOn + documents that cache only for its Terraform or OpenTofu install. +- **Pull Docker's official images from Amazon ECR Public.** Every image name + in every repository would change. Images that are not official would need + another source. ## Consequences @@ -58,6 +63,10 @@ flowchart LR - Every job sets `timeout-minutes`. In the trial, one job without a limit ran for over 2 hours. - We maintain the RunsOn resources in AWS. They cost $40 to $60 a month. +- RunsOn machines leave AWS through one shared address. Docker Hub limits + anonymous pulls per address. Jobs failed on that limit in October 2026. So + a job logs in to Docker Hub before it pulls an image. Runs for pull + requests from forks get no secrets, so they still pull without a login. - A pull request from a fork would run its code on a machine in our AWS account. So this repository requires approval before any outside contributor's workflows run, not only a first-time contributor's. diff --git a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md index deab67402f..33a5445763 100644 --- a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md +++ b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md @@ -81,6 +81,12 @@ An author can add the `ci:full` label to run the gate checks early on the pull request. A job removes the label when the early run starts. So each early run is a deliberate request. The queue still runs the gate checks again. +GitHub cannot start a workflow on one label only, so every workflow starts +when any label is added. On every such run, the selector job selects the push +checks again, and the gate checks too for `ci:full`. GitHub counts the newest +result for a check name. So a label run gives fresh results and cannot hide an +earlier failure. + ## Mutants - Mutants is a required gate check. It tests only the lines that the pull @@ -128,6 +134,12 @@ is a deliberate request. The queue still runs the gate checks again. its required checks pass. - **Keep the `ci:full` label until the author removes it.** A forgotten label would run every gate check on every later push. +- **Select nothing on a label other than `ci:full`.** Every job would be + skipped, and GitHub counts a skipped job as a pass. A test on 28 October + 2026 showed that this run then replaces an earlier failure. +- **Give the summary job a different name on label runs, or run early runs + in separate workflows.** Either way, a failed early run would no longer stop + a pull request joining the queue. ## Consequences @@ -142,15 +154,18 @@ is a deliberate request. The queue still runs the gate checks again. it, a pull request that failed could merge with the one behind it. - The smallest group the queue merges is 1 pull request. So a lone pull request never waits for others. -- Workflows must start when any label is added, because GitHub cannot filter - that event by label name. That run reports under the same check names as - the push run. A test branch must show that it cannot replace an earlier - failure. -- Commits made by the merge queue must pass the rule that requires signed - commits. A test branch must show this before the queues start. -- A test branch must also confirm that a queue commit's parent is the entry - ahead of it. GitHub's webhook schema calls `base_sha` the merge group's - parent commit. It does not say which commit that is. +- Every label added to a pull request runs its push checks again. In October + 2026, 74 labels were added to 53 pull requests. Most were Dependabot's, + added as the pull request opened, so they cost almost nothing extra. +- A test of a merge queue on 28 October 2026 confirmed three behaviours: + - Commits made by the merge queue pass the rule that requires signed + commits. + - A queue commit's parent is the entry ahead of it. `merge_group.base_sha` + is that parent. + - GitHub does not cancel a running workflow when its entry leaves the + queue. The run continues to the end. +- A failed entry stays in the queue until the entry ahead of it finishes. + Meanwhile, the entry behind it builds on top of the failure. - After a flaky push check on an early run, the author must re-run Mutants as well. - While it waits, the watcher holds one of the organisation's 60 From 747c6d70a83c2e0483aeea455b4b8c0114284e15 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood Date: Thu, 19 Nov 2026 22:39:39 +1100 Subject: [PATCH 04/25] docs(ci): record the same-size swap from Blacksmith to RunsOn ADR 0004 records the decision to move every Blacksmith job in this repository to a RunsOn machine with the same vCPU count and Ubuntu version, to cut cost at once. It supersedes ADR 0002 and pauses work on ADR 0003. The CONTEXT entry "Same-size swap" names the change. The implementation plan the swap follows is in docs/superpowers/plans. --- .github/CONTEXT.md | 8 + ...ub-hosted-runners-heavy-jobs-on-runs-on.md | 2 +- ...ks-run-in-merge-queues-on-main-and-next.md | 3 + ...me-size-swap-from-blacksmith-to-runs-on.md | 128 +++++ ...19-same-size-swap-blacksmith-to-runs-on.md | 485 ++++++++++++++++++ 5 files changed, 625 insertions(+), 1 deletion(-) create mode 100644 docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md create mode 100644 docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index 9d9b099a09..6b454b1af9 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -76,6 +76,12 @@ and runs on a self-provisioned cloud runner instead. Whether a job is heavy says where it runs, not when: a heavy job can be a push check. _Avoid_: big job, 16-core job +**Same-size swap**: +The change that moves each Blacksmith job to a RunsOn machine with the same +vCPU count, architecture, and Ubuntu version. Memory and disk may be smaller. +The job's triggers and steps stay the same. +_Avoid_: like-for-like replacement, migration + ## Relationships - Three separate choices apply to each check. Its trigger paths decide whether @@ -85,3 +91,5 @@ _Avoid_: big job, 16-core job - Mutation testing is expensive but important. So it runs only once the design and implementation of a change are settled. Its failures must be fixed before the change merges. That makes it a heavy job and a gate check. +- A same-size swap ignores the light and heavy distinction. A Blacksmith job + moves to RunsOn even if a GitHub-hosted standard runner could run it. diff --git a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md index 7f2ecbe588..09c07519be 100644 --- a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md +++ b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md @@ -1,5 +1,5 @@ --- -status: accepted +status: superseded by ADR-0004 --- # Move CI from Blacksmith to GitHub-hosted runners and RunsOn diff --git a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md index 33a5445763..06bec18ff8 100644 --- a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md +++ b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md @@ -4,6 +4,9 @@ status: accepted # Run the expensive CI checks in merge queues on `main` and `next` +> Work on this decision paused in November 2026, until the same-size swap in +> ADR 0004 is in place. + We decided in October 2026 to split this repository's CI checks into push checks and gate checks. Push checks run on every push to a pull request. Gate checks run once, when the pull request is in a merge queue. `main` and `next` diff --git a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md new file mode 100644 index 0000000000..5f43797547 --- /dev/null +++ b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md @@ -0,0 +1,128 @@ +--- +status: accepted +--- + +# Swap Blacksmith for RunsOn machines of the same size + +In November 2026 we decided to move every Blacksmith job in this repository to +RunsOn. Each job gets the same vCPU count, architecture, and Ubuntu version. +`.github/CONTEXT.md` calls this a same-size swap. Nothing else about the jobs +changes: their triggers, steps, and trigger paths stay as they are. + +We made the change to cut cost at once. At November 2026's pace, CI for this +repository costs about $3,470 a month on Blacksmith. On RunsOn machines of the +same size, we estimate $1,140 to $1,350 a month for the machines. RunsOn's own +AWS resources add $40 to $60 a month. The estimate applies the cost ratios from +the runner trial in pull request #1297 to Blacksmith's November bill. + +This decision supersedes ADR 0002. It sets aside the $1,000 monthly budget in +the CI budget entry of `.github/CONTEXT.md` as the measure of success. Work on +ADR 0003 is paused until the swap is in place. + +## What changes + +Each Blacksmith label becomes a RunsOn label with the same vCPU count and +Ubuntu version: + +| Blacksmith label | RunsOn label | +|---|---| +| `blacksmith-16vcpu-ubuntu-2204` | `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=16/image=ubuntu22-full-x64/volume=80gb/extras=s3-cache` | +| `blacksmith-4vcpu-ubuntu-2404` | `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache` | + +- **Which jobs:** every job that names a Blacksmith label, in every workflow + of this repository. That includes the Linux targets of the FFI release + matrix. `scripts/ffi-release-matrix.mjs` assigns their labels. On 19 November 2026, + `main` had 55 such job definitions in 27 workflows. +- **Which jobs stay:** jobs on GitHub-hosted runners stay there. Examples are + `ubuntu-latest`, macOS, and Windows jobs. +- **Other repositories:** `proxy` and the other repositories that use + Blacksmith keep it for now. +- **Memory:** c8a machines have 2 GB per vCPU. Blacksmith's x64 machines have + 4 GB per vCPU. A job that fails for lack of memory moves to `family=m8a`. + The m8a machines have 4 GB per vCPU. +- **Disk:** every job gets 80 GB. Blacksmith gives 80 GB at 4 vCPU and 750 GB + at 16 vCPU. +- **Cache:** `extras=s3-cache` sends `actions/cache` to an S3 bucket in our AWS + account. The jobs need no extra step for this. RunsOn job logs from + October 2026 show cache restores working with the label alone. +- **Machine family:** RunsOn uses spot c8a machines first. The `m8a` family + gives it a second choice when AWS has no spare c8a spot machines. + +Two changes go in with the swap, because RunsOn needs them: + +- **Docker Hub logins.** A job logs in to Docker Hub before it pulls an image. + It uses a free Docker Hub account. The login needs the `DOCKER_HUB_USERNAME` + and `DOCKER_HUB_PASSWORD` secrets. Dependabot runs read Dependabot secrets, + so both secrets need a Dependabot copy too. Runs for pull requests from forks + get no secrets, so they pull without a login. +- **Time limits.** Every job sets `timeout-minutes`. On RunsOn, a stuck job + costs money until its limit ends it. In the trial, one job without a limit + ran for over 2 hours. + +## The RunsOn setup + +These settings are in place, or requested, in the AWS account: + +- RunsOn v3.6.2, upgraded on 19 November 2026. Older versions failed jobs when + the on-demand vCPU quota was full. From v3.6.0, those jobs wait. +- Spot machines first, with on-demand machines when spot capacity runs out. + RunsOn reruns a job that AWS interrupts. +- No warm machines. They cost money while idle. +- One RunsOn installation, in `us-west-2`. +- vCPU quotas of 5,000 for spot and for on-demand standard instances. AWS had + not yet approved the requests on 19 November 2026. Until it does, the + quotas are 512 vCPUs each, and jobs above them wait. The swap does not + wait for the approval. +- `AppSize` moves from `small` to `medium` once AWS raises the + `RunInstances` request rate from 2 to 4 a second. We asked AWS for that on + 19 November 2026. Both sizes cost the same. + +## How we judge the swap + +We judge the swap on cost alone. The AWS account holds only RunsOn. So while +only this repository uses RunsOn, the account's bill is the cost of its CI. We +revert the swap only if CI stops working. + +## Considered options + +- **Match Blacksmith's memory with m8a machines.** We estimate 10 to 20% more + per hour than c8a. The trial found no memory failures on c8a in 44 jobs. +- **Match Blacksmith's disk sizes.** A 750 GB disk adds about a fifth to the + spot price of a 16 vCPU machine. The open pull requests ran 16 vCPU jobs on + 80 GB disks with every check passing. +- **Keep ADR 0002's plan.** Light jobs on GitHub-hosted runners and heavy jobs + on 8 vCPU machines cost less. That plan needs more changes, and ADR 0003's + merge queues, before it brings its full saving. +- **Switch in stages, Test EQL first.** Test EQL is 53% of November's spend. + Two stages would need two reviews and two switches. Most of the risk is in + Test EQL anyway. +- **Use on-demand machines only.** Jobs would never be interrupted. The cost + would be about 2.3 times the spot price. +- **Keep warm machines ready.** Jobs would start faster. Warm machines cost + money while idle. +- **Pay for a Docker Team or Pro plan.** Either plan removes the pull limit. + Billed yearly, Team costs $15 a user a month and Pro costs $9. A Team plan + also gives a token that belongs to the organisation, not to one person. + +## Consequences + +- A RunsOn job started 40 to 50 seconds later than a Blacksmith job in the + trial. +- Blacksmith ran any number of jobs at once. RunsOn runs as many as the AWS + vCPU quotas allow. In October 2026, the peak need was between 2,700 and + 4,700 vCPUs. +- AWS can interrupt a spot machine. RunsOn then reruns the job, so it takes + longer. +- A 16 vCPU job has 32 GB of memory, not 64 GB. +- Each RunsOn machine has its own public address. Docker Hub still refused + anonymous pulls in the October 2026 trial, so jobs log in. +- The free Docker Hub account allows 200 pulls in 6 hours, for all jobs + together. In busy hours, jobs can reach that limit, and their pulls fail. +- A pull request from a fork runs its code on a machine in our AWS account. So + this repository requires approval before any outside contributor's + workflows run. +- Blacksmith's GitHub App stays installed for the other repositories. A revert + of the swap returns these jobs to Blacksmith. +- The light and heavy job entries in `.github/CONTEXT.md` no longer decide + where a job runs. A Blacksmith job moves to RunsOn even if a GitHub-hosted + runner could run it. diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md new file mode 100644 index 0000000000..6b9d541021 --- /dev/null +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -0,0 +1,485 @@ +# Same-size swap from Blacksmith to RunsOn: implementation plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Move every Blacksmith job in `cipherstash/stack` to a RunsOn machine with the same vCPU count, architecture, and Ubuntu version. + +**Architecture:** Pull request #1419 already moves some jobs to RunsOn at 8 vCPUs. It also adds Docker Hub logins and a test that requires them. This plan merges `main` into that branch, gives every job its Blacksmith size, and moves the remaining jobs. Each rule gets a test in `scripts/__tests__/`. A later change that breaks a rule then fails a test. + +**Tech Stack:** GitHub Actions YAML, RunsOn v3.6.2 labels, Node.js ESM scripts, Vitest, js-yaml, and actionlint 1.7.7. + +**Spec:** `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`, on branch `docs/ci-cost-decisions` in pull request #1416. + +## Global Constraints + +- The 16 vCPU label, verbatim: `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=16/image=ubuntu22-full-x64/volume=80gb/extras=s3-cache` +- The 4 vCPU label, verbatim: `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache` +- `blacksmith-16vcpu-ubuntu-2204` becomes the 16 vCPU label. `blacksmith-4vcpu-ubuntu-2404` becomes the 4 vCPU label. +- A job that fails for lack of memory changes `family=c8a+m8a` to `family=m8a`. Nothing else in its label changes. No job starts on `m8a`. +- Every job that names a Blacksmith label moves. On `main` at `0a0fb63ec`, that is 55 job definitions in 27 workflows. Of these, 31 have 16 vCPUs. The other 24 have 4 vCPUs. +- The three Linux platforms of the FFI release matrix move too. `scripts/ffi-release-matrix.mjs` gives them their label, with the run ID passed in. +- Jobs on GitHub-hosted runners stay where they are. +- Job IDs, job names, triggers, trigger paths, and existing steps stay the same. Branch rules require some job names, so a renamed job would leave a required check waiting. +- The swap adds three things only: Docker Hub logins, a wait for the apt lock, and two secrets for one reusable workflow. +- The login reads `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD`. It does nothing when either secret is empty, as on a pull request from a fork. +- #1427 sets the time limits. It merges before #1419. +- Commits are SSH-signed. They carry no `Co-Authored-By` or `Claude-Session` lines. Pull request text contains no Claude attribution. +- Pull requests stay drafts. Push only after the user has asked for this plan to be carried out. Never force-push. +- GitHub text contains no Linear issue IDs. It never names or describes the private repository that the stack-* crates came from. +- Comments, commit messages, and pull request text use short, literal sentences, one idea each. +- Do not change repository settings or secrets. The user does that. + +## Steps only the user does + +These are not tasks for the executor, and no task waits for them. Until the secrets exist, the login steps do nothing, and pulls stay anonymous. + +- Create the free Docker Hub account. Create a personal access token for it with read-only access to public repositories. +- Add `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` to `cipherstash/stack` as Actions secrets. Add both as Dependabot secrets too, because Dependabot runs read only those. +- Merge #1427. Mark #1419 ready and merge it when you choose. + +## Review Focus + +1. **A reusable workflow whose caller passes no secrets.** In a called workflow, `secrets.*` is empty unless the caller passes it. The login would skip. The job would then pull anonymously without an error. Task 3 adds a test that every such caller passes both secrets. +2. **A RunsOn runner chosen by a matrix.** The FFI `binaries` job takes its runner from `matrix.cfg.os`. The login test from #1419 checks only jobs with a literal `runs-on=` label. So it would miss the musl build. That build pulls Alpine from Docker Hub. Task 2 lists each matrix runner job, and Task 3 checks the RunsOn ones. +3. **apt on a fresh machine.** A new RunsOn machine can still be running apt from boot. `apt-get` then fails at once on the held lock. Task 4 adds a test that every apt command in a RunsOn job waits for the lock. +4. **A label of the wrong size.** #1419 used `cpu=8`. A label left at `cpu=8` would give a job the wrong machine. A label with no run ID would be shared by every run. Task 2's tests accept only the labels in Global Constraints, and refuse an FFI label with no run ID. +5. **A 16 vCPU job that needs more than 32 GB.** No repository test can show this. The pull request's own CI run is the test. Task 5 watches it and applies the `m8a` rule to any job killed for lack of memory. + +--- + +## Outside this plan + +- AWS has not yet raised the `RunInstances` request rate. When Service Quotas shows 4 for `L-A2D70E6C`, a second CloudFormation change set moves `AppSize` to `medium`. +- AWS has not yet approved the vCPU quotas of 5,000. Until it does, jobs above 512 vCPUs wait for a machine. +- The repository already requires approval before a workflow from any outside contributor runs. The API showed `all_external_contributors` on 19 November 2026. + +--- + +### Task 1: Bring #1427 up to date with `main` + +#1427 sets `timeout-minutes` on every job, and its test fails when a job has none. Jobs added to `main` since 28 October may have no limit. + +**Files:** +- Modify: each `.github/workflows/*.yml` file the test lists +- Test: `scripts/__tests__/workflow-job-timeouts.test.mjs`, already on the branch + +**Interfaces:** +- Consumes: nothing +- Produces: branch `ci/job-timeouts`. It merges into `main` with its test passing. + +- [ ] **Step 1: Merge `main` into the branch** + +Create a worktree for `ci/job-timeouts` with the superpowers:using-git-worktrees skill. In it, run: + +```bash +git fetch origin +git merge --no-edit origin/main +pnpm install --frozen-lockfile +``` + +Expected: the merge completes. On a conflict, keep `main`'s lines and add the branch's `timeout-minutes` line to the job. + +- [ ] **Step 2: Run the test** + +Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-job-timeouts.test.mjs` + +Expected: PASS, or FAIL with a list of `#` references that have no limit. + +- [ ] **Step 3: Give each listed job a limit** + +Use the rule from commit `c1985b4a8`. The limit is about twice the job's longest successful run in the last 30 days. Round it up to a multiple of 5 minutes, with a floor of 10. Read run times with `gh run list --workflow --status success --limit 50 --json databaseId` and `gh run view --json jobs`. + +- [ ] **Step 4: Run the test again** + +Run: the command in Step 2. Expected: PASS. + +- [ ] **Step 5: Commit and push** + +If Step 2 passed, push nothing, because the pull request already merges cleanly. Otherwise: + +```bash +git add .github/workflows +git commit -S -m "ci(timeouts): set timeout-minutes on the jobs added since 28 October" +git push +``` + +Then tell the user that #1427 is ready for them to merge. + +### Task 2: Swap every runner label + +**Files:** +- Create: `scripts/__tests__/lib/runs-on.mjs` +- Create: `scripts/__tests__/workflow-runs-on.test.mjs` +- Modify: `scripts/ffi-release-matrix.mjs`, in `runnerFor`, `releaseMatrix`, and their doc comment +- Modify: `scripts/__tests__/ffi-release-matrix.test.mjs` +- Modify: every `.github/workflows/*.yml` file that names `blacksmith-` or `cpu=8` in a `runs-on:` line +- Modify: `.github/actionlint.yaml` +- Modify: comments at lines 9 and 22 of `.github/workflows/lint-release.yml` + +**Interfaces:** +- Consumes: `imageOf()` in `scripts/__tests__/workflow-mise-cache-image.test.mjs`. On #1419's branch, it already reads `image=ubuntuNN` from a RunsOn label. +- Produces, in `scripts/__tests__/lib/runs-on.mjs`: + - `runsOnLabel(cpu: 4 | 16, { family = 'c8a+m8a', runId = '${{ github.run_id }}' } = {}): string`. A `cpu` of 16 gives `image=ubuntu22-full-x64`. A `cpu` of 4 gives `image=ubuntu24-full-x64`. Any other `cpu` throws. + - `RUNS_ON_LABELS: ReadonlySet`, holding `runsOnLabel(16)` and `runsOnLabel(4)`, plus both with `family: 'm8a'`. + - `MATRIX_RUNNERS: Record`, keyed by `'#'`. The workflow path is what `workflowFiles()` in `lib/workflows.mjs` returns. + - `isRunsOnJob(job: object, ref?: string): boolean`. It is true when `job['runs-on']` is a string that starts with `runs-on=`. It is also true when `MATRIX_RUNNERS[ref]?.runsOn` is true. +- Produces, in `scripts/ffi-release-matrix.mjs`: `runnerFor(platform: string, runId = process.env.GITHUB_RUN_ID): string` and `releaseMatrix(triples, runId = process.env.GITHUB_RUN_ID)`. + +- [ ] **Step 1: Merge `main` into #1419's branch** + +The branch `ci/heavy-jobs-runs-on` already has a worktree, at `.claude/worktrees/agent-a7c8ac844ed823b0f`. Check that `git status` is clean there. Then run: + +```bash +git fetch origin +git merge --no-edit origin/main +pnpm install --frozen-lockfile +pnpm run test:scripts +``` + +Expected: PASS. Resolve each conflict by keeping `main`'s lines, plus the branch's `runs-on:`, Docker Hub login, and apt lock changes. A test failure at this step comes from the merge, so fix it before going on. + +- [ ] **Step 2: Write `scripts/__tests__/lib/runs-on.mjs`** + +Implement the interface above. `MATRIX_RUNNERS` contains exactly these entries: + +```js +export const MATRIX_RUNNERS = { + '.github/workflows/_build-ffi-artifacts.yml#binaries': { + runsOn: true, + reason: 'scripts/ffi-release-matrix.mjs gives every Linux platform a RunsOn label.', + }, + '.github/workflows/_build-auth-artifacts.yml#binaries': { + runsOn: false, + reason: 'Its matrix names GitHub-hosted runners only.', + }, + '.github/workflows/tests-golang.yml#go-binding-cross': { + runsOn: false, + reason: 'Its matrix is macos-latest and windows-latest.', + }, +} +``` + +- [ ] **Step 3: Write the failing tests in `scripts/__tests__/workflow-runs-on.test.mjs`** + +Read every job with `workflowFiles()` and `readWorkflow()`, as `{ ref: '#', job }`. Two local helpers return references. `refsWhere(predicate)` returns the `ref` of each job that matches. `expressionRunnerRefs()` returns the `ref` of each job whose runner comes from an expression. + +```js +describe('RunsOn runner labels', () => { + it('builds the labels ADR 0004 names', () => { + expect(runsOnLabel(16)).toBe('runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=16/image=ubuntu22-full-x64/volume=80gb/extras=s3-cache') + expect(runsOnLabel(4)).toBe('runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache') + expect(runsOnLabel(4, { family: 'm8a' })).toBe('runs-on=${{ github.run_id }}/family=m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache') + expect(() => runsOnLabel(8)).toThrow() + }) + + it('finds the jobs it checks', () => { + expect(jobs.filter(({ job, ref }) => isRunsOnJob(job, ref)).length).toBeGreaterThan(50) + }) + + it('names no Blacksmith label', () => { + // JSON.stringify covers a runs-on that is a list or an object. + expect(refsWhere(({ job }) => /blacksmith-/.test(JSON.stringify(job['runs-on'] ?? '')))).toEqual([]) + }) + + it('uses only the labels ADR 0004 names', () => { + expect(refsWhere(({ job }) => { + const label = job['runs-on'] + return typeof label === 'string' && label.startsWith('runs-on=') && !RUNS_ON_LABELS.has(label) + })).toEqual([]) + }) + + it('lists every job whose runner comes from an expression', () => { + // An expression runner: runs-on is not a string, or contains `${{` and + // does not start with `runs-on=`. Both directions, so a stale entry fails. + expect(expressionRunnerRefs().sort()).toEqual(Object.keys(MATRIX_RUNNERS).sort()) + expect(Object.values(MATRIX_RUNNERS).every(({ reason }) => reason.trim())).toBe(true) + }) +}) +``` + +Each string that contains `${{` needs the `biome-ignore lint/suspicious/noTemplateCurlyInString` comment that `workflow-mise-cache-image.test.mjs` uses. + +- [ ] **Step 4: Update `scripts/__tests__/ffi-release-matrix.test.mjs`** + +Import `runsOnLabel` from `./lib/runs-on.mjs`. Set `const RUN_ID = '1234'`, `const MATRIX = releaseMatrix(TRIPLES, RUN_ID)`, and `const RUNS_ON_4 = runsOnLabel(4, { runId: RUN_ID })`. Then: + +- The `linux-x64-gnu`, `linux-arm64-gnu`, and `linux-x64-musl` entries expect `os: RUNS_ON_4`. Their `script` and `log` stay as they are. +- The fallback test expects `runnerFor('linux-arm64-musl', RUN_ID)` to be `RUNS_ON_4`. Its comment says that a platform the table does not name builds on RunsOn. +- Keep the test that refuses an empty run ID: `expect(() => runnerFor('linux-x64-gnu', '')).toThrow(/GITHUB_RUN_ID/)`. +- Add `expect(runnerFor('darwin-x64', '')).toBe('macos-latest')`, because only a RunsOn label needs the run ID. + +- [ ] **Step 5: Run both tests to see them fail** + +Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-runs-on.test.mjs scripts/__tests__/ffi-release-matrix.test.mjs` + +Expected: FAIL. "names no Blacksmith label" lists the jobs still on Blacksmith. "uses only the labels ADR 0004 names" lists the `cpu=8` jobs. The FFI test shows `cpu=8` labels, and a Blacksmith label for musl. + +- [ ] **Step 6: Replace the labels in the workflows** + +```bash +sed -i \ + -e 's|runs-on: blacksmith-16vcpu-ubuntu-2204|runs-on: runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=16/image=ubuntu22-full-x64/volume=80gb/extras=s3-cache|' \ + -e 's|runs-on: blacksmith-4vcpu-ubuntu-2404|runs-on: runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache|' \ + -e 's|/cpu=8/image=ubuntu22-full-x64/|/cpu=16/image=ubuntu22-full-x64/|' \ + -e 's|/cpu=8/image=ubuntu24-full-x64/|/cpu=4/image=ubuntu24-full-x64/|' \ + .github/workflows/*.yml +``` + +The last two lines undo #1419's sizes. On `main`, every 16 vCPU label is Ubuntu 22.04, and every 4 vCPU label is Ubuntu 24.04. So the image of a `cpu=8` job shows its Blacksmith size. + +The publish jobs get `extras=s3-cache` too. It has no effect in a job with no cache step. `scripts/lint-no-workflow-caching.mjs` keeps the publish jobs free of cache steps. + +- [ ] **Step 7: Change `runnerFor` in `scripts/ffi-release-matrix.mjs`** + +A `win32` platform gives `windows-latest`, and a `darwin` platform gives `macos-latest`. Neither needs the run ID. Every other platform gives the 4 vCPU label, with the run ID in place of the expression. An empty run ID throws an error that names `GITHUB_RUN_ID`. + +Rewrite the doc comment to say three things. Darwin and Windows need GitHub-hosted images for their SDKs. Every Linux platform builds on a RunsOn machine with 4 vCPUs, its size on Blacksmith. A matrix value cannot read `${{ github.run_id }}`, so the run ID is passed in. Remove #1419's sentences about build times and about musl staying on Blacksmith. + +- [ ] **Step 8: Empty the self-hosted label list in `.github/actionlint.yaml`** + +Replace the file's content with: + +```yaml +# actionlint checks every `runs-on:` label against the GitHub-hosted labels it +# knows, and against the self-hosted labels listed here. +# +# The list is empty. Every self-hosted job runs on RunsOn, and each RunsOn +# label starts with `runs-on=${{ github.run_id }}`. actionlint does not check +# a label that contains an expression. So a Blacksmith label is now unknown, +# and actionlint reports it. +self-hosted-runner: + labels: [] +``` + +In `.github/workflows/lint-release.yml`, change "for the Blacksmith runner label" at line 9 to "for its self-hosted runner labels". Change "the config it resolves the Blacksmith label from" at line 22 to "the config it reads runner labels from". + +- [ ] **Step 9: Run the tests to see them pass** + +Run: `pnpm run test:scripts` + +Expected: PASS, with one exception. `workflow-docker-hub-login.test.mjs` now checks every moved job, and lists those that pull an image with no login. Task 3 adds those logins. `workflow-mise-cache-image.test.mjs` passes, because each job keeps its Ubuntu version. + +- [ ] **Step 10: Run actionlint on the release workflows** + +Run the `actionlint` command from the "actionlint (release workflows)" step of `lint-release.yml`. Start it with `mise x go -- go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7` in place of `actionlint`. + +Expected: no output, and exit code 0. The release workflows now carry RunsOn labels, so this also shows that actionlint skips a label with an expression. + +- [ ] **Step 11: Check the counts and what is left** + +```bash +git grep -h 'runs-on: blacksmith-16vcpu-ubuntu-2204' origin/main -- .github/workflows | wc -l +git grep -h 'cpu=16/image=ubuntu22-full-x64' -- .github/workflows | wc -l +git grep -h 'runs-on: blacksmith-4vcpu-ubuntu-2404' origin/main -- .github/workflows | wc -l +git grep -h 'cpu=4/image=ubuntu24-full-x64' -- .github/workflows | wc -l +git grep -n -E 'cpu=8|blacksmith-' -- .github scripts/ffi-release-matrix.mjs +``` + +Expected: the first two numbers match, and so do the next two. At `0a0fb63ec` they were 31 and 24. The last command lists only comments. They say why some jobs use GitHub-hosted runners, and one names an arm64 label in `_build-auth-artifacts.yml`. + +- [ ] **Step 12: Commit** + +```bash +git add .github scripts +git commit -S -m "ci(runners): move every Blacksmith job to a RunsOn machine of the same size" +``` + +### Task 3: Log in to Docker Hub on every RunsOn job that pulls an image + +**Files:** +- Modify: `scripts/__tests__/workflow-docker-hub-login.test.mjs` +- Modify: each workflow the test lists +- Modify: `.github/workflows/_build-ffi-artifacts.yml`, `.github/workflows/release.yml`, and `.github/workflows/ffi-preflight.yml` + +**Interfaces:** +- Consumes: `isRunsOnJob(job, ref)` from `scripts/__tests__/lib/runs-on.mjs`, made in Task 2. +- Produces, in `workflow-docker-hub-login.test.mjs`: + - `jobFindings(where: string, job: object, ref?: string): string[]`. Its RunsOn check becomes `isRunsOnJob(job, ref)`. + - `callerFinding(job: object): string | null`. It returns null when `job.secrets` is `'inherit'`. It also returns null when `job.secrets` maps `DOCKER_HUB_USERNAME` to `${{ secrets.DOCKER_HUB_USERNAME }}` and `DOCKER_HUB_PASSWORD` to `${{ secrets.DOCKER_HUB_PASSWORD }}`. Otherwise it returns a message that names each missing secret. + +- [ ] **Step 1: Write the failing tests** + +In `workflow-docker-hub-login.test.mjs`: + +- Replace the local `isRunsOn` with `isRunsOnJob`. `runsOnJobs()` builds `ref` as `${file}#${name}` and passes it to `jobFindings`. +- Rewrite the last paragraph of the header comment. A job counts as RunsOn when its label starts with `runs-on=`. It also counts when `MATRIX_RUNNERS` in `lib/runs-on.mjs` says its matrix gives it RunsOn machines. +- Raise the count in "finds the jobs it checks" from 20 to 50. +- Add `it('passes the Docker Hub secrets to every called workflow whose RunsOn jobs log in')`. Take each job whose `uses` starts with `./.github/workflows/`, and read the workflow it calls. When one of that workflow's RunsOn jobs has a step with `loginFinding(step) === null`, `callerFinding(job)` must be null. Collect each failure as `#: `, and expect `[]`. +- Add these unit cases: + +```js +expect(callerFinding({ uses: './.github/workflows/x.yml' })).toMatch(/DOCKER_HUB_USERNAME/) +expect(callerFinding({ uses: './.github/workflows/x.yml', secrets: 'inherit' })).toBeNull() +expect(callerFinding({ uses: './.github/workflows/x.yml', secrets: { DOCKER_HUB_USERNAME: USERNAME, DOCKER_HUB_PASSWORD: PASSWORD } })).toBeNull() +expect(callerFinding({ uses: './.github/workflows/x.yml', secrets: { DOCKER_HUB_USERNAME: USERNAME } })).toMatch(/DOCKER_HUB_PASSWORD/) +expect(jobFindings('w j', { 'runs-on': '${{ matrix.cfg.os }}', steps: [up] }, '.github/workflows/_build-ffi-artifacts.yml#binaries')) + .toEqual([expect.stringMatching(/no Docker Hub login comes before it/)]) +``` + +- [ ] **Step 2: Run the test to see it fail** + +Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-docker-hub-login.test.mjs` + +Expected: FAIL. "logs in before every pull" lists each job that pulls an image with no login before it. The list includes `_build-ffi-artifacts.yml binaries`. + +- [ ] **Step 3: Add a login before each pull the test lists** + +Copy the "Log in to Docker Hub" step, with its comment, from a `test-eql.yml` job that has one. Put it right before the step that the finding names. A service or job container from Docker Hub instead gets the `credentials:` expression and comment from the `encryption-postgres` service in `test-eql.yml`. + +- [ ] **Step 4: Give the musl FFI build its login and its secrets** + +In `.github/workflows/_build-ffi-artifacts.yml`: + +- Under `on.workflow_call`, declare both secrets with `required: false`. +- Add the login step right before "Build the binding in Alpine (linux-x64-musl)", with `if: ${{ matrix.cfg.platform == 'linux-x64-musl' }}`. The macOS and Windows legs have no Docker. Without the condition, `docker login` would fail there once the secrets exist. + +In `release.yml`, in the job that calls `_build-ffi-artifacts.yml`, pass both secrets. Do the same in the `artifacts` job of `ffi-preflight.yml`: + +```yaml + secrets: + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} + DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} +``` + +Pass these two by name, not with `secrets: inherit`. The called workflow then receives no other secret of the release workflow. + +- [ ] **Step 5: Run the tests to see them pass** + +Run: `pnpm run test:scripts`. Expected: PASS. + +- [ ] **Step 6: Run actionlint on the release workflows** + +Run: the command in Task 2, Step 10. Expected: no output, and exit code 0. actionlint fails when a caller passes a secret that the called workflow does not declare. + +- [ ] **Step 7: Commit** + +```bash +git add .github scripts +git commit -S -m "ci(runners): log in to Docker Hub before every RunsOn job pulls an image" +``` + +### Task 4: Wait for the apt lock on every RunsOn job + +#1419 added `-o DPkg::Lock::Timeout=300` to the two `apt-get` steps that run on RunsOn. Nothing yet stops a new step without it. + +**Files:** +- Modify: `scripts/__tests__/workflow-runs-on.test.mjs` +- Modify: each workflow or local action the test lists. None is expected. + +**Interfaces:** +- Consumes: `isRunsOnJob(job, ref)`, made in Task 2. +- Produces: `aptFinding(run: string): string | null`, exported from `workflow-runs-on.test.mjs`. It ignores comment lines. It looks for a line that runs `apt` or `apt-get` with `update`, `install`, `upgrade`, `dist-upgrade`, `remove`, `purge`, or `autoremove`. When such a line has no `DPkg::Lock::Timeout=`, it returns a message that names the line. Otherwise it returns null. + +- [ ] **Step 1: Write the failing tests** + +```js +it('recognises an apt command that does not wait for the lock', () => { + expect(aptFinding('sudo apt-get update')).toMatch(/DPkg::Lock::Timeout/) + expect(aptFinding('sudo apt install -y jq')).toMatch(/DPkg::Lock::Timeout/) + expect(aptFinding('sudo apt-get -o DPkg::Lock::Timeout=300 install -y doxygen')).toBeNull() + expect(aptFinding('# sudo apt-get update')).toBeNull() + expect(aptFinding('apt-cache policy doxygen')).toBeNull() +}) + +it('waits for the apt lock in every RunsOn job', () => { + // Every step of every RunsOn job. A `uses: ./…` step is followed into the + // composite action's runs.steps, as stepPulls does in + // workflow-docker-hub-login.test.mjs. + expect(aptFindingsInRunsOnJobs()).toEqual([]) +}) +``` + +- [ ] **Step 2: Run the tests to see them fail** + +Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-runs-on.test.mjs` + +Expected: FAIL with "aptFinding is not defined". + +- [ ] **Step 3: Implement `aptFinding` and `aptFindingsInRunsOnJobs`** + +`aptFindingsInRunsOnJobs()` returns one `# step : ` string for each step that `aptFinding` reports. + +- [ ] **Step 4: Run the tests to see them pass** + +Run: the command in Step 2. Expected: PASS. If the second test lists a step, add `-o DPkg::Lock::Timeout=300` after each `apt-get` in that step. + +- [ ] **Step 5: Commit** + +```bash +git add scripts .github +git commit -S -m "test(ci): require every RunsOn job to wait for the apt lock" +``` + +### Task 5: Check the branch, and update #1419 + +**Files:** no new files. + +- [ ] **Step 1: Run the checks that CI runs on these files** + +```bash +pnpm run test:scripts +pnpm run lint:workflow-cache +pnpm run code:check +``` + +Expected: all three pass. `code:check` fails on errors only, and may print warnings. + +- [ ] **Step 2: Check that no job name changed** + +```bash +git diff origin/main -U0 -- .github/workflows | grep -E '^[-+][[:space:]]+(- )?name:' +``` + +Expected: only added lines that read `+ - name: Log in to Docker Hub`. A removed or changed job `name:` would leave a required check waiting. + +- [ ] **Step 3: Push** + +Run: `git push origin ci/heavy-jobs-runs-on` + +Expected: a normal push. If git refuses because the remote branch moved, stop and tell the user. + +- [ ] **Step 4: Update the title and body of #1419** + +Use the meta-pr-creation skill. The title is `ci(runners): move every Blacksmith job to a RunsOn machine of the same size`. The body says what changes, why, and how to check it. It points to ADR 0004 for the cost reasons. Keep the pull request a draft, and set both with `gh pr edit 1419 --title --body-file <file>`. + +- [ ] **Step 5: Run the FFI build on RunsOn** + +The release workflows do not run on a pull request. `ffi-preflight.yml` runs the FFI build without publishing anything: + +```bash +gh workflow run ffi-preflight.yml --ref ci/heavy-jobs-runs-on -f ref=ci/heavy-jobs-runs-on +``` + +Expected: the two gnu legs and the wrapper job pass. The musl leg fails as it does on `main`, for the reason in #1380. + +- [ ] **Step 6: Watch the pull request's CI run** + +Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view <run-id> --log-failed`. + +- **Killed for lack of memory:** the log shows exit code 137, "Killed", or "signal: 9, SIGKILL". Change that job's `family=c8a+m8a` to `family=m8a`. Run `pnpm run test:scripts`, then commit with the message `ci(runners): give <job name> 4 GB per vCPU on m8a`, and push. +- **`toomanyrequests` from Docker Hub:** report the job to the user. The secrets may not exist yet. +- **Any other failure:** compare it with the same job's latest run on `main`. Report it to the user with an excerpt from each log. + +### Task 6: Record the decision and this plan in #1416 + +**Files:** +- Modify: `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`, to `status: accepted` +- Add: `docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md` +- Add: the uncommitted changes to `.github/CONTEXT.md`, ADR 0002, and ADR 0003 + +Work in the worktree of branch `docs/ci-cost-decisions`. Leave out the CSV and PDF files at the repository root. They are local data, not documentation. + +- [ ] **Step 1: Set the ADR's status** + +Change line 2 of ADR 0004 to `status: accepted`. + +- [ ] **Step 2: Commit** + +```bash +git add .github/CONTEXT.md docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +git commit -S -m "docs(ci): record the same-size swap from Blacksmith to RunsOn" +``` + +- [ ] **Step 3: Push and update #1416** + +Run `git push`. Then add one paragraph to the body of #1416. It says that ADR 0004 supersedes ADR 0002 and pauses ADR 0003. Keep the pull request a draft. From 2604b2acdb1e2f40e1685e670df0bb1600099080 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Fri, 20 Nov 2026 13:03:20 +1100 Subject: [PATCH 05/25] docs(ci): correct ADR 0002's address and arm64 reasons ADR 0002 said that RunsOn machines leave AWS through one shared address. That is wrong. RunsOn logs "IsPrivate false" for every job, in the October trial and in November. Such a machine is in a public subnet. It has its own public address. ADR 0004 already says this. ADR 0002 now agrees with it, and keeps the reason that jobs log in to Docker Hub. ADR 0002 also rejected GitHub-hosted arm64 runners because they cost money for private repositories. This repository is public. It already builds linux-arm64-gnu on such a runner, in _build-auth-artifacts.yml. The text now says that the cost applies to the private repositories that share the CI budget. --- ...-github-hosted-runners-heavy-jobs-on-runs-on.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md index 09c07519be..30d9af9c24 100644 --- a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md +++ b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md @@ -42,7 +42,10 @@ flowchart LR - **Build arm64 images on x64 machines.** Cross-compiling Rust for another architecture is slow. - **Run arm64 jobs on GitHub-hosted arm64 runners.** Those runners cost money - for private repositories. + for private repositories. So the cost applies to the private repositories + that share the CI budget. This public repository already builds + `linux-arm64-gnu` on a GitHub-hosted arm64 runner for nothing, in + `_build-auth-artifacts.yml`. - **Pull Docker Hub images through a cache in RunsOn's AWS setup.** RunsOn documents that cache only for its Terraform or OpenTofu install. - **Pull Docker's official images from Amazon ECR Public.** Every image name @@ -63,10 +66,11 @@ flowchart LR - Every job sets `timeout-minutes`. In the trial, one job without a limit ran for over 2 hours. - We maintain the RunsOn resources in AWS. They cost $40 to $60 a month. -- RunsOn machines leave AWS through one shared address. Docker Hub limits - anonymous pulls per address. Jobs failed on that limit in October 2026. So - a job logs in to Docker Hub before it pulls an image. Runs for pull - requests from forks get no secrets, so they still pull without a login. +- Each RunsOn machine has its own public address. Docker Hub limits + anonymous pulls per address. It still refused anonymous pulls from RunsOn + machines in October 2026. So a job logs in to Docker Hub before it pulls an + image. Runs for pull requests from forks get no secrets, so they still pull + without a login. - A pull request from a fork would run its code on a machine in our AWS account. So this repository requires approval before any outside contributor's workflows run, not only a first-time contributor's. From e96f37d8bd47767fb9c4ab9f9eb53734adb2f131 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Fri, 20 Nov 2026 13:03:27 +1100 Subject: [PATCH 06/25] docs(ci): say that light and heavy no longer decide where a job runs The glossary said that being a light job or a heavy job decides where a job runs. That was true only of ADR 0002's plan. ADR 0004 superseded that plan. Its last consequence says that these entries no longer decide where a job runs. The glossary's own last bullet says the same. The light job and heavy job entries, and the first relationship, now say that only ADR 0002 used the distinction to place jobs. --- .github/CONTEXT.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index 6b454b1af9..983954d7bd 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -66,14 +66,18 @@ does not act while a workflow runs. _Avoid_: lint, selector guard, path-filter lint **Light job**: -A job that runs acceptably on a GitHub-hosted standard runner. Whether a job is -light says where it runs, not when: a light job can be a gate check. +A job that runs acceptably on a GitHub-hosted standard runner. ADR 0002 +planned to run light jobs there. ADR 0004 superseded that plan, so being light +no longer decides where a job runs. Being light says nothing about when a job +runs: a light job can be a gate check. _Avoid_: small job, cheap job **Heavy job**: -A job that needs more machine than a GitHub-hosted standard runner gives it, -and runs on a self-provisioned cloud runner instead. Whether a job is heavy -says where it runs, not when: a heavy job can be a push check. +A job that needs more machine than a GitHub-hosted standard runner gives it. +ADR 0002 planned to run heavy jobs on a self-provisioned cloud runner instead. +ADR 0004 superseded that plan, so being heavy no longer decides where a job +runs. Being heavy says nothing about when a job runs: a heavy job can be a push +check. _Avoid_: big job, 16-core job **Same-size swap**: @@ -84,9 +88,10 @@ _Avoid_: like-for-like replacement, migration ## Relationships -- Three separate choices apply to each check. Its trigger paths decide whether +- Two separate choices apply to each check. Its trigger paths decide whether it runs at all. Being a push check or a gate check decides when it runs. - Being a light job or a heavy job decides where it runs. +- Being a light job or a heavy job is a third, separate property. Under + ADR 0002, it decided where a check runs. ADR 0004 superseded that plan. - The fuzz regression replay, for example, is a light job and a gate check. - Mutation testing is expensive but important. So it runs only once the design and implementation of a change are settled. Its failures must be From 498483104d04cc1af25be4f0cd3a49d4de366686 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Fri, 20 Nov 2026 13:03:36 +1100 Subject: [PATCH 07/25] docs(ci): mark the plan's finished task and both toomanyrequests causes Task 6 of the same-size swap plan is done. Commit 6d0933ccd made its changes. The body of #1416 has its paragraph. Its steps were still unchecked, so an agent that ran the plan after the merge would try to commit changes that do not exist. The steps are now checked. The plan's spec line named a branch and a pull request. After the merge, the ADR is on main. The line now names the file only. The plan said that a toomanyrequests error from Docker Hub means the secrets may not exist yet. It can also mean that the jobs used all 200 pulls that the free account allows in 6 hours. The plan now names both causes. --- ...026-11-19-same-size-swap-blacksmith-to-runs-on.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 6b9d541021..9564c14297 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -8,7 +8,7 @@ **Tech Stack:** GitHub Actions YAML, RunsOn v3.6.2 labels, Node.js ESM scripts, Vitest, js-yaml, and actionlint 1.7.7. -**Spec:** `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`, on branch `docs/ci-cost-decisions` in pull request #1416. +**Spec:** `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`. ## Global Constraints @@ -457,11 +457,13 @@ Expected: the two gnu legs and the wrapper job pass. The musl leg fails as it do Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view <run-id> --log-failed`. - **Killed for lack of memory:** the log shows exit code 137, "Killed", or "signal: 9, SIGKILL". Change that job's `family=c8a+m8a` to `family=m8a`. Run `pnpm run test:scripts`, then commit with the message `ci(runners): give <job name> 4 GB per vCPU on m8a`, and push. -- **`toomanyrequests` from Docker Hub:** report the job to the user. The secrets may not exist yet. +- **`toomanyrequests` from Docker Hub:** report the job to the user. The secrets may not exist yet. Or the jobs may have used all 200 pulls that the free account allows in 6 hours. - **Any other failure:** compare it with the same job's latest run on `main`. Report it to the user with an excerpt from each log. ### Task 6: Record the decision and this plan in #1416 +This task is done. Commit `6d0933ccd` on #1416 made these changes. + **Files:** - Modify: `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`, to `status: accepted` - Add: `docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md` @@ -469,17 +471,17 @@ Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view < Work in the worktree of branch `docs/ci-cost-decisions`. Leave out the CSV and PDF files at the repository root. They are local data, not documentation. -- [ ] **Step 1: Set the ADR's status** +- [x] **Step 1: Set the ADR's status** Change line 2 of ADR 0004 to `status: accepted`. -- [ ] **Step 2: Commit** +- [x] **Step 2: Commit** ```bash git add .github/CONTEXT.md docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md git commit -S -m "docs(ci): record the same-size swap from Blacksmith to RunsOn" ``` -- [ ] **Step 3: Push and update #1416** +- [x] **Step 3: Push and update #1416** Run `git push`. Then add one paragraph to the body of #1416. It says that ADR 0004 supersedes ADR 0002 and pauses ADR 0003. Keep the pull request a draft. From c07a3df3a1692715137ce975c06d08ebfb028847 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Fri, 20 Nov 2026 13:08:54 +1100 Subject: [PATCH 08/25] docs(ci): cite the source of the Docker Hub pull limit ADR 0004 said that the free Docker Hub account allows 200 pulls in 6 hours. It gave no source. Docker's usage documentation gives that figure. Docker's pricing page says 100 pulls an hour instead. The ADR now cites the documentation page. It also notes the pricing page's figure. The plan points to the ADR for the source. The Team plan has a minimum of 2 users, so it costs at least $30 a month. The ADR named only the price for each user. It now names the minimum too. --- .../0004-same-size-swap-from-blacksmith-to-runs-on.md | 10 +++++++--- .../2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md index 5f43797547..40f4e82516 100644 --- a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md +++ b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md @@ -101,8 +101,9 @@ revert the swap only if CI stops working. - **Keep warm machines ready.** Jobs would start faster. Warm machines cost money while idle. - **Pay for a Docker Team or Pro plan.** Either plan removes the pull limit. - Billed yearly, Team costs $15 a user a month and Pro costs $9. A Team plan - also gives a token that belongs to the organisation, not to one person. + Billed yearly, Team costs $15 a user a month, for at least 2 users. Pro + costs $9 a month. A Team plan also gives a token that belongs to the + organisation, not to one person. ## Consequences @@ -117,7 +118,10 @@ revert the swap only if CI stops working. - Each RunsOn machine has its own public address. Docker Hub still refused anonymous pulls in the October 2026 trial, so jobs log in. - The free Docker Hub account allows 200 pulls in 6 hours, for all jobs - together. In busy hours, jobs can reach that limit, and their pulls fail. + together. That figure comes from Docker's documentation, at + https://docs.docker.com/docker-hub/usage/pulls/. Docker's pricing page + says 100 pulls an hour instead. In busy hours, jobs can reach the limit, + and their pulls fail. - A pull request from a fork runs its code on a machine in our AWS account. So this repository requires approval before any outside contributor's workflows run. diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 9564c14297..5642f94d09 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -457,7 +457,7 @@ Expected: the two gnu legs and the wrapper job pass. The musl leg fails as it do Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view <run-id> --log-failed`. - **Killed for lack of memory:** the log shows exit code 137, "Killed", or "signal: 9, SIGKILL". Change that job's `family=c8a+m8a` to `family=m8a`. Run `pnpm run test:scripts`, then commit with the message `ci(runners): give <job name> 4 GB per vCPU on m8a`, and push. -- **`toomanyrequests` from Docker Hub:** report the job to the user. The secrets may not exist yet. Or the jobs may have used all 200 pulls that the free account allows in 6 hours. +- **`toomanyrequests` from Docker Hub:** report the job to the user. The secrets may not exist yet. Or the jobs may have used all 200 pulls that the free account allows in 6 hours. ADR 0004 names the source of that figure. - **Any other failure:** compare it with the same job's latest run on `main`. Report it to the user with an excerpt from each log. ### Task 6: Record the decision and this plan in #1416 From e62c904d23d62dfcd56b079dc7380822516bbc97 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 01:53:48 +1100 Subject: [PATCH 09/25] docs(ci): link ADR 0004 to the decision it supersedes ADR 0002's front matter says it is superseded by ADR-0004. ADR 0004 did not name ADR 0002 in its own front matter. The two now name each other, in the form the stack-encrypt ADRs use. --- docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md index 40f4e82516..e79df97827 100644 --- a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md +++ b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md @@ -1,5 +1,6 @@ --- status: accepted +supersedes: ADR-0002 --- # Swap Blacksmith for RunsOn machines of the same size From f25734145f18aacf8bc9b637c4849cac08da6872 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 01:53:48 +1100 Subject: [PATCH 10/25] docs(ci): name the rebased commit that finished Task 6 The plan named 6d0933ccd as the commit that finished Task 6. Rebasing this branch onto main gave that commit a new hash, 1d4768b09. The old hash is no longer on the branch. --- .../plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 5642f94d09..89a6a4f759 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -462,7 +462,7 @@ Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view < ### Task 6: Record the decision and this plan in #1416 -This task is done. Commit `6d0933ccd` on #1416 made these changes. +This task is done. Commit `1d4768b09` on #1416 made these changes. **Files:** - Modify: `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`, to `status: accepted` From 441690c3827a0fd001602f5778c77277feb84593 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:06:52 +1100 Subject: [PATCH 11/25] docs(ci): record why the swap keeps the free Docker Hub account ADR 0004 listed a paid Docker plan as an option without saying why we did not take it. We keep the free account because the swap is meant to reduce costs, and because it is an experiment to prove that RunsOn is viable here. --- docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md index e79df97827..6382fd8756 100644 --- a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md +++ b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md @@ -104,7 +104,9 @@ revert the swap only if CI stops working. - **Pay for a Docker Team or Pro plan.** Either plan removes the pull limit. Billed yearly, Team costs $15 a user a month, for at least 2 users. Pro costs $9 a month. A Team plan also gives a token that belongs to the - organisation, not to one person. + organisation, not to one person. We keep the free account, for two + reasons. The swap is meant to reduce costs. It is also an experiment to + prove that RunsOn is viable for this repository. ## Consequences From 2c0010d15ead88bf2310d4dcc8606d3127c4c0d0 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:14:13 +1100 Subject: [PATCH 12/25] docs(ci): say a push check runs only when its trigger paths change The glossary said a push check runs on every PR push. The trigger paths and selector job entries say otherwise: the selector job skips a check whose trigger paths the change does not touch. The definition now says so. --- .github/CONTEXT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index 983954d7bd..c89aa9ee5a 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -20,8 +20,8 @@ again. _Avoid_: PR run, CI run **Push check**: -A check that runs on every PR push, so the author learns of a failure while -still working on the change. +A check that runs on each PR push, if the change touches its trigger paths. +The author then learns of a failure while still working on the change. _Avoid_: fast check, PR check **Gate check**: From 3877e5f62325521f59ae4e4eb73f8bff422a9f94 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:14:29 +1100 Subject: [PATCH 13/25] docs(ci): say that no part of ADR 0003 is built yet The glossary told authors to add the ci:full label for an early run. No workflow reads that label: there is no labeled trigger, no merge queue rule on main, and no rule at all on next. The early run entry now says so. ADR 0003's paused note now says that none of the decision is built, so a reader can tell the plan from current CI. --- .github/CONTEXT.md | 3 ++- ...expensive-ci-checks-run-in-merge-queues-on-main-and-next.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index c89aa9ee5a..abbb3b8963 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -34,7 +34,8 @@ _Avoid_: heavy check, full CI, merge check **Early run**: A run of the gate checks on a pull request before it joins a merge queue. An author asks for one by adding the `ci:full` label. Each time the label is -added gives one early run. +added gives one early run. No workflow reads the label yet, because work on +ADR 0003 is paused. _Avoid_: full run, ci:full run **Queue commit**: diff --git a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md index 06bec18ff8..2afee516a6 100644 --- a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md +++ b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md @@ -5,7 +5,7 @@ status: accepted # Run the expensive CI checks in merge queues on `main` and `next` > Work on this decision paused in November 2026, until the same-size swap in -> ADR 0004 is in place. +> ADR 0004 is in place. None of this decision has been built yet. We decided in October 2026 to split this repository's CI checks into push checks and gate checks. Push checks run on every push to a pull request. Gate From f83ad4c865ca2c321e6118d43a73910a30e03ea4 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:14:42 +1100 Subject: [PATCH 14/25] docs(ci): say a later run can replace a failed early run's result ADR 0003 said a label run cannot hide an earlier failure. That holds for push checks only. The early run removes the ci:full label, so a later push or label run skips the gate checks. Its summary job can then pass, and GitHub counts the newest result for that check name. The early runs section now states this. The Mutants bullet that said a pull request waits for Mutants to run again now names the same case. The ADR adds no mechanism, because nobody has decided one. --- ...e-ci-checks-run-in-merge-queues-on-main-and-next.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md index 2afee516a6..f7834209fc 100644 --- a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md +++ b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md @@ -87,8 +87,11 @@ is a deliberate request. The queue still runs the gate checks again. GitHub cannot start a workflow on one label only, so every workflow starts when any label is added. On every such run, the selector job selects the push checks again, and the gate checks too for `ci:full`. GitHub counts the newest -result for a check name. So a label run gives fresh results and cannot hide an -earlier failure. +result for a check name. So a label run gives fresh push check results. It +cannot hide an earlier push check failure. + +A later push or label run without `ci:full` skips the gate checks. If its +summary job passes, that result replaces the failed result of an early run. ## Mutants @@ -101,7 +104,8 @@ earlier failure. - It starts at the same time as the push checks, in the queue and on early runs. A watcher job cancels it when a push check fails. - On an early run, a cancelled Mutants run counts as a failure. The pull - request cannot join the queue until Mutants runs again. + request cannot join the queue until Mutants runs again, or a later push or + label run replaces the result. - The other heavy gate checks also start at once. ## Considered options From ad01a97b6ca6e5e7e8861dd910681c0a5cf058c3 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:14:53 +1100 Subject: [PATCH 15/25] docs(ci): say the same-size swap can add steps The glossary and ADR 0004 both said the jobs' steps stay the same. ADR 0004's own "What changes" section adds a Docker Hub login before each image pull, and the plan adds a wait for the apt lock. Both documents no longer say that steps stay the same. The glossary now says the swap can add steps. --- .github/CONTEXT.md | 3 ++- docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index abbb3b8963..9b585716c1 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -84,7 +84,8 @@ _Avoid_: big job, 16-core job **Same-size swap**: The change that moves each Blacksmith job to a RunsOn machine with the same vCPU count, architecture, and Ubuntu version. Memory and disk may be smaller. -The job's triggers and steps stay the same. +The job's triggers stay the same. The swap can add steps, such as a Docker Hub +login before an image pull. _Avoid_: like-for-like replacement, migration ## Relationships diff --git a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md index 6382fd8756..d07ae37053 100644 --- a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md +++ b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md @@ -7,8 +7,8 @@ supersedes: ADR-0002 In November 2026 we decided to move every Blacksmith job in this repository to RunsOn. Each job gets the same vCPU count, architecture, and Ubuntu version. -`.github/CONTEXT.md` calls this a same-size swap. Nothing else about the jobs -changes: their triggers, steps, and trigger paths stay as they are. +`.github/CONTEXT.md` calls this a same-size swap. The jobs' triggers and +trigger paths stay as they are. We made the change to cut cost at once. At November 2026's pace, CI for this repository costs about $3,470 a month on Blacksmith. On RunsOn machines of the From 109f6e9d4c8de9950a4afbd4a14aeaf7e69801e3 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:15:06 +1100 Subject: [PATCH 16/25] docs(ci): push the merge commit when Task 1 resolved a conflict Task 1 merges main into the #1427 branch. Step 5 pushed nothing when the test passed. After a conflict, though, the resolved merge commit exists only locally, and the pull request still shows the conflict. Step 5 now pushes in that case. --- .../plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 89a6a4f759..21b07cb12e 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -95,7 +95,7 @@ Run: the command in Step 2. Expected: PASS. - [ ] **Step 5: Commit and push** -If Step 2 passed, push nothing, because the pull request already merges cleanly. Otherwise: +If Step 1 had no conflict and Step 2 passed, push nothing, because the pull request already merges cleanly. If Step 1 had a conflict and Step 2 passed, run `git push` to publish the merge commit. Otherwise: ```bash git add .github/workflows From f19bc9246ca33df040f4e5b1e2b0082ca1bb6bb2 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:15:19 +1100 Subject: [PATCH 17/25] docs(ci): say the apt lock option does not cover apt-get update The plan said Task 4's test makes every apt command wait for the lock. DPkg::Lock::Timeout applies to the dpkg frontend lock only. apt-get update takes the package-list lock, which apt locks with a single non-blocking fcntl call and no timeout. Evidence: apt-pkg/acquire.cc GetLock and contrib/fileutl.cc GetLock in apt 2.4.13, 2.7.14 and 2.8.2. debsystem.cc reads the option for the frontend lock only. A local test with apt 3.2.1 agrees: with the package-list lock held, apt-get update failed at once. With the frontend lock held, apt-get check waited the full timeout. The plan now states this limit. It does not choose a way to make apt-get update wait, because nobody has decided one. --- .../plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 21b07cb12e..263d79c880 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -41,7 +41,7 @@ These are not tasks for the executor, and no task waits for them. Until the secr 1. **A reusable workflow whose caller passes no secrets.** In a called workflow, `secrets.*` is empty unless the caller passes it. The login would skip. The job would then pull anonymously without an error. Task 3 adds a test that every such caller passes both secrets. 2. **A RunsOn runner chosen by a matrix.** The FFI `binaries` job takes its runner from `matrix.cfg.os`. The login test from #1419 checks only jobs with a literal `runs-on=` label. So it would miss the musl build. That build pulls Alpine from Docker Hub. Task 2 lists each matrix runner job, and Task 3 checks the RunsOn ones. -3. **apt on a fresh machine.** A new RunsOn machine can still be running apt from boot. `apt-get` then fails at once on the held lock. Task 4 adds a test that every apt command in a RunsOn job waits for the lock. +3. **apt on a fresh machine.** A new RunsOn machine can still be running apt from boot. `apt-get` then fails at once on the held lock. Task 4 adds a test that every apt command in a RunsOn job sets `DPkg::Lock::Timeout`. That option does not make `apt-get update` wait, as Task 4 explains. 4. **A label of the wrong size.** #1419 used `cpu=8`. A label left at `cpu=8` would give a job the wrong machine. A label with no run ID would be shared by every run. Task 2's tests accept only the labels in Global Constraints, and refuse an FFI label with no run ID. 5. **A 16 vCPU job that needs more than 32 GB.** No repository test can show this. The pull request's own CI run is the test. Task 5 watches it and applies the `m8a` rule to any job killed for lack of memory. @@ -362,6 +362,8 @@ git commit -S -m "ci(runners): log in to Docker Hub before every RunsOn job pull #1419 added `-o DPkg::Lock::Timeout=300` to the two `apt-get` steps that run on RunsOn. Nothing yet stops a new step without it. +`DPkg::Lock::Timeout` makes apt wait for the dpkg lock only. `apt-get update` takes the package-list lock instead. It does not wait for that lock, with or without the option. So `apt-get update` can still fail at once on a fresh machine. + **Files:** - Modify: `scripts/__tests__/workflow-runs-on.test.mjs` - Modify: each workflow or local action the test lists. None is expected. From dfe113988f59b4ebb487e93d8f24573028ebdf86 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:19:14 +1100 Subject: [PATCH 18/25] docs(ci): say that neither main nor next has a merge queue yet The Gate check entry said that main and next each have a merge queue. Neither branch has one: main's rules are deletion, pull_request, non_fast_forward and required_signatures, and next has no rules. ADR 0003 plans both queues, and work on it is paused. CodeRabbit listed this outside the diff range of its review. --- .github/CONTEXT.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index 9b585716c1..d7af989708 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -26,9 +26,9 @@ _Avoid_: fast check, PR check **Gate check**: A check that runs when a pull request is in a merge queue, instead of on every -PR push. `main` and `next` each have a merge queue. An author can ask for a -gate check to run earlier on the pull request. A failed gate check blocks the -merge. +PR push. A failed gate check blocks the merge. ADR 0003 plans a merge queue +for `main` and one for `next`, and neither exists yet. Under ADR 0003, an +author can ask for a gate check to run earlier on the pull request. _Avoid_: heavy check, full CI, merge check **Early run**: From 1877ca1e99e4f53d7cb435d792675fe7fdef13eb Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 02:22:56 +1100 Subject: [PATCH 19/25] docs(ci): say how #1419 retries apt-get update The plan said DPkg::Lock::Timeout does not make apt-get update wait, and named no fix. Commit b283c2234 on #1419 now retries each apt-get update, and its guard test fails on an update that is not retried. --- .../plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 263d79c880..58c98db6f9 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -41,7 +41,7 @@ These are not tasks for the executor, and no task waits for them. Until the secr 1. **A reusable workflow whose caller passes no secrets.** In a called workflow, `secrets.*` is empty unless the caller passes it. The login would skip. The job would then pull anonymously without an error. Task 3 adds a test that every such caller passes both secrets. 2. **A RunsOn runner chosen by a matrix.** The FFI `binaries` job takes its runner from `matrix.cfg.os`. The login test from #1419 checks only jobs with a literal `runs-on=` label. So it would miss the musl build. That build pulls Alpine from Docker Hub. Task 2 lists each matrix runner job, and Task 3 checks the RunsOn ones. -3. **apt on a fresh machine.** A new RunsOn machine can still be running apt from boot. `apt-get` then fails at once on the held lock. Task 4 adds a test that every apt command in a RunsOn job sets `DPkg::Lock::Timeout`. That option does not make `apt-get update` wait, as Task 4 explains. +3. **apt on a fresh machine.** A new RunsOn machine can still be running apt from boot. `apt-get` then fails at once on the held lock. Task 4 adds a test that every apt command in a RunsOn job sets `DPkg::Lock::Timeout`. That option does not make `apt-get update` wait, so #1419 also retries each `apt-get update`, as Task 4 explains. 4. **A label of the wrong size.** #1419 used `cpu=8`. A label left at `cpu=8` would give a job the wrong machine. A label with no run ID would be shared by every run. Task 2's tests accept only the labels in Global Constraints, and refuse an FFI label with no run ID. 5. **A 16 vCPU job that needs more than 32 GB.** No repository test can show this. The pull request's own CI run is the test. Task 5 watches it and applies the `m8a` rule to any job killed for lack of memory. @@ -364,6 +364,8 @@ git commit -S -m "ci(runners): log in to Docker Hub before every RunsOn job pull `DPkg::Lock::Timeout` makes apt wait for the dpkg lock only. `apt-get update` takes the package-list lock instead. It does not wait for that lock, with or without the option. So `apt-get update` can still fail at once on a fresh machine. +Commit b283c2234 on #1419 handles this. Each `apt-get update` runs in a loop of up to 20 tries, 15 seconds apart, that ends with `&& break`. `aptFinding` also fails on an `apt-get update` line without `&& break`. + **Files:** - Modify: `scripts/__tests__/workflow-runs-on.test.mjs` - Modify: each workflow or local action the test lists. None is expected. From 74f9c340e5dbc4f6012079671b10db621acf27fc Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 15:53:45 +1100 Subject: [PATCH 20/25] docs(ci): name the plan's cited commits by subject, not hash The plan named two commits by hashes that are on no branch now. - Commit b283c2234 was #1419's apt-get update fix before #1419 was rebased. - Commit c1985b4a8 was #1427's timeout commit before #1427 was rebased. In a new clone, git show fails on both hashes. A rebase changes a commit's hash. It keeps the commit's subject. So the plan now names each commit by its pull request and its subject. --- .../plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 58c98db6f9..bef72b2bbf 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -87,7 +87,7 @@ Expected: PASS, or FAIL with a list of `<file>#<job>` references that have no li - [ ] **Step 3: Give each listed job a limit** -Use the rule from commit `c1985b4a8`. The limit is about twice the job's longest successful run in the last 30 days. Round it up to a multiple of 5 minutes, with a floor of 10. Read run times with `gh run list --workflow <file> --status success --limit 50 --json databaseId` and `gh run view <id> --json jobs`. +Use the rule from #1427's commit `ci(timeouts): set timeout-minutes on every job`. The limit is about twice the job's longest successful run in the last 30 days. Round it up to a multiple of 5 minutes, with a floor of 10. Read run times with `gh run list --workflow <file> --status success --limit 50 --json databaseId` and `gh run view <id> --json jobs`. - [ ] **Step 4: Run the test again** @@ -364,7 +364,7 @@ git commit -S -m "ci(runners): log in to Docker Hub before every RunsOn job pull `DPkg::Lock::Timeout` makes apt wait for the dpkg lock only. `apt-get update` takes the package-list lock instead. It does not wait for that lock, with or without the option. So `apt-get update` can still fail at once on a fresh machine. -Commit b283c2234 on #1419 handles this. Each `apt-get update` runs in a loop of up to 20 tries, 15 seconds apart, that ends with `&& break`. `aptFinding` also fails on an `apt-get update` line without `&& break`. +#1419's commit `ci(runners): retry apt-get update until boot-time apt lets go` handles this. Each `apt-get update` runs in a loop of up to 20 tries, 15 seconds apart, that ends with `&& break`. `aptFinding` also fails on an `apt-get update` line without `&& break`. **Files:** - Modify: `scripts/__tests__/workflow-runs-on.test.mjs` From 0af29e92f22845790876eb3c52d1cc74f95027f8 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 19:28:25 +1100 Subject: [PATCH 21/25] docs(ci): mark the plan's finished tasks and fix two wrong claims Tasks 1 to 5 are finished, so their steps are ticked. Each task now says how it was done, in the form Task 6 already uses. Commits are named by subject, so a rebase cannot make the names wrong. The plan said branch rules require some job names. They do not. GitHub's API shows no required status checks on main. Job names still stay the same, because ADR 0004 changes only each job's machine. Task 5 expected the FFI wrapper job to pass while the musl build fails. The wrapper job needs every build, so it is skipped instead. GitHub Actions run 45574782571 shows this. --- ...19-same-size-swap-blacksmith-to-runs-on.md | 86 +++++++++++-------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index bef72b2bbf..029838931a 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -19,7 +19,7 @@ - Every job that names a Blacksmith label moves. On `main` at `0a0fb63ec`, that is 55 job definitions in 27 workflows. Of these, 31 have 16 vCPUs. The other 24 have 4 vCPUs. - The three Linux platforms of the FFI release matrix move too. `scripts/ffi-release-matrix.mjs` gives them their label, with the run ID passed in. - Jobs on GitHub-hosted runners stay where they are. -- Job IDs, job names, triggers, trigger paths, and existing steps stay the same. Branch rules require some job names, so a renamed job would leave a required check waiting. +- Job IDs, job names, triggers, trigger paths, and existing steps stay the same. - The swap adds three things only: Docker Hub logins, a wait for the apt lock, and two secrets for one reusable workflow. - The login reads `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD`. It does nothing when either secret is empty, as on a pull request from a fork. - #1427 sets the time limits. It merges before #1419. @@ -57,6 +57,8 @@ These are not tasks for the executor, and no task waits for them. Until the secr ### Task 1: Bring #1427 up to date with `main` +This task is done another way. Pull request #1427 was rebased onto `main` instead of merging `main` into it. It merged into `main` as 11db0ef99 on 20 November 2026. + #1427 sets `timeout-minutes` on every job, and its test fails when a job has none. Jobs added to `main` since 28 October may have no limit. **Files:** @@ -67,7 +69,7 @@ These are not tasks for the executor, and no task waits for them. Until the secr - Consumes: nothing - Produces: branch `ci/job-timeouts`. It merges into `main` with its test passing. -- [ ] **Step 1: Merge `main` into the branch** +- [x] **Step 1: Merge `main` into the branch** Create a worktree for `ci/job-timeouts` with the superpowers:using-git-worktrees skill. In it, run: @@ -79,21 +81,21 @@ pnpm install --frozen-lockfile Expected: the merge completes. On a conflict, keep `main`'s lines and add the branch's `timeout-minutes` line to the job. -- [ ] **Step 2: Run the test** +- [x] **Step 2: Run the test** Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-job-timeouts.test.mjs` Expected: PASS, or FAIL with a list of `<file>#<job>` references that have no limit. -- [ ] **Step 3: Give each listed job a limit** +- [x] **Step 3: Give each listed job a limit** Use the rule from #1427's commit `ci(timeouts): set timeout-minutes on every job`. The limit is about twice the job's longest successful run in the last 30 days. Round it up to a multiple of 5 minutes, with a floor of 10. Read run times with `gh run list --workflow <file> --status success --limit 50 --json databaseId` and `gh run view <id> --json jobs`. -- [ ] **Step 4: Run the test again** +- [x] **Step 4: Run the test again** Run: the command in Step 2. Expected: PASS. -- [ ] **Step 5: Commit and push** +- [x] **Step 5: Commit and push** If Step 1 had no conflict and Step 2 passed, push nothing, because the pull request already merges cleanly. If Step 1 had a conflict and Step 2 passed, run `git push` to publish the merge commit. Otherwise: @@ -107,6 +109,8 @@ Then tell the user that #1427 is ready for them to merge. ### Task 2: Swap every runner label +This task is done. #1419's commit `ci(runners): move every Blacksmith job to a RunsOn machine of the same size` made these changes. #1419 was rebased onto #1416's branch instead of merging `main` into it. + **Files:** - Create: `scripts/__tests__/lib/runs-on.mjs` - Create: `scripts/__tests__/workflow-runs-on.test.mjs` @@ -125,7 +129,7 @@ Then tell the user that #1427 is ready for them to merge. - `isRunsOnJob(job: object, ref?: string): boolean`. It is true when `job['runs-on']` is a string that starts with `runs-on=`. It is also true when `MATRIX_RUNNERS[ref]?.runsOn` is true. - Produces, in `scripts/ffi-release-matrix.mjs`: `runnerFor(platform: string, runId = process.env.GITHUB_RUN_ID): string` and `releaseMatrix(triples, runId = process.env.GITHUB_RUN_ID)`. -- [ ] **Step 1: Merge `main` into #1419's branch** +- [x] **Step 1: Merge `main` into #1419's branch** The branch `ci/heavy-jobs-runs-on` already has a worktree, at `.claude/worktrees/agent-a7c8ac844ed823b0f`. Check that `git status` is clean there. Then run: @@ -138,7 +142,7 @@ pnpm run test:scripts Expected: PASS. Resolve each conflict by keeping `main`'s lines, plus the branch's `runs-on:`, Docker Hub login, and apt lock changes. A test failure at this step comes from the merge, so fix it before going on. -- [ ] **Step 2: Write `scripts/__tests__/lib/runs-on.mjs`** +- [x] **Step 2: Write `scripts/__tests__/lib/runs-on.mjs`** Implement the interface above. `MATRIX_RUNNERS` contains exactly these entries: @@ -159,7 +163,7 @@ export const MATRIX_RUNNERS = { } ``` -- [ ] **Step 3: Write the failing tests in `scripts/__tests__/workflow-runs-on.test.mjs`** +- [x] **Step 3: Write the failing tests in `scripts/__tests__/workflow-runs-on.test.mjs`** Read every job with `workflowFiles()` and `readWorkflow()`, as `{ ref: '<file>#<id>', job }`. Two local helpers return references. `refsWhere(predicate)` returns the `ref` of each job that matches. `expressionRunnerRefs()` returns the `ref` of each job whose runner comes from an expression. @@ -199,7 +203,7 @@ describe('RunsOn runner labels', () => { Each string that contains `${{` needs the `biome-ignore lint/suspicious/noTemplateCurlyInString` comment that `workflow-mise-cache-image.test.mjs` uses. -- [ ] **Step 4: Update `scripts/__tests__/ffi-release-matrix.test.mjs`** +- [x] **Step 4: Update `scripts/__tests__/ffi-release-matrix.test.mjs`** Import `runsOnLabel` from `./lib/runs-on.mjs`. Set `const RUN_ID = '1234'`, `const MATRIX = releaseMatrix(TRIPLES, RUN_ID)`, and `const RUNS_ON_4 = runsOnLabel(4, { runId: RUN_ID })`. Then: @@ -208,13 +212,13 @@ Import `runsOnLabel` from `./lib/runs-on.mjs`. Set `const RUN_ID = '1234'`, `con - Keep the test that refuses an empty run ID: `expect(() => runnerFor('linux-x64-gnu', '')).toThrow(/GITHUB_RUN_ID/)`. - Add `expect(runnerFor('darwin-x64', '')).toBe('macos-latest')`, because only a RunsOn label needs the run ID. -- [ ] **Step 5: Run both tests to see them fail** +- [x] **Step 5: Run both tests to see them fail** Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-runs-on.test.mjs scripts/__tests__/ffi-release-matrix.test.mjs` Expected: FAIL. "names no Blacksmith label" lists the jobs still on Blacksmith. "uses only the labels ADR 0004 names" lists the `cpu=8` jobs. The FFI test shows `cpu=8` labels, and a Blacksmith label for musl. -- [ ] **Step 6: Replace the labels in the workflows** +- [x] **Step 6: Replace the labels in the workflows** ```bash sed -i \ @@ -229,13 +233,13 @@ The last two lines undo #1419's sizes. On `main`, every 16 vCPU label is Ubuntu The publish jobs get `extras=s3-cache` too. It has no effect in a job with no cache step. `scripts/lint-no-workflow-caching.mjs` keeps the publish jobs free of cache steps. -- [ ] **Step 7: Change `runnerFor` in `scripts/ffi-release-matrix.mjs`** +- [x] **Step 7: Change `runnerFor` in `scripts/ffi-release-matrix.mjs`** A `win32` platform gives `windows-latest`, and a `darwin` platform gives `macos-latest`. Neither needs the run ID. Every other platform gives the 4 vCPU label, with the run ID in place of the expression. An empty run ID throws an error that names `GITHUB_RUN_ID`. Rewrite the doc comment to say three things. Darwin and Windows need GitHub-hosted images for their SDKs. Every Linux platform builds on a RunsOn machine with 4 vCPUs, its size on Blacksmith. A matrix value cannot read `${{ github.run_id }}`, so the run ID is passed in. Remove #1419's sentences about build times and about musl staying on Blacksmith. -- [ ] **Step 8: Empty the self-hosted label list in `.github/actionlint.yaml`** +- [x] **Step 8: Empty the self-hosted label list in `.github/actionlint.yaml`** Replace the file's content with: @@ -253,19 +257,19 @@ self-hosted-runner: In `.github/workflows/lint-release.yml`, change "for the Blacksmith runner label" at line 9 to "for its self-hosted runner labels". Change "the config it resolves the Blacksmith label from" at line 22 to "the config it reads runner labels from". -- [ ] **Step 9: Run the tests to see them pass** +- [x] **Step 9: Run the tests to see them pass** Run: `pnpm run test:scripts` Expected: PASS, with one exception. `workflow-docker-hub-login.test.mjs` now checks every moved job, and lists those that pull an image with no login. Task 3 adds those logins. `workflow-mise-cache-image.test.mjs` passes, because each job keeps its Ubuntu version. -- [ ] **Step 10: Run actionlint on the release workflows** +- [x] **Step 10: Run actionlint on the release workflows** Run the `actionlint` command from the "actionlint (release workflows)" step of `lint-release.yml`. Start it with `mise x go -- go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7` in place of `actionlint`. Expected: no output, and exit code 0. The release workflows now carry RunsOn labels, so this also shows that actionlint skips a label with an expression. -- [ ] **Step 11: Check the counts and what is left** +- [x] **Step 11: Check the counts and what is left** ```bash git grep -h 'runs-on: blacksmith-16vcpu-ubuntu-2204' origin/main -- .github/workflows | wc -l @@ -277,7 +281,7 @@ git grep -n -E 'cpu=8|blacksmith-' -- .github scripts/ffi-release-matrix.mjs Expected: the first two numbers match, and so do the next two. At `0a0fb63ec` they were 31 and 24. The last command lists only comments. They say why some jobs use GitHub-hosted runners, and one names an arm64 label in `_build-auth-artifacts.yml`. -- [ ] **Step 12: Commit** +- [x] **Step 12: Commit** ```bash git add .github scripts @@ -286,6 +290,8 @@ git commit -S -m "ci(runners): move every Blacksmith job to a RunsOn machine of ### Task 3: Log in to Docker Hub on every RunsOn job that pulls an image +This task is done. Two #1419 commits made these changes: `ci(runners): log in to Docker Hub before every RunsOn job pulls an image` and `ci(runners): log in before the README walkthrough pulls its database`. + **Files:** - Modify: `scripts/__tests__/workflow-docker-hub-login.test.mjs` - Modify: each workflow the test lists @@ -297,7 +303,7 @@ git commit -S -m "ci(runners): move every Blacksmith job to a RunsOn machine of - `jobFindings(where: string, job: object, ref?: string): string[]`. Its RunsOn check becomes `isRunsOnJob(job, ref)`. - `callerFinding(job: object): string | null`. It returns null when `job.secrets` is `'inherit'`. It also returns null when `job.secrets` maps `DOCKER_HUB_USERNAME` to `${{ secrets.DOCKER_HUB_USERNAME }}` and `DOCKER_HUB_PASSWORD` to `${{ secrets.DOCKER_HUB_PASSWORD }}`. Otherwise it returns a message that names each missing secret. -- [ ] **Step 1: Write the failing tests** +- [x] **Step 1: Write the failing tests** In `workflow-docker-hub-login.test.mjs`: @@ -316,17 +322,17 @@ expect(jobFindings('w j', { 'runs-on': '${{ matrix.cfg.os }}', steps: [up] }, '. .toEqual([expect.stringMatching(/no Docker Hub login comes before it/)]) ``` -- [ ] **Step 2: Run the test to see it fail** +- [x] **Step 2: Run the test to see it fail** Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-docker-hub-login.test.mjs` Expected: FAIL. "logs in before every pull" lists each job that pulls an image with no login before it. The list includes `_build-ffi-artifacts.yml binaries`. -- [ ] **Step 3: Add a login before each pull the test lists** +- [x] **Step 3: Add a login before each pull the test lists** Copy the "Log in to Docker Hub" step, with its comment, from a `test-eql.yml` job that has one. Put it right before the step that the finding names. A service or job container from Docker Hub instead gets the `credentials:` expression and comment from the `encryption-postgres` service in `test-eql.yml`. -- [ ] **Step 4: Give the musl FFI build its login and its secrets** +- [x] **Step 4: Give the musl FFI build its login and its secrets** In `.github/workflows/_build-ffi-artifacts.yml`: @@ -343,15 +349,15 @@ In `release.yml`, in the job that calls `_build-ffi-artifacts.yml`, pass both se Pass these two by name, not with `secrets: inherit`. The called workflow then receives no other secret of the release workflow. -- [ ] **Step 5: Run the tests to see them pass** +- [x] **Step 5: Run the tests to see them pass** Run: `pnpm run test:scripts`. Expected: PASS. -- [ ] **Step 6: Run actionlint on the release workflows** +- [x] **Step 6: Run actionlint on the release workflows** Run: the command in Task 2, Step 10. Expected: no output, and exit code 0. actionlint fails when a caller passes a secret that the called workflow does not declare. -- [ ] **Step 7: Commit** +- [x] **Step 7: Commit** ```bash git add .github scripts @@ -360,6 +366,8 @@ git commit -S -m "ci(runners): log in to Docker Hub before every RunsOn job pull ### Task 4: Wait for the apt lock on every RunsOn job +This task is done. Two #1419 commits made these changes: `test(ci): require every RunsOn job to wait for the apt lock` and `ci(runners): retry apt-get update until boot-time apt lets go`. + #1419 added `-o DPkg::Lock::Timeout=300` to the two `apt-get` steps that run on RunsOn. Nothing yet stops a new step without it. `DPkg::Lock::Timeout` makes apt wait for the dpkg lock only. `apt-get update` takes the package-list lock instead. It does not wait for that lock, with or without the option. So `apt-get update` can still fail at once on a fresh machine. @@ -374,7 +382,7 @@ git commit -S -m "ci(runners): log in to Docker Hub before every RunsOn job pull - Consumes: `isRunsOnJob(job, ref)`, made in Task 2. - Produces: `aptFinding(run: string): string | null`, exported from `workflow-runs-on.test.mjs`. It ignores comment lines. It looks for a line that runs `apt` or `apt-get` with `update`, `install`, `upgrade`, `dist-upgrade`, `remove`, `purge`, or `autoremove`. When such a line has no `DPkg::Lock::Timeout=`, it returns a message that names the line. Otherwise it returns null. -- [ ] **Step 1: Write the failing tests** +- [x] **Step 1: Write the failing tests** ```js it('recognises an apt command that does not wait for the lock', () => { @@ -393,21 +401,21 @@ it('waits for the apt lock in every RunsOn job', () => { }) ``` -- [ ] **Step 2: Run the tests to see them fail** +- [x] **Step 2: Run the tests to see them fail** Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-runs-on.test.mjs` Expected: FAIL with "aptFinding is not defined". -- [ ] **Step 3: Implement `aptFinding` and `aptFindingsInRunsOnJobs`** +- [x] **Step 3: Implement `aptFinding` and `aptFindingsInRunsOnJobs`** `aptFindingsInRunsOnJobs()` returns one `<file>#<job> step <n>: <finding>` string for each step that `aptFinding` reports. -- [ ] **Step 4: Run the tests to see them pass** +- [x] **Step 4: Run the tests to see them pass** Run: the command in Step 2. Expected: PASS. If the second test lists a step, add `-o DPkg::Lock::Timeout=300` after each `apt-get` in that step. -- [ ] **Step 5: Commit** +- [x] **Step 5: Commit** ```bash git add scripts .github @@ -416,9 +424,11 @@ git commit -S -m "test(ci): require every RunsOn job to wait for the apt lock" ### Task 5: Check the branch, and update #1419 +This task is done. The FFI run in Step 5 is GitHub Actions run 45574782571, from 25 November 2026. + **Files:** no new files. -- [ ] **Step 1: Run the checks that CI runs on these files** +- [x] **Step 1: Run the checks that CI runs on these files** ```bash pnpm run test:scripts @@ -428,25 +438,25 @@ pnpm run code:check Expected: all three pass. `code:check` fails on errors only, and may print warnings. -- [ ] **Step 2: Check that no job name changed** +- [x] **Step 2: Check that no job name changed** ```bash git diff origin/main -U0 -- .github/workflows | grep -E '^[-+][[:space:]]+(- )?name:' ``` -Expected: only added lines that read `+ - name: Log in to Docker Hub`. A removed or changed job `name:` would leave a required check waiting. +Expected: only added lines that read `+ - name: Log in to Docker Hub`. A removed or changed job `name:` means the diff changes more than ADR 0004 allows. -- [ ] **Step 3: Push** +- [x] **Step 3: Push** Run: `git push origin ci/heavy-jobs-runs-on` Expected: a normal push. If git refuses because the remote branch moved, stop and tell the user. -- [ ] **Step 4: Update the title and body of #1419** +- [x] **Step 4: Update the title and body of #1419** Use the meta-pr-creation skill. The title is `ci(runners): move every Blacksmith job to a RunsOn machine of the same size`. The body says what changes, why, and how to check it. It points to ADR 0004 for the cost reasons. Keep the pull request a draft, and set both with `gh pr edit 1419 --title <title> --body-file <file>`. -- [ ] **Step 5: Run the FFI build on RunsOn** +- [x] **Step 5: Run the FFI build on RunsOn** The release workflows do not run on a pull request. `ffi-preflight.yml` runs the FFI build without publishing anything: @@ -454,9 +464,9 @@ The release workflows do not run on a pull request. `ffi-preflight.yml` runs the gh workflow run ffi-preflight.yml --ref ci/heavy-jobs-runs-on -f ref=ci/heavy-jobs-runs-on ``` -Expected: the two gnu legs and the wrapper job pass. The musl leg fails as it does on `main`, for the reason in #1380. +Expected: the two gnu legs pass. The musl leg fails as it does on `main`, for the reason in #1380. The wrapper job is skipped, because it needs the musl leg. -- [ ] **Step 6: Watch the pull request's CI run** +- [x] **Step 6: Watch the pull request's CI run** Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view <run-id> --log-failed`. From bc4c0375710e335ed894a4392974ea355a2bea4c Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 19:32:22 +1100 Subject: [PATCH 22/25] docs(ci): compare job names with the commit where the branch left main Task 5 Step 2 compared the branch with the latest commit on main. Main now has 97 commits that the branch does not have. So that comparison showed main's own changes as if the branch had made them. The three-dot form compares with the commit where the branch left main. On #1419, it shows only the 17 added "Log in to Docker Hub" steps. --- .../plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 029838931a..7c8ffd8eb5 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -441,9 +441,11 @@ Expected: all three pass. `code:check` fails on errors only, and may print warni - [x] **Step 2: Check that no job name changed** ```bash -git diff origin/main -U0 -- .github/workflows | grep -E '^[-+][[:space:]]+(- )?name:' +git diff origin/main...HEAD -U0 -- .github/workflows | grep -E '^[-+][[:space:]]+(- )?name:' ``` +The three dots compare with the commit where the branch left `main`. Without them, the diff also shows `main`'s newer changes, as if the branch had made them. + Expected: only added lines that read `+ - name: Log in to Docker Hub`. A removed or changed job `name:` means the diff changes more than ADR 0004 allows. - [x] **Step 3: Push** From 0c1321469f443dcf34a0bf4745d8c788b7660811 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 20:21:47 +1100 Subject: [PATCH 23/25] docs(ci): name Task 6's commit by subject, not hash Task 6 named commit 1d4768b09. Rebasing #1416 onto main gave that commit a new hash, so the old one is on no branch now. The plan names the other tasks' commits by subject already. A rebase keeps a commit's subject, so Task 6 now does the same. --- .../plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index 7c8ffd8eb5..f923a6fb42 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -478,7 +478,7 @@ Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view < ### Task 6: Record the decision and this plan in #1416 -This task is done. Commit `1d4768b09` on #1416 made these changes. +This task is done. #1416's commit `docs(ci): record the same-size swap from Blacksmith to RunsOn` made these changes. **Files:** - Modify: `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`, to `status: accepted` From 5c0f90d7a358a2bae6aa194fadb2b1adefd5e476 Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 21:18:55 +1100 Subject: [PATCH 24/25] docs(ci): put each paragraph of the ADRs and glossary on one line The three ADRs and .github/CONTEXT.md were wrapped at about 78 characters. The plan put each paragraph on one line. Review fixes then added words without rewrapping, so some wrapped lines were uneven. Each paragraph and list item is now one line in all four files, as in the plan. A later edit then changes only the lines it touches. Only line breaks changed. For each file, markdown-it renders the same HTML before and after, once whitespace is collapsed. The words are the same, apart from one block-quote marker in ADR 0003. The Mermaid diagrams, glossary term lines, and front matter are unchanged. --- .github/CONTEXT.md | 73 ++------ ...ub-hosted-runners-heavy-jobs-on-runs-on.md | 69 ++------ ...ks-run-in-merge-queues-on-main-and-next.md | 164 +++++------------- ...me-size-swap-from-blacksmith-to-runs-on.md | 130 ++++---------- 4 files changed, 113 insertions(+), 323 deletions(-) diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index d7af989708..26cf965f5a 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -1,102 +1,65 @@ # CI -This context covers the checks that verify a change, and the machines that run -them. It covers the GitHub Actions workflows of `cipherstash/stack`. It also -covers the CI spend of the other repositories that share its budget. +This context covers the checks that verify a change, and the machines that run them. It covers the GitHub Actions workflows of `cipherstash/stack`. It also covers the CI spend of the other repositories that share its budget. ## Language **CI budget**: -The most that the repositories sharing it may spend on CI in one calendar -month. Vendor invoices measure it, including fixed costs such as licences and -cloud infrastructure. When an invoice also covers other repositories, only the -part for these repositories counts. List-price estimates track it between -invoices, but do not replace it. +The most that the repositories sharing it may spend on CI in one calendar month. Vendor invoices measure it, including fixed costs such as licences and cloud infrastructure. When an invoice also covers other repositories, only the part for these repositories counts. List-price estimates track it between invoices, but do not replace it. _Avoid_: build minutes, runner minutes **PR push**: -A new head commit on a pull request's branch. Each one starts the push checks -again. +A new head commit on a pull request's branch. Each one starts the push checks again. _Avoid_: PR run, CI run **Push check**: -A check that runs on each PR push, if the change touches its trigger paths. -The author then learns of a failure while still working on the change. +A check that runs on each PR push, if the change touches its trigger paths. The author then learns of a failure while still working on the change. _Avoid_: fast check, PR check **Gate check**: -A check that runs when a pull request is in a merge queue, instead of on every -PR push. A failed gate check blocks the merge. ADR 0003 plans a merge queue -for `main` and one for `next`, and neither exists yet. Under ADR 0003, an -author can ask for a gate check to run earlier on the pull request. +A check that runs when a pull request is in a merge queue, instead of on every PR push. A failed gate check blocks the merge. ADR 0003 plans a merge queue for `main` and one for `next`, and neither exists yet. Under ADR 0003, an author can ask for a gate check to run earlier on the pull request. _Avoid_: heavy check, full CI, merge check **Early run**: -A run of the gate checks on a pull request before it joins a merge queue. An -author asks for one by adding the `ci:full` label. Each time the label is -added gives one early run. No workflow reads the label yet, because work on -ADR 0003 is paused. +A run of the gate checks on a pull request before it joins a merge queue. An author asks for one by adding the `ci:full` label. Each time the label is added gives one early run. No workflow reads the label yet, because work on ADR 0003 is paused. _Avoid_: full run, ci:full run **Queue commit**: -The commit GitHub builds for a pull request in a merge queue. It contains -the entry ahead of it, plus the pull request. Checks in the queue test this commit. +The commit GitHub builds for a pull request in a merge queue. It contains the entry ahead of it, plus the pull request. Checks in the queue test this commit. _Avoid_: merge group commit, temporary branch **Trigger paths**: -The paths whose change makes a check run, on PR pushes and in the merge queue. -Every check has them, or a written reason for running on every change. +The paths whose change makes a check run, on PR pushes and in the merge queue. Every check has them, or a written reason for running on every change. _Avoid_: path filter, relevance filter, affected checks **Selector job**: -The first job of a workflow. It selects the checks that run, by comparing the -files a change touches with each check's trigger paths. When it cannot decide, -it fails. The change then cannot merge until someone runs it again. +The first job of a workflow. It selects the checks that run, by comparing the files a change touches with each check's trigger paths. When it cannot decide, it fails. The change then cannot merge until someone runs it again. _Avoid_: path-filter job, decider, router **Summary job**: -The last job of a workflow. It passes when every check that the selector job -selected has passed. It is the only job of the workflow that branch rules -require. +The last job of a workflow. It passes when every check that the selector job selected has passed. It is the only job of the workflow that branch rules require. _Avoid_: required job, status job **Failsafe**: -The test that fails when the selector job does not decide whether a job runs. -A job with a written exemption passes. The failsafe reads workflow files. It -does not act while a workflow runs. +The test that fails when the selector job does not decide whether a job runs. A job with a written exemption passes. The failsafe reads workflow files. It does not act while a workflow runs. _Avoid_: lint, selector guard, path-filter lint **Light job**: -A job that runs acceptably on a GitHub-hosted standard runner. ADR 0002 -planned to run light jobs there. ADR 0004 superseded that plan, so being light -no longer decides where a job runs. Being light says nothing about when a job -runs: a light job can be a gate check. +A job that runs acceptably on a GitHub-hosted standard runner. ADR 0002 planned to run light jobs there. ADR 0004 superseded that plan, so being light no longer decides where a job runs. Being light says nothing about when a job runs: a light job can be a gate check. _Avoid_: small job, cheap job **Heavy job**: -A job that needs more machine than a GitHub-hosted standard runner gives it. -ADR 0002 planned to run heavy jobs on a self-provisioned cloud runner instead. -ADR 0004 superseded that plan, so being heavy no longer decides where a job -runs. Being heavy says nothing about when a job runs: a heavy job can be a push -check. +A job that needs more machine than a GitHub-hosted standard runner gives it. ADR 0002 planned to run heavy jobs on a self-provisioned cloud runner instead. ADR 0004 superseded that plan, so being heavy no longer decides where a job runs. Being heavy says nothing about when a job runs: a heavy job can be a push check. _Avoid_: big job, 16-core job **Same-size swap**: -The change that moves each Blacksmith job to a RunsOn machine with the same -vCPU count, architecture, and Ubuntu version. Memory and disk may be smaller. -The job's triggers stay the same. The swap can add steps, such as a Docker Hub -login before an image pull. +The change that moves each Blacksmith job to a RunsOn machine with the same vCPU count, architecture, and Ubuntu version. Memory and disk may be smaller. The job's triggers stay the same. The swap can add steps, such as a Docker Hub login before an image pull. _Avoid_: like-for-like replacement, migration ## Relationships -- Two separate choices apply to each check. Its trigger paths decide whether - it runs at all. Being a push check or a gate check decides when it runs. -- Being a light job or a heavy job is a third, separate property. Under - ADR 0002, it decided where a check runs. ADR 0004 superseded that plan. +- Two separate choices apply to each check. Its trigger paths decide whether it runs at all. Being a push check or a gate check decides when it runs. +- Being a light job or a heavy job is a third, separate property. Under ADR 0002, it decided where a check runs. ADR 0004 superseded that plan. - The fuzz regression replay, for example, is a light job and a gate check. -- Mutation testing is expensive but important. So it runs only once the - design and implementation of a change are settled. Its failures must be - fixed before the change merges. That makes it a heavy job and a gate check. -- A same-size swap ignores the light and heavy distinction. A Blacksmith job - moves to RunsOn even if a GitHub-hosted standard runner could run it. +- Mutation testing is expensive but important. So it runs only once the design and implementation of a change are settled. Its failures must be fixed before the change merges. That makes it a heavy job and a gate check. +- A same-size swap ignores the light and heavy distinction. A Blacksmith job moves to RunsOn even if a GitHub-hosted standard runner could run it. diff --git a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md index 30d9af9c24..2176c30720 100644 --- a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md +++ b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md @@ -4,23 +4,13 @@ status: superseded by ADR-0004 # Move CI from Blacksmith to GitHub-hosted runners and RunsOn -We decided in October 2026 to stop running CI on Blacksmith. Light jobs run on -GitHub-hosted standard runners. Those runners cost nothing for this public -repository. +We decided in October 2026 to stop running CI on Blacksmith. Light jobs run on GitHub-hosted standard runners. Those runners cost nothing for this public repository. -Heavy jobs run on RunsOn. RunsOn starts a machine in our own AWS account for -each job. Heavy jobs use c8a machines with 8 vCPUs. Mutants uses a -c8a machine with 16 vCPUs. The other repositories that share the CI budget -move their Blacksmith jobs to RunsOn too. +Heavy jobs run on RunsOn. RunsOn starts a machine in our own AWS account for each job. Heavy jobs use c8a machines with 8 vCPUs. Mutants uses a c8a machine with 16 vCPUs. The other repositories that share the CI budget move their Blacksmith jobs to RunsOn too. -Heavy jobs stay on x64, because arm64 machines were slower and not cheaper in -the trial. Jobs that must run on arm64, such as native arm64 container image -builds, are the exception. They run on RunsOn's arm64 machines. +Heavy jobs stay on x64, because arm64 machines were slower and not cheaper in the trial. Jobs that must run on arm64, such as native arm64 container image builds, are the exception. They run on RunsOn's arm64 machines. -We made the change because of cost. CI for this repository cost about $3,865 a -month on Blacksmith at October 2026's pace. That was 20 times September's -cost. The CI budget for this repository and the others that share it is -$1,000 a month. +We made the change because of cost. CI for this repository cost about $3,865 a month on Blacksmith at October 2026's pace. That was 20 times September's cost. The CI budget for this repository and the others that share it is $1,000 a month. ```mermaid flowchart LR @@ -31,46 +21,21 @@ flowchart LR ## Considered options -- **Stay on Blacksmith and run fewer jobs.** We modelled October's jobs with - gate checks in place. This repository alone still came to about $2,000 a - month at Blacksmith's prices. -- **Run every job on RunsOn.** Light jobs would then cost money. GitHub-hosted - runners run them for nothing. -- **Run every job on GitHub-hosted runners.** In the runner trial in pull - request #1297, jobs took 2.46 times as long overall. The integration suites - took up to 4.8 times as long. -- **Build arm64 images on x64 machines.** Cross-compiling Rust for another - architecture is slow. -- **Run arm64 jobs on GitHub-hosted arm64 runners.** Those runners cost money - for private repositories. So the cost applies to the private repositories - that share the CI budget. This public repository already builds - `linux-arm64-gnu` on a GitHub-hosted arm64 runner for nothing, in - `_build-auth-artifacts.yml`. -- **Pull Docker Hub images through a cache in RunsOn's AWS setup.** RunsOn - documents that cache only for its Terraform or OpenTofu install. -- **Pull Docker's official images from Amazon ECR Public.** Every image name - in every repository would change. Images that are not official would need - another source. +- **Stay on Blacksmith and run fewer jobs.** We modelled October's jobs with gate checks in place. This repository alone still came to about $2,000 a month at Blacksmith's prices. +- **Run every job on RunsOn.** Light jobs would then cost money. GitHub-hosted runners run them for nothing. +- **Run every job on GitHub-hosted runners.** In the runner trial in pull request #1297, jobs took 2.46 times as long overall. The integration suites took up to 4.8 times as long. +- **Build arm64 images on x64 machines.** Cross-compiling Rust for another architecture is slow. +- **Run arm64 jobs on GitHub-hosted arm64 runners.** Those runners cost money for private repositories. So the cost applies to the private repositories that share the CI budget. This public repository already builds `linux-arm64-gnu` on a GitHub-hosted arm64 runner for nothing, in `_build-auth-artifacts.yml`. +- **Pull Docker Hub images through a cache in RunsOn's AWS setup.** RunsOn documents that cache only for its Terraform or OpenTofu install. +- **Pull Docker's official images from Amazon ECR Public.** Every image name in every repository would change. Images that are not official would need another source. ## Consequences -- GitHub runs at most 60 jobs at a time for the organisation on the Team plan. - Light jobs wait for a runner when more than 60 jobs are queued. -- We simulated October's light jobs against that limit, with gate checks in - place. One job in a hundred waited between 7 and 11 minutes. +- GitHub runs at most 60 jobs at a time for the organisation on the Team plan. Light jobs wait for a runner when more than 60 jobs are queued. +- We simulated October's light jobs against that limit, with gate checks in place. One job in a hundred waited between 7 and 11 minutes. - A RunsOn job starts 40 to 50 seconds later than a Blacksmith job did. -- RunsOn uses discounted spot machines. When AWS has no spare c8a machines, a - job runs at the full price. The full price is more than twice the spot - price. The `family=c8a+m8a` label lets RunsOn try a second machine type - first. -- Every job sets `timeout-minutes`. In the trial, one job without a limit ran - for over 2 hours. +- RunsOn uses discounted spot machines. When AWS has no spare c8a machines, a job runs at the full price. The full price is more than twice the spot price. The `family=c8a+m8a` label lets RunsOn try a second machine type first. +- Every job sets `timeout-minutes`. In the trial, one job without a limit ran for over 2 hours. - We maintain the RunsOn resources in AWS. They cost $40 to $60 a month. -- Each RunsOn machine has its own public address. Docker Hub limits - anonymous pulls per address. It still refused anonymous pulls from RunsOn - machines in October 2026. So a job logs in to Docker Hub before it pulls an - image. Runs for pull requests from forks get no secrets, so they still pull - without a login. -- A pull request from a fork would run its code on a machine in our AWS - account. So this repository requires approval before any outside - contributor's workflows run, not only a first-time contributor's. +- Each RunsOn machine has its own public address. Docker Hub limits anonymous pulls per address. It still refused anonymous pulls from RunsOn machines in October 2026. So a job logs in to Docker Hub before it pulls an image. Runs for pull requests from forks get no secrets, so they still pull without a login. +- A pull request from a fork would run its code on a machine in our AWS account. So this repository requires approval before any outside contributor's workflows run, not only a first-time contributor's. diff --git a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md index f7834209fc..d4dcdd4c01 100644 --- a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md +++ b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md @@ -4,18 +4,11 @@ status: accepted # Run the expensive CI checks in merge queues on `main` and `next` -> Work on this decision paused in November 2026, until the same-size swap in -> ADR 0004 is in place. None of this decision has been built yet. +> Work on this decision paused in November 2026, until the same-size swap in ADR 0004 is in place. None of this decision has been built yet. -We decided in October 2026 to split this repository's CI checks into push -checks and gate checks. Push checks run on every push to a pull request. Gate -checks run once, when the pull request is in a merge queue. `main` and `next` -each get a merge queue. +We decided in October 2026 to split this repository's CI checks into push checks and gate checks. Push checks run on every push to a pull request. Gate checks run once, when the pull request is in a merge queue. `main` and `next` each get a merge queue. -We made the change because of cost. From 1 to 20 October 2026, 89% of this -repository's CI spending came from pull request runs. Each push ran the -expensive checks again. ADR 0002 moves jobs to cheaper machines. This decision -runs the expensive jobs less often. +We made the change because of cost. From 1 to 20 October 2026, 89% of this repository's CI spending came from pull request runs. Each push ran the expensive checks again. ADR 0002 moves jobs to cheaper machines. This decision runs the expensive jobs less often. `.github/CONTEXT.md` defines the terms used here. @@ -38,8 +31,7 @@ flowchart TD These are the gate checks: -- the Test EQL suites that need a database: the PostgreSQL shards, the e2e - property suite, and the test archive build +- the Test EQL suites that need a database: the PostgreSQL shards, the e2e property suite, and the test archive build - Mutants - CRAP - the fuzz regression replay @@ -50,131 +42,65 @@ These are the gate checks: Every other check is a push check. -- The merge queue runs the push checks and the gate checks against the queue - commit. A failure removes the pull request from the queue. -- Pushes to `main` no longer run the tests. The queue has already tested the - commit that GitHub merges. -- `next` gets the same branch rules as `main`, including the merge queue. - Until now, `next` had no protection. Pushes to it ran no workflows. -- Each queue builds at most 3 entries at once. The weekly cost report will - show whether to change this. -- The queues merge with merge commits, as `main` does today. The comparison - with the entry ahead needs merge commits or squash merges. +- The merge queue runs the push checks and the gate checks against the queue commit. A failure removes the pull request from the queue. +- Pushes to `main` no longer run the tests. The queue has already tested the commit that GitHub merges. +- `next` gets the same branch rules as `main`, including the merge queue. Until now, `next` had no protection. Pushes to it ran no workflows. +- Each queue builds at most 3 entries at once. The weekly cost report will show whether to change this. +- The queues merge with merge commits, as `main` does today. The comparison with the entry ahead needs merge commits or squash merges. ## How a workflow decides what runs -- A selector job starts every workflow, on a GitHub-hosted runner. It selects - the checks whose trigger paths the change touches. -- In a merge queue, the selector job compares the queue commit with its - parent. The parent is the entry ahead, so the difference is this pull - request alone. The entries ahead run their own checks. If one fails, GitHub - rebuilds the entries behind it. -- When the selector job cannot decide, it fails. The change cannot merge until - someone runs it again. So a fault in the selector job is seen at once. -- A summary job ends every workflow. It is the only job of the workflow that - branch rules require. -- The failsafe is a test in `scripts/__tests__/`, run by - `pnpm run test:scripts`. It fails when the selector job does not decide - whether a job runs. A job is exempt only with a written reason. An exemption - that matches no job also fails. +- A selector job starts every workflow, on a GitHub-hosted runner. It selects the checks whose trigger paths the change touches. +- In a merge queue, the selector job compares the queue commit with its parent. The parent is the entry ahead, so the difference is this pull request alone. The entries ahead run their own checks. If one fails, GitHub rebuilds the entries behind it. +- When the selector job cannot decide, it fails. The change cannot merge until someone runs it again. So a fault in the selector job is seen at once. +- A summary job ends every workflow. It is the only job of the workflow that branch rules require. +- The failsafe is a test in `scripts/__tests__/`, run by `pnpm run test:scripts`. It fails when the selector job does not decide whether a job runs. A job is exempt only with a written reason. An exemption that matches no job also fails. ## Early runs -An author can add the `ci:full` label to run the gate checks early on the pull -request. A job removes the label when the early run starts. So each early run -is a deliberate request. The queue still runs the gate checks again. +An author can add the `ci:full` label to run the gate checks early on the pull request. A job removes the label when the early run starts. So each early run is a deliberate request. The queue still runs the gate checks again. -GitHub cannot start a workflow on one label only, so every workflow starts -when any label is added. On every such run, the selector job selects the push -checks again, and the gate checks too for `ci:full`. GitHub counts the newest -result for a check name. So a label run gives fresh push check results. It -cannot hide an earlier push check failure. +GitHub cannot start a workflow on one label only, so every workflow starts when any label is added. On every such run, the selector job selects the push checks again, and the gate checks too for `ci:full`. GitHub counts the newest result for a check name. So a label run gives fresh push check results. It cannot hide an earlier push check failure. -A later push or label run without `ci:full` skips the gate checks. If its -summary job passes, that result replaces the failed result of an early run. +A later push or label run without `ci:full` skips the gate checks. If its summary job passes, that result replaces the failed result of an early run. ## Mutants -- Mutants is a required gate check. It tests only the lines that the pull - request changes. In a merge queue, it finds them the same way as the - selector job. -- It runs in every queue entry except the merge of `next` into `main`. Each - change on `next` has already passed Mutants in the `next` queue. +- Mutants is a required gate check. It tests only the lines that the pull request changes. In a merge queue, it finds them the same way as the selector job. +- It runs in every queue entry except the merge of `next` into `main`. Each change on `next` has already passed Mutants in the `next` queue. - It runs as 4 parallel shards on c8a machines with 16 vCPUs. -- It starts at the same time as the push checks, in the queue and on early - runs. A watcher job cancels it when a push check fails. -- On an early run, a cancelled Mutants run counts as a failure. The pull - request cannot join the queue until Mutants runs again, or a later push or - label run replaces the result. +- It starts at the same time as the push checks, in the queue and on early runs. A watcher job cancels it when a push check fails. +- On an early run, a cancelled Mutants run counts as a failure. The pull request cannot join the queue until Mutants runs again, or a later push or label run replaces the result. - The other heavy gate checks also start at once. ## Considered options -- **Run gate checks when a draft pull request becomes ready for review.** - Agents push to pull requests that are already ready. So most pushes would - still run everything. -- **Run gate checks when a pull request is approved.** On `main`, an approval - stays valid after later pushes. So code pushed after an approval would merge - without gate checks. -- **Run gate checks only when an author adds a label, with no merge queue.** - That depends on people remembering to add it. -- **Filter workflows by path in `on:`, not in a selector job.** GitHub cannot - filter `merge_group` events by path. A workflow that a path filter skips - leaves its required checks pending. GitHub's documentation on required - status checks says that blocks the merge. -- **Compare each queue commit with the base branch.** With 3 entries - building, the third entry's difference includes the two ahead of it. - Mutants would test their lines again. A failure could point to another - author's lines. -- **Run every check when the selector job cannot decide.** No needed check - would be skipped. But nobody would notice a fault in the selector job. Each - fault would also cost a full run. -- **Run Mutants on the merge of `next` into `main` as well.** That run tests - every line `next` added, a second time. In October 2026, it reached its - 120-minute timeout at least twice on pull request #1229. -- **Run Mutants only in the `main` queue.** All of `next` would be tested at - once, when it merges into `main`. A failure would then point to anyone who - changed `next`. -- **Start Mutants after every push check passes.** That spends nothing on - failing commits. But it adds up to 14 minutes to each queue entry and early - run. In the queue, push checks rarely fail. A pull request joins only after - its required checks pass. -- **Keep the `ci:full` label until the author removes it.** A forgotten label - would run every gate check on every later push. -- **Select nothing on a label other than `ci:full`.** Every job would be - skipped, and GitHub counts a skipped job as a pass. A test on 28 October - 2026 showed that this run then replaces an earlier failure. -- **Give the summary job a different name on label runs, or run early runs - in separate workflows.** Either way, a failed early run would no longer stop - a pull request joining the queue. +- **Run gate checks when a draft pull request becomes ready for review.** Agents push to pull requests that are already ready. So most pushes would still run everything. +- **Run gate checks when a pull request is approved.** On `main`, an approval stays valid after later pushes. So code pushed after an approval would merge without gate checks. +- **Run gate checks only when an author adds a label, with no merge queue.** That depends on people remembering to add it. +- **Filter workflows by path in `on:`, not in a selector job.** GitHub cannot filter `merge_group` events by path. A workflow that a path filter skips leaves its required checks pending. GitHub's documentation on required status checks says that blocks the merge. +- **Compare each queue commit with the base branch.** With 3 entries building, the third entry's difference includes the two ahead of it. Mutants would test their lines again. A failure could point to another author's lines. +- **Run every check when the selector job cannot decide.** No needed check would be skipped. But nobody would notice a fault in the selector job. Each fault would also cost a full run. +- **Run Mutants on the merge of `next` into `main` as well.** That run tests every line `next` added, a second time. In October 2026, it reached its 120-minute timeout at least twice on pull request #1229. +- **Run Mutants only in the `main` queue.** All of `next` would be tested at once, when it merges into `main`. A failure would then point to anyone who changed `next`. +- **Start Mutants after every push check passes.** That spends nothing on failing commits. But it adds up to 14 minutes to each queue entry and early run. In the queue, push checks rarely fail. A pull request joins only after its required checks pass. +- **Keep the `ci:full` label until the author removes it.** A forgotten label would run every gate check on every later push. +- **Select nothing on a label other than `ci:full`.** Every job would be skipped, and GitHub counts a skipped job as a pass. A test on 28 October 2026 showed that this run then replaces an earlier failure. +- **Give the summary job a different name on label runs, or run early runs in separate workflows.** Either way, a failed early run would no longer stop a pull request joining the queue. ## Consequences -- Authors learn of a gate check failure in the queue, unless they ask for an - early run. -- A merge waits for the slowest gate check. Each queue's status check timeout - must be longer than that check takes. -- Every workflow with a required summary job must also run on `merge_group`. - GitHub's merge queue documentation says the queue starts no workflow - without it. The queue would then wait for a check that never reports. -- The queue setting "Only merge non-failing pull requests" stays on. Without - it, a pull request that failed could merge with the one behind it. -- The smallest group the queue merges is 1 pull request. So a lone pull - request never waits for others. -- Every label added to a pull request runs its push checks again. In October - 2026, 74 labels were added to 53 pull requests. Most were Dependabot's, - added as the pull request opened, so they cost almost nothing extra. +- Authors learn of a gate check failure in the queue, unless they ask for an early run. +- A merge waits for the slowest gate check. Each queue's status check timeout must be longer than that check takes. +- Every workflow with a required summary job must also run on `merge_group`. GitHub's merge queue documentation says the queue starts no workflow without it. The queue would then wait for a check that never reports. +- The queue setting "Only merge non-failing pull requests" stays on. Without it, a pull request that failed could merge with the one behind it. +- The smallest group the queue merges is 1 pull request. So a lone pull request never waits for others. +- Every label added to a pull request runs its push checks again. In October 2026, 74 labels were added to 53 pull requests. Most were Dependabot's, added as the pull request opened, so they cost almost nothing extra. - A test of a merge queue on 28 October 2026 confirmed three behaviours: - - Commits made by the merge queue pass the rule that requires signed - commits. - - A queue commit's parent is the entry ahead of it. `merge_group.base_sha` - is that parent. - - GitHub does not cancel a running workflow when its entry leaves the - queue. The run continues to the end. -- A failed entry stays in the queue until the entry ahead of it finishes. - Meanwhile, the entry behind it builds on top of the failure. -- After a flaky push check on an early run, the author must re-run Mutants as - well. -- While it waits, the watcher holds one of the organisation's 60 - GitHub-hosted job slots. It waits up to about 14 minutes. + - Commits made by the merge queue pass the rule that requires signed commits. + - A queue commit's parent is the entry ahead of it. `merge_group.base_sha` is that parent. + - GitHub does not cancel a running workflow when its entry leaves the queue. The run continues to the end. +- A failed entry stays in the queue until the entry ahead of it finishes. Meanwhile, the entry behind it builds on top of the failure. +- After a flaky push check on an early run, the author must re-run Mutants as well. +- While it waits, the watcher holds one of the organisation's 60 GitHub-hosted job slots. It waits up to about 14 minutes. - This decision covers this repository only. `proxy` may follow later. diff --git a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md index d07ae37053..b3be042037 100644 --- a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md +++ b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md @@ -5,131 +5,67 @@ supersedes: ADR-0002 # Swap Blacksmith for RunsOn machines of the same size -In November 2026 we decided to move every Blacksmith job in this repository to -RunsOn. Each job gets the same vCPU count, architecture, and Ubuntu version. -`.github/CONTEXT.md` calls this a same-size swap. The jobs' triggers and -trigger paths stay as they are. +In November 2026 we decided to move every Blacksmith job in this repository to RunsOn. Each job gets the same vCPU count, architecture, and Ubuntu version. `.github/CONTEXT.md` calls this a same-size swap. The jobs' triggers and trigger paths stay as they are. -We made the change to cut cost at once. At November 2026's pace, CI for this -repository costs about $3,470 a month on Blacksmith. On RunsOn machines of the -same size, we estimate $1,140 to $1,350 a month for the machines. RunsOn's own -AWS resources add $40 to $60 a month. The estimate applies the cost ratios from -the runner trial in pull request #1297 to Blacksmith's November bill. +We made the change to cut cost at once. At November 2026's pace, CI for this repository costs about $3,470 a month on Blacksmith. On RunsOn machines of the same size, we estimate $1,140 to $1,350 a month for the machines. RunsOn's own AWS resources add $40 to $60 a month. The estimate applies the cost ratios from the runner trial in pull request #1297 to Blacksmith's November bill. -This decision supersedes ADR 0002. It sets aside the $1,000 monthly budget in -the CI budget entry of `.github/CONTEXT.md` as the measure of success. Work on -ADR 0003 is paused until the swap is in place. +This decision supersedes ADR 0002. It sets aside the $1,000 monthly budget in the CI budget entry of `.github/CONTEXT.md` as the measure of success. Work on ADR 0003 is paused until the swap is in place. ## What changes -Each Blacksmith label becomes a RunsOn label with the same vCPU count and -Ubuntu version: +Each Blacksmith label becomes a RunsOn label with the same vCPU count and Ubuntu version: | Blacksmith label | RunsOn label | |---|---| | `blacksmith-16vcpu-ubuntu-2204` | `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=16/image=ubuntu22-full-x64/volume=80gb/extras=s3-cache` | | `blacksmith-4vcpu-ubuntu-2404` | `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache` | -- **Which jobs:** every job that names a Blacksmith label, in every workflow - of this repository. That includes the Linux targets of the FFI release - matrix. `scripts/ffi-release-matrix.mjs` assigns their labels. On 19 November 2026, - `main` had 55 such job definitions in 27 workflows. -- **Which jobs stay:** jobs on GitHub-hosted runners stay there. Examples are - `ubuntu-latest`, macOS, and Windows jobs. -- **Other repositories:** `proxy` and the other repositories that use - Blacksmith keep it for now. -- **Memory:** c8a machines have 2 GB per vCPU. Blacksmith's x64 machines have - 4 GB per vCPU. A job that fails for lack of memory moves to `family=m8a`. - The m8a machines have 4 GB per vCPU. -- **Disk:** every job gets 80 GB. Blacksmith gives 80 GB at 4 vCPU and 750 GB - at 16 vCPU. -- **Cache:** `extras=s3-cache` sends `actions/cache` to an S3 bucket in our AWS - account. The jobs need no extra step for this. RunsOn job logs from - October 2026 show cache restores working with the label alone. -- **Machine family:** RunsOn uses spot c8a machines first. The `m8a` family - gives it a second choice when AWS has no spare c8a spot machines. +- **Which jobs:** every job that names a Blacksmith label, in every workflow of this repository. That includes the Linux targets of the FFI release matrix. `scripts/ffi-release-matrix.mjs` assigns their labels. On 19 November 2026, `main` had 55 such job definitions in 27 workflows. +- **Which jobs stay:** jobs on GitHub-hosted runners stay there. Examples are `ubuntu-latest`, macOS, and Windows jobs. +- **Other repositories:** `proxy` and the other repositories that use Blacksmith keep it for now. +- **Memory:** c8a machines have 2 GB per vCPU. Blacksmith's x64 machines have 4 GB per vCPU. A job that fails for lack of memory moves to `family=m8a`. The m8a machines have 4 GB per vCPU. +- **Disk:** every job gets 80 GB. Blacksmith gives 80 GB at 4 vCPU and 750 GB at 16 vCPU. +- **Cache:** `extras=s3-cache` sends `actions/cache` to an S3 bucket in our AWS account. The jobs need no extra step for this. RunsOn job logs from October 2026 show cache restores working with the label alone. +- **Machine family:** RunsOn uses spot c8a machines first. The `m8a` family gives it a second choice when AWS has no spare c8a spot machines. Two changes go in with the swap, because RunsOn needs them: -- **Docker Hub logins.** A job logs in to Docker Hub before it pulls an image. - It uses a free Docker Hub account. The login needs the `DOCKER_HUB_USERNAME` - and `DOCKER_HUB_PASSWORD` secrets. Dependabot runs read Dependabot secrets, - so both secrets need a Dependabot copy too. Runs for pull requests from forks - get no secrets, so they pull without a login. -- **Time limits.** Every job sets `timeout-minutes`. On RunsOn, a stuck job - costs money until its limit ends it. In the trial, one job without a limit - ran for over 2 hours. +- **Docker Hub logins.** A job logs in to Docker Hub before it pulls an image. It uses a free Docker Hub account. The login needs the `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` secrets. Dependabot runs read Dependabot secrets, so both secrets need a Dependabot copy too. Runs for pull requests from forks get no secrets, so they pull without a login. +- **Time limits.** Every job sets `timeout-minutes`. On RunsOn, a stuck job costs money until its limit ends it. In the trial, one job without a limit ran for over 2 hours. ## The RunsOn setup These settings are in place, or requested, in the AWS account: -- RunsOn v3.6.2, upgraded on 19 November 2026. Older versions failed jobs when - the on-demand vCPU quota was full. From v3.6.0, those jobs wait. -- Spot machines first, with on-demand machines when spot capacity runs out. - RunsOn reruns a job that AWS interrupts. +- RunsOn v3.6.2, upgraded on 19 November 2026. Older versions failed jobs when the on-demand vCPU quota was full. From v3.6.0, those jobs wait. +- Spot machines first, with on-demand machines when spot capacity runs out. RunsOn reruns a job that AWS interrupts. - No warm machines. They cost money while idle. - One RunsOn installation, in `us-west-2`. -- vCPU quotas of 5,000 for spot and for on-demand standard instances. AWS had - not yet approved the requests on 19 November 2026. Until it does, the - quotas are 512 vCPUs each, and jobs above them wait. The swap does not - wait for the approval. -- `AppSize` moves from `small` to `medium` once AWS raises the - `RunInstances` request rate from 2 to 4 a second. We asked AWS for that on - 19 November 2026. Both sizes cost the same. +- vCPU quotas of 5,000 for spot and for on-demand standard instances. AWS had not yet approved the requests on 19 November 2026. Until it does, the quotas are 512 vCPUs each, and jobs above them wait. The swap does not wait for the approval. +- `AppSize` moves from `small` to `medium` once AWS raises the `RunInstances` request rate from 2 to 4 a second. We asked AWS for that on 19 November 2026. Both sizes cost the same. ## How we judge the swap -We judge the swap on cost alone. The AWS account holds only RunsOn. So while -only this repository uses RunsOn, the account's bill is the cost of its CI. We -revert the swap only if CI stops working. +We judge the swap on cost alone. The AWS account holds only RunsOn. So while only this repository uses RunsOn, the account's bill is the cost of its CI. We revert the swap only if CI stops working. ## Considered options -- **Match Blacksmith's memory with m8a machines.** We estimate 10 to 20% more - per hour than c8a. The trial found no memory failures on c8a in 44 jobs. -- **Match Blacksmith's disk sizes.** A 750 GB disk adds about a fifth to the - spot price of a 16 vCPU machine. The open pull requests ran 16 vCPU jobs on - 80 GB disks with every check passing. -- **Keep ADR 0002's plan.** Light jobs on GitHub-hosted runners and heavy jobs - on 8 vCPU machines cost less. That plan needs more changes, and ADR 0003's - merge queues, before it brings its full saving. -- **Switch in stages, Test EQL first.** Test EQL is 53% of November's spend. - Two stages would need two reviews and two switches. Most of the risk is in - Test EQL anyway. -- **Use on-demand machines only.** Jobs would never be interrupted. The cost - would be about 2.3 times the spot price. -- **Keep warm machines ready.** Jobs would start faster. Warm machines cost - money while idle. -- **Pay for a Docker Team or Pro plan.** Either plan removes the pull limit. - Billed yearly, Team costs $15 a user a month, for at least 2 users. Pro - costs $9 a month. A Team plan also gives a token that belongs to the - organisation, not to one person. We keep the free account, for two - reasons. The swap is meant to reduce costs. It is also an experiment to - prove that RunsOn is viable for this repository. +- **Match Blacksmith's memory with m8a machines.** We estimate 10 to 20% more per hour than c8a. The trial found no memory failures on c8a in 44 jobs. +- **Match Blacksmith's disk sizes.** A 750 GB disk adds about a fifth to the spot price of a 16 vCPU machine. The open pull requests ran 16 vCPU jobs on 80 GB disks with every check passing. +- **Keep ADR 0002's plan.** Light jobs on GitHub-hosted runners and heavy jobs on 8 vCPU machines cost less. That plan needs more changes, and ADR 0003's merge queues, before it brings its full saving. +- **Switch in stages, Test EQL first.** Test EQL is 53% of November's spend. Two stages would need two reviews and two switches. Most of the risk is in Test EQL anyway. +- **Use on-demand machines only.** Jobs would never be interrupted. The cost would be about 2.3 times the spot price. +- **Keep warm machines ready.** Jobs would start faster. Warm machines cost money while idle. +- **Pay for a Docker Team or Pro plan.** Either plan removes the pull limit. Billed yearly, Team costs $15 a user a month, for at least 2 users. Pro costs $9 a month. A Team plan also gives a token that belongs to the organisation, not to one person. We keep the free account, for two reasons. The swap is meant to reduce costs. It is also an experiment to prove that RunsOn is viable for this repository. ## Consequences -- A RunsOn job started 40 to 50 seconds later than a Blacksmith job in the - trial. -- Blacksmith ran any number of jobs at once. RunsOn runs as many as the AWS - vCPU quotas allow. In October 2026, the peak need was between 2,700 and - 4,700 vCPUs. -- AWS can interrupt a spot machine. RunsOn then reruns the job, so it takes - longer. +- A RunsOn job started 40 to 50 seconds later than a Blacksmith job in the trial. +- Blacksmith ran any number of jobs at once. RunsOn runs as many as the AWS vCPU quotas allow. In October 2026, the peak need was between 2,700 and 4,700 vCPUs. +- AWS can interrupt a spot machine. RunsOn then reruns the job, so it takes longer. - A 16 vCPU job has 32 GB of memory, not 64 GB. -- Each RunsOn machine has its own public address. Docker Hub still refused - anonymous pulls in the October 2026 trial, so jobs log in. -- The free Docker Hub account allows 200 pulls in 6 hours, for all jobs - together. That figure comes from Docker's documentation, at - https://docs.docker.com/docker-hub/usage/pulls/. Docker's pricing page - says 100 pulls an hour instead. In busy hours, jobs can reach the limit, - and their pulls fail. -- A pull request from a fork runs its code on a machine in our AWS account. So - this repository requires approval before any outside contributor's - workflows run. -- Blacksmith's GitHub App stays installed for the other repositories. A revert - of the swap returns these jobs to Blacksmith. -- The light and heavy job entries in `.github/CONTEXT.md` no longer decide - where a job runs. A Blacksmith job moves to RunsOn even if a GitHub-hosted - runner could run it. +- Each RunsOn machine has its own public address. Docker Hub still refused anonymous pulls in the October 2026 trial, so jobs log in. +- The free Docker Hub account allows 200 pulls in 6 hours, for all jobs together. That figure comes from Docker's documentation, at https://docs.docker.com/docker-hub/usage/pulls/. Docker's pricing page says 100 pulls an hour instead. In busy hours, jobs can reach the limit, and their pulls fail. +- A pull request from a fork runs its code on a machine in our AWS account. So this repository requires approval before any outside contributor's workflows run. +- Blacksmith's GitHub App stays installed for the other repositories. A revert of the swap returns these jobs to Blacksmith. +- The light and heavy job entries in `.github/CONTEXT.md` no longer decide where a job runs. A Blacksmith job moves to RunsOn even if a GitHub-hosted runner could run it. From f2cef684fecc4017df7bdc2807410d51f5f72abc Mon Sep 17 00:00:00 2001 From: Lindsay Holmwood <lindsay@holmwood.id.au> Date: Wed, 25 Nov 2026 21:45:58 +1100 Subject: [PATCH 25/25] docs(ci): rewrite the ADRs, glossary and plan in plain language The documents followed the plain-language rules a checker can enforce, but nobody had applied the rest of the plain-language skill to them. That means naming each document's reader, working through the checker's "consider" findings, and rereading the text as that reader. Each file now has one sentence per line. An edit then changes only the sentences it touches, and a long sentence shows as a long line. The rewrite spells out abbreviations at first use and names each sentence's subject. It also splits sentences that held two ideas, and completes comparisons. ADR 0002 now says at the top that ADR 0004 supersedes it. ADR 0003's title is shorter, and one of its sections is now two. No fact changed. A script compared each file with its earlier version. Every number, date, amount, hash, pull request number, URL, and code span is still present. The front matter, fenced code blocks, Mermaid diagrams, tables, and glossary term lines are byte-identical. The checker reports no "must fix" findings. Its "consider" findings fell from 113 to 51, and each one left has a reason. --- .github/CONTEXT.md | 79 +++- ...ub-hosted-runners-heavy-jobs-on-runs-on.md | 80 +++- ...ks-run-in-merge-queues-on-main-and-next.md | 213 +++++++--- ...me-size-swap-from-blacksmith-to-runs-on.md | 160 ++++++-- ...19-same-size-swap-blacksmith-to-runs-on.md | 379 +++++++++++++----- 5 files changed, 684 insertions(+), 227 deletions(-) diff --git a/.github/CONTEXT.md b/.github/CONTEXT.md index 26cf965f5a..35df3cfb60 100644 --- a/.github/CONTEXT.md +++ b/.github/CONTEXT.md @@ -1,65 +1,106 @@ # CI -This context covers the checks that verify a change, and the machines that run them. It covers the GitHub Actions workflows of `cipherstash/stack`. It also covers the CI spend of the other repositories that share its budget. +This context covers the checks that verify a change, and the machines that run those checks. +The context covers the GitHub Actions workflows of `cipherstash/stack`. +The context also covers the CI spending of the other repositories that share the CI budget with `cipherstash/stack`. ## Language **CI budget**: -The most that the repositories sharing it may spend on CI in one calendar month. Vendor invoices measure it, including fixed costs such as licences and cloud infrastructure. When an invoice also covers other repositories, only the part for these repositories counts. List-price estimates track it between invoices, but do not replace it. +The most money that the repositories sharing the budget may spend on CI in one calendar month. +Vendor invoices are the measure of spending against the budget, including fixed costs such as licences and cloud infrastructure. +When an invoice also covers repositories that do not share the budget, only the part for the repositories that share it counts. +Estimates at list price track the spending between invoices, but do not replace the invoices. _Avoid_: build minutes, runner minutes **PR push**: -A new head commit on a pull request's branch. Each one starts the push checks again. +A new head commit on the branch of a pull request. +Each PR push starts the push checks again. _Avoid_: PR run, CI run **Push check**: -A check that runs on each PR push, if the change touches its trigger paths. The author then learns of a failure while still working on the change. +A check that runs on each PR push, if the change includes a file in the check's trigger paths. +The author of the pull request then learns of a failure while still working on the change. _Avoid_: fast check, PR check **Gate check**: -A check that runs when a pull request is in a merge queue, instead of on every PR push. A failed gate check blocks the merge. ADR 0003 plans a merge queue for `main` and one for `next`, and neither exists yet. Under ADR 0003, an author can ask for a gate check to run earlier on the pull request. +A check that runs when a pull request is in a merge queue, instead of on every PR push. +A failed gate check blocks the merge. +Architecture decision record (ADR) 0003 plans a merge queue for `main` and one for `next`, but neither exists yet. +Under ADR 0003, an author can ask for a gate check to run earlier, on the pull request. _Avoid_: heavy check, full CI, merge check **Early run**: -A run of the gate checks on a pull request before it joins a merge queue. An author asks for one by adding the `ci:full` label. Each time the label is added gives one early run. No workflow reads the label yet, because work on ADR 0003 is paused. +A run of the gate checks on a pull request before the pull request joins a merge queue. +An author asks for an early run by adding the `ci:full` label. +Each time someone adds the label, the pull request gets one early run. +No workflow reads the label yet, because work on ADR 0003 is paused. _Avoid_: full run, ci:full run **Queue commit**: -The commit GitHub builds for a pull request in a merge queue. It contains the entry ahead of it, plus the pull request. Checks in the queue test this commit. +The commit that GitHub builds for a pull request in a merge queue. +A queue commit contains the queue entry ahead of the pull request, plus the pull request. +Checks in the merge queue test the queue commit. _Avoid_: merge group commit, temporary branch **Trigger paths**: -The paths whose change makes a check run, on PR pushes and in the merge queue. Every check has them, or a written reason for running on every change. +The paths that make a check run when a change includes a file in one of them. +Trigger paths apply on PR pushes and in the merge queue. +Every check has trigger paths, or a written reason for running on every change. _Avoid_: path filter, relevance filter, affected checks **Selector job**: -The first job of a workflow. It selects the checks that run, by comparing the files a change touches with each check's trigger paths. When it cannot decide, it fails. The change then cannot merge until someone runs it again. +The first job of a workflow. +The selector job selects the checks that run, by comparing the files in a change with the trigger paths of each check. +When the selector job cannot decide, it fails. +The change then cannot merge until someone runs the selector job again. _Avoid_: path-filter job, decider, router **Summary job**: -The last job of a workflow. It passes when every check that the selector job selected has passed. It is the only job of the workflow that branch rules require. +The last job of a workflow. +The summary job passes when every check that the selector job selected has passed. +The summary job is the only job in the workflow that branch rules require. _Avoid_: required job, status job **Failsafe**: -The test that fails when the selector job does not decide whether a job runs. A job with a written exemption passes. The failsafe reads workflow files. It does not act while a workflow runs. +The test that fails when the selector job does not decide whether a job runs. +The failsafe passes a job that has a written exemption. +The failsafe reads workflow files, rather than acting while a workflow runs. _Avoid_: lint, selector guard, path-filter lint **Light job**: -A job that runs acceptably on a GitHub-hosted standard runner. ADR 0002 planned to run light jobs there. ADR 0004 superseded that plan, so being light no longer decides where a job runs. Being light says nothing about when a job runs: a light job can be a gate check. +A job that runs acceptably on a GitHub-hosted standard runner. +ADR 0002 planned to run light jobs on GitHub-hosted standard runners. +Because ADR 0004 superseded that plan, being light no longer decides where a job runs. +Being light does not decide when a job runs: a light job can be a gate check. _Avoid_: small job, cheap job **Heavy job**: -A job that needs more machine than a GitHub-hosted standard runner gives it. ADR 0002 planned to run heavy jobs on a self-provisioned cloud runner instead. ADR 0004 superseded that plan, so being heavy no longer decides where a job runs. Being heavy says nothing about when a job runs: a heavy job can be a push check. +A job that needs a larger machine than a GitHub-hosted standard runner. +ADR 0002 planned to run heavy jobs on a self-provisioned cloud runner instead. +Because ADR 0004 superseded that plan, being heavy no longer decides where a job runs. +Being heavy does not decide when a job runs: a heavy job can be a push check. _Avoid_: big job, 16-core job **Same-size swap**: -The change that moves each Blacksmith job to a RunsOn machine with the same vCPU count, architecture, and Ubuntu version. Memory and disk may be smaller. The job's triggers stay the same. The swap can add steps, such as a Docker Hub login before an image pull. +The change that moves each Blacksmith job to a RunsOn machine with the same vCPU count, architecture, and Ubuntu version. +Memory and disk may be smaller than on Blacksmith. +The triggers of each job stay the same. +The swap can add steps, such as a Docker Hub login before an image pull. _Avoid_: like-for-like replacement, migration ## Relationships -- Two separate choices apply to each check. Its trigger paths decide whether it runs at all. Being a push check or a gate check decides when it runs. -- Being a light job or a heavy job is a third, separate property. Under ADR 0002, it decided where a check runs. ADR 0004 superseded that plan. -- The fuzz regression replay, for example, is a light job and a gate check. -- Mutation testing is expensive but important. So it runs only once the design and implementation of a change are settled. Its failures must be fixed before the change merges. That makes it a heavy job and a gate check. -- A same-size swap ignores the light and heavy distinction. A Blacksmith job moves to RunsOn even if a GitHub-hosted standard runner could run it. +- Two separate choices apply to each check. + The trigger paths of a check decide whether the check runs at all. + Being a push check or a gate check decides when the check runs. +- Being a light job or a heavy job is a third, separate property. + Under ADR 0002, that property decided where a check runs. + ADR 0004 superseded the plan in ADR 0002. +- For example, the fuzz regression replay is a light job and a gate check. +- Mutation testing is expensive but important. + So mutation testing only runs after the design and implementation of a change are settled. + Failures in mutation testing must be fixed before the change merges. + Those facts make mutation testing a heavy job and a gate check. +- A same-size swap does not use the distinction between light and heavy jobs. + A Blacksmith job moves to RunsOn even if a GitHub-hosted standard runner could run it. diff --git a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md index 2176c30720..98ce3abfa2 100644 --- a/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md +++ b/docs/adr/0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md @@ -4,13 +4,30 @@ status: superseded by ADR-0004 # Move CI from Blacksmith to GitHub-hosted runners and RunsOn -We decided in October 2026 to stop running CI on Blacksmith. Light jobs run on GitHub-hosted standard runners. Those runners cost nothing for this public repository. +> This architecture decision record (ADR) is no longer in force. +> [ADR 0004](0004-same-size-swap-from-blacksmith-to-runs-on.md) supersedes it. -Heavy jobs run on RunsOn. RunsOn starts a machine in our own AWS account for each job. Heavy jobs use c8a machines with 8 vCPUs. Mutants uses a c8a machine with 16 vCPUs. The other repositories that share the CI budget move their Blacksmith jobs to RunsOn too. +We decided in October 2026 to stop running CI on Blacksmith. +Light jobs run on GitHub-hosted standard runners. +Those runners cost nothing for this public repository. -Heavy jobs stay on x64, because arm64 machines were slower and not cheaper in the trial. Jobs that must run on arm64, such as native arm64 container image builds, are the exception. They run on RunsOn's arm64 machines. +Heavy jobs run on RunsOn. +RunsOn starts a machine in our own AWS account for each job. +Heavy jobs use c8a machines with 8 vCPUs. +Mutants, the mutation testing workflow, uses a c8a machine with 16 vCPUs. +The other repositories that share the CI budget move their Blacksmith jobs to RunsOn too. -We made the change because of cost. CI for this repository cost about $3,865 a month on Blacksmith at October 2026's pace. That was 20 times September's cost. The CI budget for this repository and the others that share it is $1,000 a month. +Heavy jobs stay on x64 machines. +In the trial, arm64 machines were slower than x64 machines, and not cheaper. +Jobs that must run on arm64, such as native arm64 container image builds, are the exception. +Those jobs run on RunsOn's arm64 machines. + +We made the change because of cost. +CI for this repository cost about $3,865 a month on Blacksmith at October 2026's pace. +That was 20 times September's cost. +The CI budget for this repository and the others that share it is $1,000 a month. + +`.github/CONTEXT.md` defines the terms used here. ```mermaid flowchart LR @@ -21,21 +38,48 @@ flowchart LR ## Considered options -- **Stay on Blacksmith and run fewer jobs.** We modelled October's jobs with gate checks in place. This repository alone still came to about $2,000 a month at Blacksmith's prices. -- **Run every job on RunsOn.** Light jobs would then cost money. GitHub-hosted runners run them for nothing. -- **Run every job on GitHub-hosted runners.** In the runner trial in pull request #1297, jobs took 2.46 times as long overall. The integration suites took up to 4.8 times as long. -- **Build arm64 images on x64 machines.** Cross-compiling Rust for another architecture is slow. -- **Run arm64 jobs on GitHub-hosted arm64 runners.** Those runners cost money for private repositories. So the cost applies to the private repositories that share the CI budget. This public repository already builds `linux-arm64-gnu` on a GitHub-hosted arm64 runner for nothing, in `_build-auth-artifacts.yml`. -- **Pull Docker Hub images through a cache in RunsOn's AWS setup.** RunsOn documents that cache only for its Terraform or OpenTofu install. -- **Pull Docker's official images from Amazon ECR Public.** Every image name in every repository would change. Images that are not official would need another source. +We rejected each of these options: + +- **Stay on Blacksmith and run fewer jobs.** + We modelled October's jobs with gate checks in place. + At Blacksmith's prices, this repository alone still came to about $2,000 a month. +- **Run every job on RunsOn.** + Light jobs would then cost money. + GitHub-hosted runners run them for nothing. +- **Run every job on GitHub-hosted runners.** + In the runner trial in pull request #1297, jobs took 2.46 times as long overall. + The integration suites took up to 4.8 times as long. +- **Build arm64 images on x64 machines.** + Cross-compiling Rust for another architecture is slow. +- **Run arm64 jobs on GitHub-hosted arm64 runners.** + Those runners cost money for private repositories. + So the cost applies to the private repositories that share the CI budget. + This public repository already builds `linux-arm64-gnu` on a GitHub-hosted arm64 runner for nothing, in `_build-auth-artifacts.yml`. +- **Pull Docker Hub images through a cache in RunsOn's AWS setup.** + RunsOn documents that cache only for its Terraform or OpenTofu installation. +- **Pull Docker's official images from Amazon Elastic Container Registry (ECR) Public.** + Every image name in every repository would change. + Images that are not official would need another source. ## Consequences -- GitHub runs at most 60 jobs at a time for the organisation on the Team plan. Light jobs wait for a runner when more than 60 jobs are queued. -- We simulated October's light jobs against that limit, with gate checks in place. One job in a hundred waited between 7 and 11 minutes. +- GitHub runs at most 60 jobs at a time for the organisation on the Team plan. + When more than 60 jobs are queued, light jobs wait for a runner. +- We simulated October's light jobs against that limit, with gate checks in place. + One job in a hundred waited between 7 and 11 minutes. - A RunsOn job starts 40 to 50 seconds later than a Blacksmith job did. -- RunsOn uses discounted spot machines. When AWS has no spare c8a machines, a job runs at the full price. The full price is more than twice the spot price. The `family=c8a+m8a` label lets RunsOn try a second machine type first. -- Every job sets `timeout-minutes`. In the trial, one job without a limit ran for over 2 hours. -- We maintain the RunsOn resources in AWS. They cost $40 to $60 a month. -- Each RunsOn machine has its own public address. Docker Hub limits anonymous pulls per address. It still refused anonymous pulls from RunsOn machines in October 2026. So a job logs in to Docker Hub before it pulls an image. Runs for pull requests from forks get no secrets, so they still pull without a login. -- A pull request from a fork would run its code on a machine in our AWS account. So this repository requires approval before any outside contributor's workflows run, not only a first-time contributor's. +- RunsOn uses discounted spot machines. + When AWS has no spare c8a machines, a job runs at the full price. + The full price is more than twice the spot price. + The `family=c8a+m8a` label lets RunsOn try a second machine type before the job runs at the full price. +- Every job sets `timeout-minutes`. + In the trial, one job without a limit ran for more than 2 hours. +- We maintain the RunsOn resources in AWS. + Those resources cost $40 to $60 a month. +- Each RunsOn machine has its own public address. + Docker Hub limits anonymous pulls per address. + In October 2026, Docker Hub still refused anonymous pulls from RunsOn machines. + So a job logs in to Docker Hub before it pulls an image. + Runs for pull requests from forks get no secrets, so they still pull without a login. +- A pull request from a fork would run its code on a machine in our AWS account. + So this repository requires approval before any outside contributor's workflows run, not only a first-time contributor's. diff --git a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md index d4dcdd4c01..5275e02790 100644 --- a/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md +++ b/docs/adr/0003-expensive-ci-checks-run-in-merge-queues-on-main-and-next.md @@ -2,15 +2,25 @@ status: accepted --- -# Run the expensive CI checks in merge queues on `main` and `next` +# Merge queues on `main` and `next` run expensive CI checks -> Work on this decision paused in November 2026, until the same-size swap in ADR 0004 is in place. None of this decision has been built yet. +> We paused work on this decision in November 2026, until the same-size swap in architecture decision record (ADR) 0004 is in place. +> That swap moves every Blacksmith job in this repository to a RunsOn machine of the same size. +> None of this decision has been built yet. -We decided in October 2026 to split this repository's CI checks into push checks and gate checks. Push checks run on every push to a pull request. Gate checks run once, when the pull request is in a merge queue. `main` and `next` each get a merge queue. +In October 2026, we decided to split this repository's CI checks into push checks and gate checks. +Push checks run on every push to a pull request. +Gate checks run once, when the pull request is in a merge queue. +The `main` and `next` branches each get a merge queue. -We made the change because of cost. From 1 to 20 October 2026, 89% of this repository's CI spending came from pull request runs. Each push ran the expensive checks again. ADR 0002 moves jobs to cheaper machines. This decision runs the expensive jobs less often. +We made the change because of cost. +From 1 to 20 October 2026, 89% of this repository's CI spending came from runs for pull requests. +Each push to a pull request ran the expensive checks again. +ADR 0002 moves jobs to cheaper machines. +This decision runs the expensive checks less often. -`.github/CONTEXT.md` defines the terms used here. +The glossary in `.github/CONTEXT.md` defines the terms used here. +The diagram shows each step for one pull request, from a push to the merge. ```mermaid flowchart TD @@ -27,80 +37,167 @@ flowchart TD sum -- "No" --> out["The pull request leaves the queue"] ``` -## What runs where +## Gate checks and push checks -These are the gate checks: +The following checks are gate checks: -- the Test EQL suites that need a database: the PostgreSQL shards, the e2e property suite, and the test archive build -- Mutants -- CRAP +- the Test EQL (Encrypt Query Language) suites that need a database: the PostgreSQL shards, the e2e property suite, and the test archive build +- Mutants, the mutation testing job +- CRAP (Change Risk Anti-Patterns) - the fuzz regression replay - Go on Windows and macOS, and the Go live tests - the Drizzle, prisma-next, Supabase, and protect-ffi integration suites -- the two Prisma E2E suites +- the two Prisma end-to-end (E2E) suites - udeps and Miri Every other check is a push check. -- The merge queue runs the push checks and the gate checks against the queue commit. A failure removes the pull request from the queue. -- Pushes to `main` no longer run the tests. The queue has already tested the commit that GitHub merges. -- `next` gets the same branch rules as `main`, including the merge queue. Until now, `next` had no protection. Pushes to it ran no workflows. -- Each queue builds at most 3 entries at once. The weekly cost report will show whether to change this. -- The queues merge with merge commits, as `main` does today. The comparison with the entry ahead needs merge commits or squash merges. +## How the merge queues work + +In a merge queue, each pull request is an entry. +For each entry, GitHub builds a queue commit. +The queue commit of an entry contains the entry ahead, plus that entry's pull request. + +- The merge queue runs the push checks and the gate checks against the queue commit. + A failure removes the pull request from the queue. +- Pushes to `main` no longer run the tests. + The queue has already tested the commit that GitHub merges. +- The `next` branch gets the same branch rules as `main`, including the merge queue. + When we made this decision, `next` had no protection. + Pushes to `next` ran no workflows. +- Each queue builds at most 3 entries at once. + The weekly cost report will show whether to change that limit. +- The queues merge with merge commits, as `main` did when we made this decision. + The selector job compares each queue commit with the entry ahead. + The comparison needs merge commits or squash merges. ## How a workflow decides what runs -- A selector job starts every workflow, on a GitHub-hosted runner. It selects the checks whose trigger paths the change touches. -- In a merge queue, the selector job compares the queue commit with its parent. The parent is the entry ahead, so the difference is this pull request alone. The entries ahead run their own checks. If one fails, GitHub rebuilds the entries behind it. -- When the selector job cannot decide, it fails. The change cannot merge until someone runs it again. So a fault in the selector job is seen at once. -- A summary job ends every workflow. It is the only job of the workflow that branch rules require. -- The failsafe is a test in `scripts/__tests__/`, run by `pnpm run test:scripts`. It fails when the selector job does not decide whether a job runs. A job is exempt only with a written reason. An exemption that matches no job also fails. +- Every workflow starts with a selector job. + The selector job runs on a GitHub-hosted runner. + The selector job selects a check when the change touches one of the check's trigger paths. + A check's trigger paths are the paths that make the check run when they change. +- In a merge queue, the selector job compares the queue commit with its parent. + The parent is the entry ahead, so the difference is this pull request alone. + The entries ahead run their own checks. + If one of them fails, GitHub rebuilds the entries behind it. +- When the selector job cannot decide, it fails. + The change then cannot merge until someone runs the selector job again. + So people notice a fault in the selector job at once. +- Every workflow ends with a summary job. + The summary job is the only job of the workflow that branch rules require. +- The failsafe is a test in `scripts/__tests__/`. + The command `pnpm run test:scripts` runs it. + The failsafe fails when the selector job does not decide whether a job runs. + A job is exempt only with a written reason. + The failsafe also fails on an exemption that matches no job. ## Early runs -An author can add the `ci:full` label to run the gate checks early on the pull request. A job removes the label when the early run starts. So each early run is a deliberate request. The queue still runs the gate checks again. - -GitHub cannot start a workflow on one label only, so every workflow starts when any label is added. On every such run, the selector job selects the push checks again, and the gate checks too for `ci:full`. GitHub counts the newest result for a check name. So a label run gives fresh push check results. It cannot hide an earlier push check failure. - -A later push or label run without `ci:full` skips the gate checks. If its summary job passes, that result replaces the failed result of an early run. - -## Mutants - -- Mutants is a required gate check. It tests only the lines that the pull request changes. In a merge queue, it finds them the same way as the selector job. -- It runs in every queue entry except the merge of `next` into `main`. Each change on `next` has already passed Mutants in the `next` queue. -- It runs as 4 parallel shards on c8a machines with 16 vCPUs. -- It starts at the same time as the push checks, in the queue and on early runs. A watcher job cancels it when a push check fails. -- On an early run, a cancelled Mutants run counts as a failure. The pull request cannot join the queue until Mutants runs again, or a later push or label run replaces the result. -- The other heavy gate checks also start at once. +An author can ask for an early run by adding the `ci:full` label to the pull request. +An early run runs the gate checks on the pull request, before it joins the merge queue. +A job removes the label when the early run starts. +So each early run is a deliberate request. +The merge queue still runs the gate checks again. + +GitHub cannot start a workflow only when one particular label is added. +So every workflow starts when any label is added. +A run that starts this way is a label run. +On every label run, the selector job selects the push checks again. +For the `ci:full` label, the selector job selects the gate checks too. + +For each check name, GitHub counts the newest result. +So a label run gives new results for the push checks. +A label run cannot hide an earlier push check failure. + +A later push or label run without `ci:full` skips the gate checks. +If the summary job of that later run passes, its result replaces the failed result of an early run. + +## How Mutants runs + +- Mutants is a required gate check. + Mutants only tests the lines that the pull request changes. + In a merge queue, Mutants finds those lines the same way as the selector job. +- Mutants runs in every queue entry except the merge of `next` into `main`. + Each change on `next` has already passed Mutants in the `next` queue. +- Mutants runs as 4 parallel shards on c8a machines with 16 vCPUs. +- In the queue and on early runs, Mutants starts at the same time as the push checks. + A watcher job cancels Mutants when a push check fails. +- On an early run, a cancelled Mutants run counts as a failure. + The pull request cannot join the queue until Mutants runs again, or until a later push or label run replaces the result. +- The other heavy gate checks also start at once, as Mutants does. ## Considered options -- **Run gate checks when a draft pull request becomes ready for review.** Agents push to pull requests that are already ready. So most pushes would still run everything. -- **Run gate checks when a pull request is approved.** On `main`, an approval stays valid after later pushes. So code pushed after an approval would merge without gate checks. -- **Run gate checks only when an author adds a label, with no merge queue.** That depends on people remembering to add it. -- **Filter workflows by path in `on:`, not in a selector job.** GitHub cannot filter `merge_group` events by path. A workflow that a path filter skips leaves its required checks pending. GitHub's documentation on required status checks says that blocks the merge. -- **Compare each queue commit with the base branch.** With 3 entries building, the third entry's difference includes the two ahead of it. Mutants would test their lines again. A failure could point to another author's lines. -- **Run every check when the selector job cannot decide.** No needed check would be skipped. But nobody would notice a fault in the selector job. Each fault would also cost a full run. -- **Run Mutants on the merge of `next` into `main` as well.** That run tests every line `next` added, a second time. In October 2026, it reached its 120-minute timeout at least twice on pull request #1229. -- **Run Mutants only in the `main` queue.** All of `next` would be tested at once, when it merges into `main`. A failure would then point to anyone who changed `next`. -- **Start Mutants after every push check passes.** That spends nothing on failing commits. But it adds up to 14 minutes to each queue entry and early run. In the queue, push checks rarely fail. A pull request joins only after its required checks pass. -- **Keep the `ci:full` label until the author removes it.** A forgotten label would run every gate check on every later push. -- **Select nothing on a label other than `ci:full`.** Every job would be skipped, and GitHub counts a skipped job as a pass. A test on 28 October 2026 showed that this run then replaces an earlier failure. -- **Give the summary job a different name on label runs, or run early runs in separate workflows.** Either way, a failed early run would no longer stop a pull request joining the queue. +We rejected each of these options: + +- **Run gate checks when a draft pull request becomes ready for review.** + Agents push to pull requests that are already ready for review. + So most pushes would still run every check. +- **Run gate checks when a pull request is approved.** + On `main`, an approval stays valid after later pushes. + So code pushed after an approval would merge without gate checks. +- **Run gate checks only when an author adds a label, with no merge queue.** + The gate checks would then depend on people remembering to add the label. +- **Filter workflows by path in `on:`, not in a selector job.** + GitHub cannot filter `merge_group` events by path. + If a path filter skips a workflow, the workflow's required checks stay pending. + GitHub's documentation on required status checks says that a pending required check blocks the merge. +- **Compare each queue commit with the base branch.** + With 3 entries building, the difference for the third entry would include the two entries ahead of it. + Mutants would then test the lines of those two entries again. + A failure could point to another author's lines. +- **Run every check when the selector job cannot decide.** + No needed check would be skipped. + But nobody would notice a fault in the selector job. + Each fault would also cost a full run. +- **Run Mutants on the merge of `next` into `main` as well.** + Such a run tests every line that `next` added, for a second time. + In October 2026, such a run reached its 120-minute timeout at least twice on pull request #1229. +- **Run Mutants only in the `main` queue.** + Mutants would test all of `next` together, when `next` merges into `main`. + A failure would then point to anyone who changed `next`. +- **Start Mutants after every push check passes.** + Waiting would spend nothing on failing commits. + But waiting would add up to 14 minutes to each queue entry and early run. + In the queue, push checks rarely fail. + A pull request joins the queue only after its required checks pass. +- **Keep the `ci:full` label until the author removes it.** + If an author forgot to remove the label, every later push would run every gate check. +- **Select nothing on a label other than `ci:full`.** + Every job would be skipped. + GitHub counts a skipped job as a pass. + A test on 28 October 2026 showed that the result of such a run then replaces an earlier failure. +- **Give the summary job a different name on label runs, or run early runs in separate workflows.** + With either option, a failed early run would no longer stop a pull request from joining the queue. ## Consequences -- Authors learn of a gate check failure in the queue, unless they ask for an early run. -- A merge waits for the slowest gate check. Each queue's status check timeout must be longer than that check takes. -- Every workflow with a required summary job must also run on `merge_group`. GitHub's merge queue documentation says the queue starts no workflow without it. The queue would then wait for a check that never reports. -- The queue setting "Only merge non-failing pull requests" stays on. Without it, a pull request that failed could merge with the one behind it. -- The smallest group the queue merges is 1 pull request. So a lone pull request never waits for others. -- Every label added to a pull request runs its push checks again. In October 2026, 74 labels were added to 53 pull requests. Most were Dependabot's, added as the pull request opened, so they cost almost nothing extra. +- If authors do not ask for an early run, they learn of a gate check failure in the queue. +- A merge waits for the slowest gate check. + Each queue's status check timeout must be longer than the slowest gate check takes. +- Every workflow with a required summary job must also run on `merge_group`. + GitHub's merge queue documentation says the queue only starts workflows that run on `merge_group`. + Without that trigger, the queue would wait for a check that never reports. +- The queue setting "Only merge non-failing pull requests" stays on. + Without that setting, a pull request that failed could merge with the one behind it. +- The smallest group the queue merges is 1 pull request. + So a pull request on its own never waits for others. +- Adding any label to a pull request runs its push checks again. + In October 2026, 74 labels were added to 53 pull requests. + Dependabot added most of them as it opened each pull request. + So those labels cost almost nothing extra. - A test of a merge queue on 28 October 2026 confirmed three behaviours: - Commits made by the merge queue pass the rule that requires signed commits. - - A queue commit's parent is the entry ahead of it. `merge_group.base_sha` is that parent. - - GitHub does not cancel a running workflow when its entry leaves the queue. The run continues to the end. -- A failed entry stays in the queue until the entry ahead of it finishes. Meanwhile, the entry behind it builds on top of the failure. + - The parent of a queue commit is the entry ahead of it. + The value of `merge_group.base_sha` is that parent. + - GitHub does not cancel a running workflow when its entry leaves the queue. + The run continues to the end. +- A failed entry stays in the queue until the entry ahead of it finishes. + Meanwhile, GitHub builds the entry behind it. + The queue commit of that entry contains the failed entry. - After a flaky push check on an early run, the author must re-run Mutants as well. -- While it waits, the watcher holds one of the organisation's 60 GitHub-hosted job slots. It waits up to about 14 minutes. -- This decision covers this repository only. `proxy` may follow later. +- The watcher job waits for up to about 14 minutes. + While it waits, it uses one of the organisation's 60 GitHub-hosted job slots. +- This decision only covers this repository. + The `proxy` repository may make the same change later. diff --git a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md index b3be042037..53613e36fe 100644 --- a/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md +++ b/docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md @@ -5,11 +5,21 @@ supersedes: ADR-0002 # Swap Blacksmith for RunsOn machines of the same size -In November 2026 we decided to move every Blacksmith job in this repository to RunsOn. Each job gets the same vCPU count, architecture, and Ubuntu version. `.github/CONTEXT.md` calls this a same-size swap. The jobs' triggers and trigger paths stay as they are. - -We made the change to cut cost at once. At November 2026's pace, CI for this repository costs about $3,470 a month on Blacksmith. On RunsOn machines of the same size, we estimate $1,140 to $1,350 a month for the machines. RunsOn's own AWS resources add $40 to $60 a month. The estimate applies the cost ratios from the runner trial in pull request #1297 to Blacksmith's November bill. - -This decision supersedes ADR 0002. It sets aside the $1,000 monthly budget in the CI budget entry of `.github/CONTEXT.md` as the measure of success. Work on ADR 0003 is paused until the swap is in place. +In November 2026, we decided to move every Blacksmith job in this repository to RunsOn. +RunsOn runs each job on a machine in our AWS account. +Each job gets the same vCPU count, architecture, and Ubuntu version as on Blacksmith. +`.github/CONTEXT.md` calls this a same-size swap. +The jobs' triggers and trigger paths stay as they are. + +We made the change to cut cost at once. +At November 2026's pace, CI for this repository costs about $3,470 a month on Blacksmith. +On RunsOn machines of the same size, we estimate $1,140 to $1,350 a month for the machines. +RunsOn's own AWS resources add $40 to $60 a month. +The estimate applies the cost ratios from the runner trial in pull request #1297 to Blacksmith's November bill. + +This architecture decision record (ADR) supersedes [ADR 0002](0002-light-ci-jobs-on-github-hosted-runners-heavy-jobs-on-runs-on.md). +The $1,000 monthly budget in the CI budget entry of `.github/CONTEXT.md` is not this decision's measure of success. +Work on ADR 0003 is paused until the swap is in place. ## What changes @@ -20,52 +30,126 @@ Each Blacksmith label becomes a RunsOn label with the same vCPU count and Ubuntu | `blacksmith-16vcpu-ubuntu-2204` | `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=16/image=ubuntu22-full-x64/volume=80gb/extras=s3-cache` | | `blacksmith-4vcpu-ubuntu-2404` | `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache` | -- **Which jobs:** every job that names a Blacksmith label, in every workflow of this repository. That includes the Linux targets of the FFI release matrix. `scripts/ffi-release-matrix.mjs` assigns their labels. On 19 November 2026, `main` had 55 such job definitions in 27 workflows. -- **Which jobs stay:** jobs on GitHub-hosted runners stay there. Examples are `ubuntu-latest`, macOS, and Windows jobs. -- **Other repositories:** `proxy` and the other repositories that use Blacksmith keep it for now. -- **Memory:** c8a machines have 2 GB per vCPU. Blacksmith's x64 machines have 4 GB per vCPU. A job that fails for lack of memory moves to `family=m8a`. The m8a machines have 4 GB per vCPU. -- **Disk:** every job gets 80 GB. Blacksmith gives 80 GB at 4 vCPU and 750 GB at 16 vCPU. -- **Cache:** `extras=s3-cache` sends `actions/cache` to an S3 bucket in our AWS account. The jobs need no extra step for this. RunsOn job logs from October 2026 show cache restores working with the label alone. -- **Machine family:** RunsOn uses spot c8a machines first. The `m8a` family gives it a second choice when AWS has no spare c8a spot machines. +- **Jobs that move.** + Every job that names a Blacksmith label moves, in every workflow of this repository. + That includes the Linux targets of the foreign function interface (FFI) release matrix. + `scripts/ffi-release-matrix.mjs` assigns their labels. + On 19 November 2026, `main` had 55 such job definitions in 27 workflows. +- **Jobs that stay.** + Jobs on GitHub-hosted runners stay there, such as `ubuntu-latest`, macOS, and Windows jobs. +- **Other repositories.** + `proxy` and the other repositories that use Blacksmith keep it for now. +- **Memory.** + The c8a machines have 2 GB per vCPU. + Blacksmith's x64 machines have 4 GB per vCPU. + A job that fails for lack of memory moves to `family=m8a`. + The m8a machines have 4 GB per vCPU. +- **Disk.** + Every job gets an 80 GB disk. + Blacksmith gives a 4 vCPU machine 80 GB. + Blacksmith gives a 16 vCPU machine 750 GB. +- **Cache.** + `extras=s3-cache` makes `actions/cache` use an Amazon Simple Storage Service (S3) bucket in our AWS account. + The jobs need no extra step for this. + RunsOn job logs from October 2026 show cache restores working with the label alone. +- **Machine family.** + RunsOn uses spot c8a machines first. + Spot machines cost less than on-demand machines. + AWS can interrupt a spot machine. + When AWS has no spare c8a spot machines, the `m8a` family gives RunsOn a second choice. Two changes go in with the swap, because RunsOn needs them: -- **Docker Hub logins.** A job logs in to Docker Hub before it pulls an image. It uses a free Docker Hub account. The login needs the `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` secrets. Dependabot runs read Dependabot secrets, so both secrets need a Dependabot copy too. Runs for pull requests from forks get no secrets, so they pull without a login. -- **Time limits.** Every job sets `timeout-minutes`. On RunsOn, a stuck job costs money until its limit ends it. In the trial, one job without a limit ran for over 2 hours. +- **Docker Hub logins.** + A job logs in to Docker Hub before it pulls an image. + The login uses a free Docker Hub account. + The login needs the `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` secrets. + Dependabot runs read Dependabot secrets, so both secrets need a Dependabot copy too. + Runs for pull requests from forks get no secrets, so they pull without a login. +- **Time limits.** + Every job sets `timeout-minutes`. + On RunsOn, a stuck job costs money until its time limit ends it. + In the trial, one job without a limit ran for more than 2 hours. ## The RunsOn setup -These settings are in place, or requested, in the AWS account: - -- RunsOn v3.6.2, upgraded on 19 November 2026. Older versions failed jobs when the on-demand vCPU quota was full. From v3.6.0, those jobs wait. -- Spot machines first, with on-demand machines when spot capacity runs out. RunsOn reruns a job that AWS interrupts. -- No warm machines. They cost money while idle. -- One RunsOn installation, in `us-west-2`. -- vCPU quotas of 5,000 for spot and for on-demand standard instances. AWS had not yet approved the requests on 19 November 2026. Until it does, the quotas are 512 vCPUs each, and jobs above them wait. The swap does not wait for the approval. -- `AppSize` moves from `small` to `medium` once AWS raises the `RunInstances` request rate from 2 to 4 a second. We asked AWS for that on 19 November 2026. Both sizes cost the same. +These settings are in place in the AWS account, or have been requested: + +- We upgraded RunsOn to v3.6.2 on 19 November 2026. + Before v3.6.0, RunsOn failed a job when the on-demand vCPU quota was full. + From v3.6.0, the job waits. +- RunsOn uses spot machines first, and on-demand machines when spot capacity runs out. + RunsOn reruns a job that AWS interrupts. +- RunsOn keeps no warm machines ready. + Warm machines cost money while idle. +- There is one RunsOn installation, in the `us-west-2` region. +- We asked for vCPU quotas of 5,000 for spot and for on-demand standard instances. + AWS had not yet approved the requests on 19 November 2026. + Until AWS approves them, each quota is 512 vCPUs. + Jobs above the quotas wait. + The swap does not wait for the approval. +- When AWS raises the `RunInstances` request rate from 2 to 4 a second, the RunsOn `AppSize` setting moves from `small` to `medium`. + We asked AWS for the higher rate on 19 November 2026. + Both sizes cost the same. ## How we judge the swap -We judge the swap on cost alone. The AWS account holds only RunsOn. So while only this repository uses RunsOn, the account's bill is the cost of its CI. We revert the swap only if CI stops working. +We judge the swap on cost alone. +The AWS account contains only RunsOn. +So while only this repository uses RunsOn, the account's bill is the cost of this repository's CI. +We revert the swap only if CI stops working. ## Considered options -- **Match Blacksmith's memory with m8a machines.** We estimate 10 to 20% more per hour than c8a. The trial found no memory failures on c8a in 44 jobs. -- **Match Blacksmith's disk sizes.** A 750 GB disk adds about a fifth to the spot price of a 16 vCPU machine. The open pull requests ran 16 vCPU jobs on 80 GB disks with every check passing. -- **Keep ADR 0002's plan.** Light jobs on GitHub-hosted runners and heavy jobs on 8 vCPU machines cost less. That plan needs more changes, and ADR 0003's merge queues, before it brings its full saving. -- **Switch in stages, Test EQL first.** Test EQL is 53% of November's spend. Two stages would need two reviews and two switches. Most of the risk is in Test EQL anyway. -- **Use on-demand machines only.** Jobs would never be interrupted. The cost would be about 2.3 times the spot price. -- **Keep warm machines ready.** Jobs would start faster. Warm machines cost money while idle. -- **Pay for a Docker Team or Pro plan.** Either plan removes the pull limit. Billed yearly, Team costs $15 a user a month, for at least 2 users. Pro costs $9 a month. A Team plan also gives a token that belongs to the organisation, not to one person. We keep the free account, for two reasons. The swap is meant to reduce costs. It is also an experiment to prove that RunsOn is viable for this repository. +We rejected each of these options: + +- **Match Blacksmith's memory with m8a machines.** + We estimate that m8a machines cost 10 to 20% more per hour than c8a machines. + In the trial, none of 44 jobs on c8a machines failed for lack of memory. +- **Match Blacksmith's disk sizes.** + A 750 GB disk adds about a fifth to the spot price of a 16 vCPU machine. + In the pull requests open at the time, 16 vCPU jobs ran on 80 GB disks, and every check passed. +- **Keep ADR 0002's plan.** + Light jobs on GitHub-hosted runners and heavy jobs on 8 vCPU machines cost less than the same-size swap. + That plan gives its full saving only after more changes and ADR 0003's merge queues. +- **Switch in stages, starting with Test EQL.** + The Test EQL workflow is 53% of November's spend. + Two stages would need two reviews and two switches. + Most of the risk is in Test EQL anyway. +- **Use on-demand machines only.** + AWS would never interrupt a job. + The cost would be about 2.3 times the spot price. +- **Keep warm machines ready.** + Jobs would start faster. + Warm machines cost money while idle. +- **Pay for a Docker Team or Pro plan.** + Either plan removes the pull limit. + Billed yearly, Team costs $15 a user a month, for at least 2 users. + Pro costs $9 a month. + A Team plan also gives a token that belongs to the organisation, not to one person. + We keep the free account, for two reasons. + The swap is meant to reduce costs. + The swap is also an experiment to prove that RunsOn is viable for this repository. ## Consequences -- A RunsOn job started 40 to 50 seconds later than a Blacksmith job in the trial. -- Blacksmith ran any number of jobs at once. RunsOn runs as many as the AWS vCPU quotas allow. In October 2026, the peak need was between 2,700 and 4,700 vCPUs. -- AWS can interrupt a spot machine. RunsOn then reruns the job, so it takes longer. +- In the trial, a RunsOn job started 40 to 50 seconds later than a Blacksmith job. +- Blacksmith ran any number of jobs at once. + RunsOn runs as many jobs as the AWS vCPU quotas allow. + In October 2026, the peak need was between 2,700 and 4,700 vCPUs. +- AWS can interrupt a spot machine. + RunsOn then reruns the job, so the job takes longer. - A 16 vCPU job has 32 GB of memory, not 64 GB. -- Each RunsOn machine has its own public address. Docker Hub still refused anonymous pulls in the October 2026 trial, so jobs log in. -- The free Docker Hub account allows 200 pulls in 6 hours, for all jobs together. That figure comes from Docker's documentation, at https://docs.docker.com/docker-hub/usage/pulls/. Docker's pricing page says 100 pulls an hour instead. In busy hours, jobs can reach the limit, and their pulls fail. -- A pull request from a fork runs its code on a machine in our AWS account. So this repository requires approval before any outside contributor's workflows run. -- Blacksmith's GitHub App stays installed for the other repositories. A revert of the swap returns these jobs to Blacksmith. -- The light and heavy job entries in `.github/CONTEXT.md` no longer decide where a job runs. A Blacksmith job moves to RunsOn even if a GitHub-hosted runner could run it. +- Each RunsOn machine has its own public address. + In the October 2026 trial, Docker Hub still refused anonymous pulls. + So jobs log in. +- The free Docker Hub account allows 200 pulls in 6 hours, for all jobs together. + That figure comes from Docker's documentation, at https://docs.docker.com/docker-hub/usage/pulls/. + Docker's pricing page says 100 pulls an hour instead. + In busy hours, jobs can reach the limit, and their pulls fail. +- A pull request from a fork runs its code on a machine in our AWS account. + So this repository requires approval before any outside contributor's workflows run. +- Blacksmith's GitHub App stays installed for the other repositories. + A revert of the swap returns these jobs to Blacksmith. +- Where a job runs no longer depends on the light job and heavy job entries in `.github/CONTEXT.md`. + A Blacksmith job moves to RunsOn even if a GitHub-hosted runner could run it. diff --git a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md index f923a6fb42..5614b67fea 100644 --- a/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md +++ b/docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md @@ -1,65 +1,122 @@ # Same-size swap from Blacksmith to RunsOn: implementation plan -> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. +> Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** Move every Blacksmith job in `cipherstash/stack` to a RunsOn machine with the same vCPU count, architecture, and Ubuntu version. -**Architecture:** Pull request #1419 already moves some jobs to RunsOn at 8 vCPUs. It also adds Docker Hub logins and a test that requires them. This plan merges `main` into that branch, gives every job its Blacksmith size, and moves the remaining jobs. Each rule gets a test in `scripts/__tests__/`. A later change that breaks a rule then fails a test. +**Status:** Every task is done. +Every step box is ticked. +The line under each task heading says how that task was done. + +**Architecture:** Pull request #1419 already moves some jobs to RunsOn at 8 vCPUs. +Pull request #1419 also adds Docker Hub logins, and a test that requires them. +This plan merges `main` into that branch, gives every job the size it had on Blacksmith, and moves the remaining jobs. +The plan adds a test in `scripts/__tests__/` for each rule. +A later change that breaks a rule then fails that rule's test. **Tech Stack:** GitHub Actions YAML, RunsOn v3.6.2 labels, Node.js ESM scripts, Vitest, js-yaml, and actionlint 1.7.7. -**Spec:** `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`. +**Spec:** architecture decision record (ADR) 0004, in `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`. ## Global Constraints - The 16 vCPU label, verbatim: `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=16/image=ubuntu22-full-x64/volume=80gb/extras=s3-cache` - The 4 vCPU label, verbatim: `runs-on=${{ github.run_id }}/family=c8a+m8a/cpu=4/image=ubuntu24-full-x64/volume=80gb/extras=s3-cache` -- `blacksmith-16vcpu-ubuntu-2204` becomes the 16 vCPU label. `blacksmith-4vcpu-ubuntu-2404` becomes the 4 vCPU label. -- A job that fails for lack of memory changes `family=c8a+m8a` to `family=m8a`. Nothing else in its label changes. No job starts on `m8a`. -- Every job that names a Blacksmith label moves. On `main` at `0a0fb63ec`, that is 55 job definitions in 27 workflows. Of these, 31 have 16 vCPUs. The other 24 have 4 vCPUs. -- The three Linux platforms of the FFI release matrix move too. `scripts/ffi-release-matrix.mjs` gives them their label, with the run ID passed in. +- `blacksmith-16vcpu-ubuntu-2204` becomes the 16 vCPU label. + `blacksmith-4vcpu-ubuntu-2404` becomes the 4 vCPU label. +- If a job fails for lack of memory, its label changes from `family=c8a+m8a` to `family=m8a`. + Nothing else in the label changes. + No job starts on `m8a`. +- Every job that names a Blacksmith label moves. + On `main` at `0a0fb63ec`, that is 55 job definitions in 27 workflows. + Of these, 31 have 16 vCPUs. + The other 24 have 4 vCPUs. +- The three Linux platforms of the FFI release matrix move too. + `scripts/ffi-release-matrix.mjs` gives them their label, with the run ID passed in. - Jobs on GitHub-hosted runners stay where they are. - Job IDs, job names, triggers, trigger paths, and existing steps stay the same. -- The swap adds three things only: Docker Hub logins, a wait for the apt lock, and two secrets for one reusable workflow. -- The login reads `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD`. It does nothing when either secret is empty, as on a pull request from a fork. -- #1427 sets the time limits. It merges before #1419. -- Commits are SSH-signed. They carry no `Co-Authored-By` or `Claude-Session` lines. Pull request text contains no Claude attribution. -- Pull requests stay drafts. Push only after the user has asked for this plan to be carried out. Never force-push. -- GitHub text contains no Linear issue IDs. It never names or describes the private repository that the stack-* crates came from. +- The swap adds only three things: Docker Hub logins, a wait for the apt lock, and two secrets for one reusable workflow. +- The login reads `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD`. + The login does nothing when either secret is empty. + The secrets are empty on a pull request from a fork. +- Pull request #1427 sets a time limit on every job. + Pull request #1427 merges before #1419. +- Commits are SSH-signed. + Commits contain no `Co-Authored-By` or `Claude-Session` lines. + Pull request text contains no Claude attribution. +- Pull requests stay drafts. + Push only after the user has asked for this plan to be carried out. + Never force-push. +- Text on GitHub contains no Linear issue IDs. + Text on GitHub never names or describes the private repository that the stack-* crates came from. - Comments, commit messages, and pull request text use short, literal sentences, one idea each. -- Do not change repository settings or secrets. The user does that. +- Do not change repository settings or secrets. + The user does that. ## Steps only the user does -These are not tasks for the executor, and no task waits for them. Until the secrets exist, the login steps do nothing, and pulls stay anonymous. +The person or agent who carries out the tasks does not do these steps. +No task waits for them. +Until the secrets exist, the login steps do nothing. +Image pulls stay anonymous until then. -- Create the free Docker Hub account. Create a personal access token for it with read-only access to public repositories. -- Add `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` to `cipherstash/stack` as Actions secrets. Add both as Dependabot secrets too, because Dependabot runs read only those. -- Merge #1427. Mark #1419 ready and merge it when you choose. +- Create the free Docker Hub account. + Create a personal access token for the account, with read-only access to public repositories. +- Add `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` to `cipherstash/stack` as Actions secrets. + Add both as Dependabot secrets too, because a run that Dependabot starts reads only Dependabot secrets. +- Merge #1427. + When you choose, mark #1419 ready and merge it. ## Review Focus -1. **A reusable workflow whose caller passes no secrets.** In a called workflow, `secrets.*` is empty unless the caller passes it. The login would skip. The job would then pull anonymously without an error. Task 3 adds a test that every such caller passes both secrets. -2. **A RunsOn runner chosen by a matrix.** The FFI `binaries` job takes its runner from `matrix.cfg.os`. The login test from #1419 checks only jobs with a literal `runs-on=` label. So it would miss the musl build. That build pulls Alpine from Docker Hub. Task 2 lists each matrix runner job, and Task 3 checks the RunsOn ones. -3. **apt on a fresh machine.** A new RunsOn machine can still be running apt from boot. `apt-get` then fails at once on the held lock. Task 4 adds a test that every apt command in a RunsOn job sets `DPkg::Lock::Timeout`. That option does not make `apt-get update` wait, so #1419 also retries each `apt-get update`, as Task 4 explains. -4. **A label of the wrong size.** #1419 used `cpu=8`. A label left at `cpu=8` would give a job the wrong machine. A label with no run ID would be shared by every run. Task 2's tests accept only the labels in Global Constraints, and refuse an FFI label with no run ID. -5. **A 16 vCPU job that needs more than 32 GB.** No repository test can show this. The pull request's own CI run is the test. Task 5 watches it and applies the `m8a` rule to any job killed for lack of memory. +1. **A reusable workflow whose caller passes no secrets.** In a called workflow, `secrets.*` is empty unless the caller passes it. + The login would then do nothing. + The job would pull images anonymously, with no error. + Task 3 adds a test that every such caller passes both secrets. +2. **A RunsOn runner chosen by a matrix.** The FFI `binaries` job takes its runner from `matrix.cfg.os`. + The login test from #1419 checks only jobs with a literal `runs-on=` label. + So the login test would miss the musl build. + The musl build pulls an Alpine image from Docker Hub. + Task 2 lists each job whose runner comes from a matrix. + Task 3 checks the ones that use RunsOn. +3. **apt on a new machine.** A new RunsOn machine can still be running an apt process that started at boot. + `apt-get` in the job then fails at once, because the lock is already held. + Task 4 adds a test that every apt command in a RunsOn job sets `DPkg::Lock::Timeout`. + `DPkg::Lock::Timeout` does not make `apt-get update` wait. + So #1419 also retries each `apt-get update`, as Task 4 explains. +4. **A label of the wrong size.** Pull request #1419 used `cpu=8`. + A label left at `cpu=8` would give a job the wrong machine. + If a label had no run ID, every run would share it. + Task 2's tests accept only the labels in Global Constraints. + The tests also refuse an FFI label with no run ID. +5. **A 16 vCPU job that needs more than 32 GB.** No test in the repository can show that a job needs this much memory. + The CI run of #1419 is the test. + Task 5 watches that run. + Task 5 then applies the `m8a` rule from Global Constraints to any job killed for lack of memory. --- ## Outside this plan -- AWS has not yet raised the `RunInstances` request rate. When Service Quotas shows 4 for `L-A2D70E6C`, a second CloudFormation change set moves `AppSize` to `medium`. -- AWS has not yet approved the vCPU quotas of 5,000. Until it does, jobs above 512 vCPUs wait for a machine. -- The repository already requires approval before a workflow from any outside contributor runs. The API showed `all_external_contributors` on 19 November 2026. +- AWS has not yet raised the `RunInstances` request rate. + When Service Quotas shows 4 for `L-A2D70E6C`, a second CloudFormation change set moves `AppSize` to `medium`. +- AWS has not yet approved the vCPU quotas of 5,000. + Until AWS approves them, jobs beyond the first 512 vCPUs wait for a machine. +- The repository already requires approval before a workflow from any outside contributor runs. + The GitHub API showed `all_external_contributors` on 19 November 2026. --- ### Task 1: Bring #1427 up to date with `main` -This task is done another way. Pull request #1427 was rebased onto `main` instead of merging `main` into it. It merged into `main` as 11db0ef99 on 20 November 2026. +This task is done another way. +Pull request #1427 was rebased onto `main`, instead of merging `main` into it. +Pull request #1427 merged into `main` as 11db0ef99 on 20 November 2026. -#1427 sets `timeout-minutes` on every job, and its test fails when a job has none. Jobs added to `main` since 28 October may have no limit. +Pull request #1427 sets `timeout-minutes` on every job. +The test from #1427 fails when a job has no `timeout-minutes`. +Jobs added to `main` since 28 October may have no limit. **Files:** - Modify: each `.github/workflows/*.yml` file the test lists @@ -67,11 +124,13 @@ This task is done another way. Pull request #1427 was rebased onto `main` instea **Interfaces:** - Consumes: nothing -- Produces: branch `ci/job-timeouts`. It merges into `main` with its test passing. +- Produces: branch `ci/job-timeouts`. + The branch merges into `main` with its test passing. - [x] **Step 1: Merge `main` into the branch** -Create a worktree for `ci/job-timeouts` with the superpowers:using-git-worktrees skill. In it, run: +Create a worktree for `ci/job-timeouts` with the superpowers:using-git-worktrees skill. +In the worktree, run: ```bash git fetch origin @@ -79,25 +138,33 @@ git merge --no-edit origin/main pnpm install --frozen-lockfile ``` -Expected: the merge completes. On a conflict, keep `main`'s lines and add the branch's `timeout-minutes` line to the job. +Expected: the merge completes. +If the merge has a conflict, keep `main`'s lines, and add the branch's `timeout-minutes` line to the job. - [x] **Step 2: Run the test** Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-job-timeouts.test.mjs` -Expected: PASS, or FAIL with a list of `<file>#<job>` references that have no limit. +Expected: PASS, or FAIL with a list of the jobs that have no limit, as `<file>#<job>` references. - [x] **Step 3: Give each listed job a limit** -Use the rule from #1427's commit `ci(timeouts): set timeout-minutes on every job`. The limit is about twice the job's longest successful run in the last 30 days. Round it up to a multiple of 5 minutes, with a floor of 10. Read run times with `gh run list --workflow <file> --status success --limit 50 --json databaseId` and `gh run view <id> --json jobs`. +Use the rule from #1427's commit `ci(timeouts): set timeout-minutes on every job`. +The limit is about twice the job's longest successful run in the last 30 days. +Round the limit up to a multiple of 5 minutes. +The limit is never less than 10 minutes. +Read run times with `gh run list --workflow <file> --status success --limit 50 --json databaseId` and `gh run view <id> --json jobs`. - [x] **Step 4: Run the test again** -Run: the command in Step 2. Expected: PASS. +Run: the command in Step 2. +Expected: PASS. - [x] **Step 5: Commit and push** -If Step 1 had no conflict and Step 2 passed, push nothing, because the pull request already merges cleanly. If Step 1 had a conflict and Step 2 passed, run `git push` to publish the merge commit. Otherwise: +If Step 1 had no conflict and Step 2 passed, push nothing, because the pull request already merges cleanly. +If Step 1 had a conflict and Step 2 passed, run `git push` to publish the merge commit. +Otherwise: ```bash git add .github/workflows @@ -109,7 +176,9 @@ Then tell the user that #1427 is ready for them to merge. ### Task 2: Swap every runner label -This task is done. #1419's commit `ci(runners): move every Blacksmith job to a RunsOn machine of the same size` made these changes. #1419 was rebased onto #1416's branch instead of merging `main` into it. +This task is done. +The commit `ci(runners): move every Blacksmith job to a RunsOn machine of the same size` in #1419 made these changes. +Pull request #1419 was rebased onto the branch of pull request #1416, instead of merging `main` into it. **Files:** - Create: `scripts/__tests__/lib/runs-on.mjs` @@ -121,17 +190,27 @@ This task is done. #1419's commit `ci(runners): move every Blacksmith job to a R - Modify: comments at lines 9 and 22 of `.github/workflows/lint-release.yml` **Interfaces:** -- Consumes: `imageOf()` in `scripts/__tests__/workflow-mise-cache-image.test.mjs`. On #1419's branch, it already reads `image=ubuntuNN` from a RunsOn label. +- Consumes: `imageOf()` in `scripts/__tests__/workflow-mise-cache-image.test.mjs`. + On #1419's branch, `imageOf()` already reads `image=ubuntuNN` from a RunsOn label. - Produces, in `scripts/__tests__/lib/runs-on.mjs`: - - `runsOnLabel(cpu: 4 | 16, { family = 'c8a+m8a', runId = '${{ github.run_id }}' } = {}): string`. A `cpu` of 16 gives `image=ubuntu22-full-x64`. A `cpu` of 4 gives `image=ubuntu24-full-x64`. Any other `cpu` throws. - - `RUNS_ON_LABELS: ReadonlySet<string>`, holding `runsOnLabel(16)` and `runsOnLabel(4)`, plus both with `family: 'm8a'`. - - `MATRIX_RUNNERS: Record<string, { runsOn: boolean, reason: string }>`, keyed by `'<workflow path>#<job id>'`. The workflow path is what `workflowFiles()` in `lib/workflows.mjs` returns. - - `isRunsOnJob(job: object, ref?: string): boolean`. It is true when `job['runs-on']` is a string that starts with `runs-on=`. It is also true when `MATRIX_RUNNERS[ref]?.runsOn` is true. + - `runsOnLabel(cpu: 4 | 16, { family = 'c8a+m8a', runId = '${{ github.run_id }}' } = {}): string`. + A `cpu` of 16 gives `image=ubuntu22-full-x64`. + A `cpu` of 4 gives `image=ubuntu24-full-x64`. + Any other `cpu` throws an error. + - `RUNS_ON_LABELS: ReadonlySet<string>`. + The set contains `runsOnLabel(16)` and `runsOnLabel(4)`, plus both with `family: 'm8a'`. + - `MATRIX_RUNNERS: Record<string, { runsOn: boolean, reason: string }>`, keyed by `'<workflow path>#<job id>'`. + The workflow path is what `workflowFiles()` in `lib/workflows.mjs` returns. + - `isRunsOnJob(job: object, ref?: string): boolean`. + The result is true when `job['runs-on']` is a string that starts with `runs-on=`. + The result is also true when `MATRIX_RUNNERS[ref]?.runsOn` is true. - Produces, in `scripts/ffi-release-matrix.mjs`: `runnerFor(platform: string, runId = process.env.GITHUB_RUN_ID): string` and `releaseMatrix(triples, runId = process.env.GITHUB_RUN_ID)`. - [x] **Step 1: Merge `main` into #1419's branch** -The branch `ci/heavy-jobs-runs-on` already has a worktree, at `.claude/worktrees/agent-a7c8ac844ed823b0f`. Check that `git status` is clean there. Then run: +The branch `ci/heavy-jobs-runs-on` already has a worktree, at `.claude/worktrees/agent-a7c8ac844ed823b0f`. +Check that `git status` is clean there. +Then run: ```bash git fetch origin @@ -140,11 +219,15 @@ pnpm install --frozen-lockfile pnpm run test:scripts ``` -Expected: PASS. Resolve each conflict by keeping `main`'s lines, plus the branch's `runs-on:`, Docker Hub login, and apt lock changes. A test failure at this step comes from the merge, so fix it before going on. +Expected: PASS. +Resolve each conflict by keeping `main`'s lines, plus the branch's `runs-on:`, Docker Hub login, and apt lock changes. +A test that fails at this step fails because of the merge. +Fix the failure before you go on. - [x] **Step 2: Write `scripts/__tests__/lib/runs-on.mjs`** -Implement the interface above. `MATRIX_RUNNERS` contains exactly these entries: +Implement the interface above. +`MATRIX_RUNNERS` contains exactly these entries: ```js export const MATRIX_RUNNERS = { @@ -165,7 +248,10 @@ export const MATRIX_RUNNERS = { - [x] **Step 3: Write the failing tests in `scripts/__tests__/workflow-runs-on.test.mjs`** -Read every job with `workflowFiles()` and `readWorkflow()`, as `{ ref: '<file>#<id>', job }`. Two local helpers return references. `refsWhere(predicate)` returns the `ref` of each job that matches. `expressionRunnerRefs()` returns the `ref` of each job whose runner comes from an expression. +Read every job with `workflowFiles()` and `readWorkflow()`, as `{ ref: '<file>#<id>', job }`. +Two local helpers return references. +`refsWhere(predicate)` returns the `ref` of each job that matches. +`expressionRunnerRefs()` returns the `ref` of each job whose runner comes from an expression. ```js describe('RunsOn runner labels', () => { @@ -205,10 +291,14 @@ Each string that contains `${{` needs the `biome-ignore lint/suspicious/noTempla - [x] **Step 4: Update `scripts/__tests__/ffi-release-matrix.test.mjs`** -Import `runsOnLabel` from `./lib/runs-on.mjs`. Set `const RUN_ID = '1234'`, `const MATRIX = releaseMatrix(TRIPLES, RUN_ID)`, and `const RUNS_ON_4 = runsOnLabel(4, { runId: RUN_ID })`. Then: +Import `runsOnLabel` from `./lib/runs-on.mjs`. +Set `const RUN_ID = '1234'`, `const MATRIX = releaseMatrix(TRIPLES, RUN_ID)`, and `const RUNS_ON_4 = runsOnLabel(4, { runId: RUN_ID })`. +Then make these changes: -- The `linux-x64-gnu`, `linux-arm64-gnu`, and `linux-x64-musl` entries expect `os: RUNS_ON_4`. Their `script` and `log` stay as they are. -- The fallback test expects `runnerFor('linux-arm64-musl', RUN_ID)` to be `RUNS_ON_4`. Its comment says that a platform the table does not name builds on RunsOn. +- The `linux-x64-gnu`, `linux-arm64-gnu`, and `linux-x64-musl` entries expect `os: RUNS_ON_4`. + The `script` and `log` of those entries stay as they are. +- The fallback test expects `runnerFor('linux-arm64-musl', RUN_ID)` to be `RUNS_ON_4`. + The comment in that test says that a platform the table does not name is built on RunsOn. - Keep the test that refuses an empty run ID: `expect(() => runnerFor('linux-x64-gnu', '')).toThrow(/GITHUB_RUN_ID/)`. - Add `expect(runnerFor('darwin-x64', '')).toBe('macos-latest')`, because only a RunsOn label needs the run ID. @@ -216,7 +306,10 @@ Import `runsOnLabel` from `./lib/runs-on.mjs`. Set `const RUN_ID = '1234'`, `con Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-runs-on.test.mjs scripts/__tests__/ffi-release-matrix.test.mjs` -Expected: FAIL. "names no Blacksmith label" lists the jobs still on Blacksmith. "uses only the labels ADR 0004 names" lists the `cpu=8` jobs. The FFI test shows `cpu=8` labels, and a Blacksmith label for musl. +Expected: FAIL. +The test "names no Blacksmith label" lists the jobs still on Blacksmith. +The test "uses only the labels ADR 0004 names" lists the `cpu=8` jobs. +The FFI test shows `cpu=8` labels, and a Blacksmith label for musl. - [x] **Step 6: Replace the labels in the workflows** @@ -229,15 +322,30 @@ sed -i \ .github/workflows/*.yml ``` -The last two lines undo #1419's sizes. On `main`, every 16 vCPU label is Ubuntu 22.04, and every 4 vCPU label is Ubuntu 24.04. So the image of a `cpu=8` job shows its Blacksmith size. +The last two `-e` expressions undo #1419's sizes. +On `main`, every 16 vCPU label is Ubuntu 22.04. +Every 4 vCPU label on `main` is Ubuntu 24.04. +So the image of a `cpu=8` job shows its Blacksmith size. -The publish jobs get `extras=s3-cache` too. It has no effect in a job with no cache step. `scripts/lint-no-workflow-caching.mjs` keeps the publish jobs free of cache steps. +The labels of the publish jobs contain `extras=s3-cache` too. +`extras=s3-cache` has no effect in a job with no cache step. +`scripts/lint-no-workflow-caching.mjs` makes sure the publish jobs have no cache steps. - [x] **Step 7: Change `runnerFor` in `scripts/ffi-release-matrix.mjs`** -A `win32` platform gives `windows-latest`, and a `darwin` platform gives `macos-latest`. Neither needs the run ID. Every other platform gives the 4 vCPU label, with the run ID in place of the expression. An empty run ID throws an error that names `GITHUB_RUN_ID`. +For a `win32` platform, `runnerFor` returns `windows-latest`. +For a `darwin` platform, `runnerFor` returns `macos-latest`. +Neither label needs the run ID. +For every other platform, `runnerFor` returns the 4 vCPU label, with the run ID in place of `${{ github.run_id }}`. +If that run ID is empty, `runnerFor` throws an error that names `GITHUB_RUN_ID`. + +Rewrite the doc comment to say three things: + +- Darwin and Windows need GitHub-hosted images for their SDKs. +- Every Linux platform is built on a RunsOn machine with 4 vCPUs, the size it had on Blacksmith. +- A matrix value cannot read `${{ github.run_id }}`, so the run ID is passed in. -Rewrite the doc comment to say three things. Darwin and Windows need GitHub-hosted images for their SDKs. Every Linux platform builds on a RunsOn machine with 4 vCPUs, its size on Blacksmith. A matrix value cannot read `${{ github.run_id }}`, so the run ID is passed in. Remove #1419's sentences about build times and about musl staying on Blacksmith. +Remove #1419's sentences about build times, and about musl staying on Blacksmith. - [x] **Step 8: Empty the self-hosted label list in `.github/actionlint.yaml`** @@ -255,19 +363,27 @@ self-hosted-runner: labels: [] ``` -In `.github/workflows/lint-release.yml`, change "for the Blacksmith runner label" at line 9 to "for its self-hosted runner labels". Change "the config it resolves the Blacksmith label from" at line 22 to "the config it reads runner labels from". +In `.github/workflows/lint-release.yml`, change "for the Blacksmith runner label" at line 9 to "for its self-hosted runner labels". +Change "the config it resolves the Blacksmith label from" at line 22 to "the config it reads runner labels from". - [x] **Step 9: Run the tests to see them pass** Run: `pnpm run test:scripts` -Expected: PASS, with one exception. `workflow-docker-hub-login.test.mjs` now checks every moved job, and lists those that pull an image with no login. Task 3 adds those logins. `workflow-mise-cache-image.test.mjs` passes, because each job keeps its Ubuntu version. +Expected: PASS, with one exception. +`workflow-docker-hub-login.test.mjs` now checks every moved job. +The login test lists each moved job that pulls an image with no login. +Task 3 adds those logins. +`workflow-mise-cache-image.test.mjs` passes, because each job keeps its Ubuntu version. - [x] **Step 10: Run actionlint on the release workflows** -Run the `actionlint` command from the "actionlint (release workflows)" step of `lint-release.yml`. Start it with `mise x go -- go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7` in place of `actionlint`. +Run the `actionlint` command from the "actionlint (release workflows)" step of `lint-release.yml`. +Start the command with `mise x go -- go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7` in place of `actionlint`. -Expected: no output, and exit code 0. The release workflows now carry RunsOn labels, so this also shows that actionlint skips a label with an expression. +Expected: no output, and exit code 0. +The release workflows now contain RunsOn labels. +So this result also shows that actionlint skips a label that contains an expression. - [x] **Step 11: Check the counts and what is left** @@ -279,7 +395,15 @@ git grep -h 'cpu=4/image=ubuntu24-full-x64' -- .github/workflows | wc -l git grep -n -E 'cpu=8|blacksmith-' -- .github scripts/ffi-release-matrix.mjs ``` -Expected: the first two numbers match, and so do the next two. At `0a0fb63ec` they were 31 and 24. The last command lists only comments. They say why some jobs use GitHub-hosted runners, and one names an arm64 label in `_build-auth-artifacts.yml`. +Expected: + +- The first two numbers are equal. + At `0a0fb63ec`, this pair was 31. +- The next two numbers are equal. + At `0a0fb63ec`, this pair was 24. +- The last command lists only comments. + The comments say why some jobs use GitHub-hosted runners. + One comment names an arm64 label in `_build-auth-artifacts.yml`. - [x] **Step 12: Commit** @@ -290,7 +414,8 @@ git commit -S -m "ci(runners): move every Blacksmith job to a RunsOn machine of ### Task 3: Log in to Docker Hub on every RunsOn job that pulls an image -This task is done. Two #1419 commits made these changes: `ci(runners): log in to Docker Hub before every RunsOn job pulls an image` and `ci(runners): log in before the README walkthrough pulls its database`. +This task is done. +Two commits in #1419 made these changes: `ci(runners): log in to Docker Hub before every RunsOn job pulls an image` and `ci(runners): log in before the README walkthrough pulls its database`. **Files:** - Modify: `scripts/__tests__/workflow-docker-hub-login.test.mjs` @@ -300,17 +425,27 @@ This task is done. Two #1419 commits made these changes: `ci(runners): log in to **Interfaces:** - Consumes: `isRunsOnJob(job, ref)` from `scripts/__tests__/lib/runs-on.mjs`, made in Task 2. - Produces, in `workflow-docker-hub-login.test.mjs`: - - `jobFindings(where: string, job: object, ref?: string): string[]`. Its RunsOn check becomes `isRunsOnJob(job, ref)`. - - `callerFinding(job: object): string | null`. It returns null when `job.secrets` is `'inherit'`. It also returns null when `job.secrets` maps `DOCKER_HUB_USERNAME` to `${{ secrets.DOCKER_HUB_USERNAME }}` and `DOCKER_HUB_PASSWORD` to `${{ secrets.DOCKER_HUB_PASSWORD }}`. Otherwise it returns a message that names each missing secret. + - `jobFindings(where: string, job: object, ref?: string): string[]`. + The RunsOn check in `jobFindings` becomes `isRunsOnJob(job, ref)`. + - `callerFinding(job: object): string | null`. + `callerFinding` returns null when `job.secrets` is `'inherit'`. + `callerFinding` also returns null when `job.secrets` maps `DOCKER_HUB_USERNAME` to `${{ secrets.DOCKER_HUB_USERNAME }}` and `DOCKER_HUB_PASSWORD` to `${{ secrets.DOCKER_HUB_PASSWORD }}`. + Otherwise, `callerFinding` returns a message that names each missing secret. - [x] **Step 1: Write the failing tests** In `workflow-docker-hub-login.test.mjs`: -- Replace the local `isRunsOn` with `isRunsOnJob`. `runsOnJobs()` builds `ref` as `${file}#${name}` and passes it to `jobFindings`. -- Rewrite the last paragraph of the header comment. A job counts as RunsOn when its label starts with `runs-on=`. It also counts when `MATRIX_RUNNERS` in `lib/runs-on.mjs` says its matrix gives it RunsOn machines. -- Raise the count in "finds the jobs it checks" from 20 to 50. -- Add `it('passes the Docker Hub secrets to every called workflow whose RunsOn jobs log in')`. Take each job whose `uses` starts with `./.github/workflows/`, and read the workflow it calls. When one of that workflow's RunsOn jobs has a step with `loginFinding(step) === null`, `callerFinding(job)` must be null. Collect each failure as `<file>#<job>: <finding>`, and expect `[]`. +- Replace the local `isRunsOn` with `isRunsOnJob`. + `runsOnJobs()` builds `ref` as `${file}#${name}`, and passes `ref` to `jobFindings`. +- Rewrite the last paragraph of the header comment to say the following. + A job counts as RunsOn when its label starts with `runs-on=`. + A job also counts as RunsOn when `MATRIX_RUNNERS` in `lib/runs-on.mjs` says its matrix gives it RunsOn machines. +- Raise the count in the test "finds the jobs it checks" from 20 to 50. +- Add `it('passes the Docker Hub secrets to every called workflow whose RunsOn jobs log in')`. + For each job whose `uses` starts with `./.github/workflows/`, read the workflow that the job calls. + When one of that workflow's RunsOn jobs has a step with `loginFinding(step) === null`, `callerFinding(job)` must be null. + Collect each failure as `<file>#<job>: <finding>`, and expect `[]`. - Add these unit cases: ```js @@ -326,20 +461,28 @@ expect(jobFindings('w j', { 'runs-on': '${{ matrix.cfg.os }}', steps: [up] }, '. Run: `pnpm exec vitest run --config scripts/vitest.config.mjs scripts/__tests__/workflow-docker-hub-login.test.mjs` -Expected: FAIL. "logs in before every pull" lists each job that pulls an image with no login before it. The list includes `_build-ffi-artifacts.yml binaries`. +Expected: FAIL. +The test "logs in before every pull" lists each job that pulls an image with no login before it. +The list includes `_build-ffi-artifacts.yml binaries`. - [x] **Step 3: Add a login before each pull the test lists** -Copy the "Log in to Docker Hub" step, with its comment, from a `test-eql.yml` job that has one. Put it right before the step that the finding names. A service or job container from Docker Hub instead gets the `credentials:` expression and comment from the `encryption-postgres` service in `test-eql.yml`. +Copy the "Log in to Docker Hub" step, with its comment, from a `test-eql.yml` job that has one. +Put the copy directly before the step that the finding names. +For a service container or a job container from Docker Hub, use the `credentials:` expression and its comment instead. +Copy both from the `encryption-postgres` service in `test-eql.yml`. - [x] **Step 4: Give the musl FFI build its login and its secrets** In `.github/workflows/_build-ffi-artifacts.yml`: - Under `on.workflow_call`, declare both secrets with `required: false`. -- Add the login step right before "Build the binding in Alpine (linux-x64-musl)", with `if: ${{ matrix.cfg.platform == 'linux-x64-musl' }}`. The macOS and Windows legs have no Docker. Without the condition, `docker login` would fail there once the secrets exist. +- Add the login step directly before "Build the binding in Alpine (linux-x64-musl)", with `if: ${{ matrix.cfg.platform == 'linux-x64-musl' }}`. + The macOS and Windows legs of the matrix have no Docker. + Without the condition, `docker login` would fail on those legs once the secrets exist. -In `release.yml`, in the job that calls `_build-ffi-artifacts.yml`, pass both secrets. Do the same in the `artifacts` job of `ffi-preflight.yml`: +In `release.yml`, in the job that calls `_build-ffi-artifacts.yml`, pass both secrets. +Do the same in the `artifacts` job of `ffi-preflight.yml`: ```yaml secrets: @@ -347,15 +490,19 @@ In `release.yml`, in the job that calls `_build-ffi-artifacts.yml`, pass both se DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} ``` -Pass these two by name, not with `secrets: inherit`. The called workflow then receives no other secret of the release workflow. +Pass these two secrets by name, not with `secrets: inherit`. +The called workflow then receives no other secret of the release workflow. - [x] **Step 5: Run the tests to see them pass** -Run: `pnpm run test:scripts`. Expected: PASS. +Run: `pnpm run test:scripts`. +Expected: PASS. - [x] **Step 6: Run actionlint on the release workflows** -Run: the command in Task 2, Step 10. Expected: no output, and exit code 0. actionlint fails when a caller passes a secret that the called workflow does not declare. +Run: the command in Task 2, Step 10. +Expected: no output, and exit code 0. +actionlint fails when a caller passes a secret that the called workflow does not declare. - [x] **Step 7: Commit** @@ -366,21 +513,34 @@ git commit -S -m "ci(runners): log in to Docker Hub before every RunsOn job pull ### Task 4: Wait for the apt lock on every RunsOn job -This task is done. Two #1419 commits made these changes: `test(ci): require every RunsOn job to wait for the apt lock` and `ci(runners): retry apt-get update until boot-time apt lets go`. +This task is done. +Two commits in #1419 made these changes: `test(ci): require every RunsOn job to wait for the apt lock` and `ci(runners): retry apt-get update until boot-time apt lets go`. -#1419 added `-o DPkg::Lock::Timeout=300` to the two `apt-get` steps that run on RunsOn. Nothing yet stops a new step without it. +Pull request #1419 added `-o DPkg::Lock::Timeout=300` to the two `apt-get` steps that run on RunsOn. +Nothing yet stops a new step that leaves the option out. -`DPkg::Lock::Timeout` makes apt wait for the dpkg lock only. `apt-get update` takes the package-list lock instead. It does not wait for that lock, with or without the option. So `apt-get update` can still fail at once on a fresh machine. +`DPkg::Lock::Timeout` makes apt wait only for the dpkg lock. +`apt-get update` takes the package-list lock instead. +`apt-get update` does not wait for the package-list lock, with or without the option. +So `apt-get update` can still fail at once on a new machine. -#1419's commit `ci(runners): retry apt-get update until boot-time apt lets go` handles this. Each `apt-get update` runs in a loop of up to 20 tries, 15 seconds apart, that ends with `&& break`. `aptFinding` also fails on an `apt-get update` line without `&& break`. +The commit `ci(runners): retry apt-get update until boot-time apt lets go` in #1419 handles this case. +Each `apt-get update` runs in a loop of up to 20 tries, 15 seconds apart. +The `apt-get update` line in the loop ends with `&& break`. +`aptFinding` also returns a finding for an `apt-get update` line that has no `&& break`. **Files:** - Modify: `scripts/__tests__/workflow-runs-on.test.mjs` -- Modify: each workflow or local action the test lists. None is expected. +- Modify: each workflow or local action the test lists. + None is expected. **Interfaces:** - Consumes: `isRunsOnJob(job, ref)`, made in Task 2. -- Produces: `aptFinding(run: string): string | null`, exported from `workflow-runs-on.test.mjs`. It ignores comment lines. It looks for a line that runs `apt` or `apt-get` with `update`, `install`, `upgrade`, `dist-upgrade`, `remove`, `purge`, or `autoremove`. When such a line has no `DPkg::Lock::Timeout=`, it returns a message that names the line. Otherwise it returns null. +- Produces: `aptFinding(run: string): string | null`, exported from `workflow-runs-on.test.mjs`. + `aptFinding` ignores comment lines. + The function looks for a line that runs `apt` or `apt-get` with `update`, `install`, `upgrade`, `dist-upgrade`, `remove`, `purge`, or `autoremove`. + When such a line has no `DPkg::Lock::Timeout=`, the function returns a message that names the line. + Otherwise, the function returns null. - [x] **Step 1: Write the failing tests** @@ -413,7 +573,9 @@ Expected: FAIL with "aptFinding is not defined". - [x] **Step 4: Run the tests to see them pass** -Run: the command in Step 2. Expected: PASS. If the second test lists a step, add `-o DPkg::Lock::Timeout=300` after each `apt-get` in that step. +Run: the command in Step 2. +Expected: PASS. +If the second test lists a step, add `-o DPkg::Lock::Timeout=300` after each `apt-get` in that step. - [x] **Step 5: Commit** @@ -424,7 +586,8 @@ git commit -S -m "test(ci): require every RunsOn job to wait for the apt lock" ### Task 5: Check the branch, and update #1419 -This task is done. The FFI run in Step 5 is GitHub Actions run 45574782571, from 25 November 2026. +This task is done. +The FFI run in Step 5 is GitHub Actions run 45574782571, from 25 November 2026. **Files:** no new files. @@ -436,7 +599,9 @@ pnpm run lint:workflow-cache pnpm run code:check ``` -Expected: all three pass. `code:check` fails on errors only, and may print warnings. +Expected: all three pass. +`code:check` fails only on errors. +The check may still print warnings. - [x] **Step 2: Check that no job name changed** @@ -444,48 +609,71 @@ Expected: all three pass. `code:check` fails on errors only, and may print warni git diff origin/main...HEAD -U0 -- .github/workflows | grep -E '^[-+][[:space:]]+(- )?name:' ``` -The three dots compare with the commit where the branch left `main`. Without them, the diff also shows `main`'s newer changes, as if the branch had made them. +With three dots, `git diff` compares with the commit where the branch left `main`. +Without them, the diff also shows `main`'s newer changes, as if the branch had made them. -Expected: only added lines that read `+ - name: Log in to Docker Hub`. A removed or changed job `name:` means the diff changes more than ADR 0004 allows. +Expected: only added lines that read `+ - name: Log in to Docker Hub`. +A removed or changed job `name:` means the diff changes more than ADR 0004 allows. - [x] **Step 3: Push** Run: `git push origin ci/heavy-jobs-runs-on` -Expected: a normal push. If git refuses because the remote branch moved, stop and tell the user. +Expected: a normal push. +If git refuses because the remote branch moved, stop and tell the user. - [x] **Step 4: Update the title and body of #1419** -Use the meta-pr-creation skill. The title is `ci(runners): move every Blacksmith job to a RunsOn machine of the same size`. The body says what changes, why, and how to check it. It points to ADR 0004 for the cost reasons. Keep the pull request a draft, and set both with `gh pr edit 1419 --title <title> --body-file <file>`. +Use the meta-pr-creation skill. +The title is `ci(runners): move every Blacksmith job to a RunsOn machine of the same size`. +The body says what changes, why, and how to check it. +The body points to ADR 0004 for the cost reasons. + +Set the title and body with `gh pr edit 1419 --title <title> --body-file <file>`. +Keep the pull request a draft. - [x] **Step 5: Run the FFI build on RunsOn** -The release workflows do not run on a pull request. `ffi-preflight.yml` runs the FFI build without publishing anything: +The release workflows do not run on a pull request. +`ffi-preflight.yml` runs the FFI build without publishing anything: ```bash gh workflow run ffi-preflight.yml --ref ci/heavy-jobs-runs-on -f ref=ci/heavy-jobs-runs-on ``` -Expected: the two gnu legs pass. The musl leg fails as it does on `main`, for the reason in #1380. The wrapper job is skipped, because it needs the musl leg. +Expected: the two gnu legs pass. +The musl leg fails as it does on `main`, for the reason in #1380. +The wrapper job is skipped, because it needs the musl leg. - [x] **Step 6: Watch the pull request's CI run** -Run: `gh pr checks 1419 --watch`. Read each failed job's log with `gh run view <run-id> --log-failed`. +Run: `gh pr checks 1419 --watch`. +Read each failed job's log with `gh run view <run-id> --log-failed`. -- **Killed for lack of memory:** the log shows exit code 137, "Killed", or "signal: 9, SIGKILL". Change that job's `family=c8a+m8a` to `family=m8a`. Run `pnpm run test:scripts`, then commit with the message `ci(runners): give <job name> 4 GB per vCPU on m8a`, and push. -- **`toomanyrequests` from Docker Hub:** report the job to the user. The secrets may not exist yet. Or the jobs may have used all 200 pulls that the free account allows in 6 hours. ADR 0004 names the source of that figure. -- **Any other failure:** compare it with the same job's latest run on `main`. Report it to the user with an excerpt from each log. +- **Killed for lack of memory:** the log shows exit code 137, "Killed", or "signal: 9, SIGKILL". + Change that job's `family=c8a+m8a` to `family=m8a`. + Run `pnpm run test:scripts`. + Then commit with the message `ci(runners): give <job name> 4 GB per vCPU on m8a`, and push. +- **`toomanyrequests` from Docker Hub:** report the job to the user. + The secrets may not exist yet. + Or the jobs may have used all 200 pulls that the free account allows in 6 hours. + ADR 0004 names the source of that figure. +- **Any other failure:** compare it with the same job's latest run on `main`. + Report the failure to the user, with an excerpt from each log. ### Task 6: Record the decision and this plan in #1416 -This task is done. #1416's commit `docs(ci): record the same-size swap from Blacksmith to RunsOn` made these changes. +This task is done. +The commit `docs(ci): record the same-size swap from Blacksmith to RunsOn` in #1416 made these changes. **Files:** - Modify: `docs/adr/0004-same-size-swap-from-blacksmith-to-runs-on.md`, to `status: accepted` - Add: `docs/superpowers/plans/2026-11-19-same-size-swap-blacksmith-to-runs-on.md` - Add: the uncommitted changes to `.github/CONTEXT.md`, ADR 0002, and ADR 0003 -Work in the worktree of branch `docs/ci-cost-decisions`. Leave out the CSV and PDF files at the repository root. They are local data, not documentation. +Work in the worktree of branch `docs/ci-cost-decisions`. +Leave out the CSV and PDF files at the repository root. +Those files are local data, not documentation. - [x] **Step 1: Set the ADR's status** @@ -500,4 +688,7 @@ git commit -S -m "docs(ci): record the same-size swap from Blacksmith to RunsOn" - [x] **Step 3: Push and update #1416** -Run `git push`. Then add one paragraph to the body of #1416. It says that ADR 0004 supersedes ADR 0002 and pauses ADR 0003. Keep the pull request a draft. +Run `git push`. +Then add one paragraph to the body of #1416. +The paragraph says that ADR 0004 supersedes ADR 0002, and pauses ADR 0003. +Keep the pull request a draft.