Deploy the runner Guest with the server's, and snapshot it first (CP-42) #25

Merged
pit merged 1 commit from hermes/cp42-prod-runner into main 2026-11-06 21:38:06 +00:00
Owner

Don't merge until the deploy token has its grant on /vms/145. Today infra-actions@pve!deploy holds TofuGuestInPlace on /vms/143 only: the rows for 145 went with the old Guest. Merged as it is, this deploy goes red at runner-snapshot, after 143's snapshot and before anything changes. The Operator's grant is at the bottom.

CP-42's last criterion: the next merge deploys both Guests and leaves a predeploy-* snapshot on 143 and on 145. The service layer already configured both through site.yml. The Guest step and the snapshot covered 143 alone.

Summary

-PROD_STEPS := snapshot guest service verify
+PROD_STEPS := snapshot runner-snapshot guest runner-guest service verify
make prod NONINTERACTIVE=1
  snapshot         143: vmid from semaphore/guest's state  -> scripts/snapshot.sh 143
  runner-snapshot  145: vmid from runner/guest's state, on the RUNNER_STATE_* pair -> scripts/snapshot.sh 145
  guest            plan semaphore/guest, judge, apply
  runner-guest     plan runner/guest, judge, apply        (existing Target; the judge stands in for the word)
  service          site.yml: server -> runner -> server marks it default
  verify           143's UI answers 200
  • Both restore points exist before either Guest changes, so a red runner-snapshot has still changed nothing.
  • runner-snapshot uses the same script, name shape and prune as the server's snapshot. The prune counts per Guest, so each keeps its own newest three.
  • guest_identity takes the Stack's directory as an optional third argument. It defaults to semaphore/guest, so every existing caller is unchanged.
  • RUNNER_GUEST_IDENTITY := runner_identity is new. Nothing defined it before.
  • deploy.yml (comments and the step name) and docs/deploy.md (the step list) are updated to match.

Evidence

  • The composition: make -n prod NONINTERACTIVE=1 shows snapshot, runner-snapshot, guest, runner-guest, service, verify. Both runner steps export RUNNER_STATE_AWS_* onto AWS_* and cd into runner/guest.
  • New cases in make plan-test:
    • prod snapshots both guests before either changes: the step order, read off make -n.
    • the runner snapshot reads 145 from the runner state: scripts/snapshot.sh (a stand-in) is handed 145 from the runner Stack's state, with no server Stack in the sandbox. tofu saw the runner record's key and not the server's. A state with no vmid is refused (no runner Guest to snapshot), and nothing is snapshotted.
  • Mutation check: I reverted PROD_STEPS and dropped the directory argument, then ran the cases. They went red: plan tests: 4 case(s) FAILED. Then I restored the Makefile byte-identical.
  • make check → exit 0: env tests: every case passed., plan tests: every case passed. The package fixture still reports skip, because the machine has no dpkg.
  • The deploy's own credentials against 145, today, read-only. The command was make runner-guest-plan, with the runner's deploy pair and infra-actions@pve!deploy in a scratch .env, shredded afterwards:
proxmox_virtual_environment_container.semaphore_runner: Refreshing state... [id=145]
Error: error retrieving container: received an HTTP 403 response - Reason: Permission check failed (/vms/145, VM.Audit)
  • The deploy's .env already carries the runner's pair. Run 61 logged secret/tofu-state/semaphore-runner/deploy → RUNNER_STATE_AWS_ACCESS_KEY_ID RUNNER_STATE_AWS_SECRET_ACCESS_KEY (rev 2), fetched as cockpit.
  • Not yet run: a real snapshot of 145, and the runner's apply from the deploy. Both are first exercised by this merge, after the grant.

Merge Danger

Door: two-way.

With the grant in place, the merge snapshots both Guests and plans both Stacks. Both plans read No changes today. Then it re-runs the service layer, a no-op on an unchanged tree. Without the grant, the run is red at runner-snapshot and nothing changes. 143 just gets one extra predeploy-* snapshot, and its prune keeps three.

Blast Radius: the deploy.

Every future deploy now also needs the runner Stack's state readable, 145 reachable through the API, and VM.Snapshot on it. A 145 that's down or unreadable now reds the whole deploy, where before it reddened only the service step.

The grant (Operator)

This mirrors 143's rows exactly: the user and the token, propagate 0. With privsep the token can't exceed its user, so both rows are needed.

ssh root@10.12.0.4 "pveum acl modify /vms/145 --roles TofuGuestInPlace --users infra-actions@pve --propagate 0 \
  && pveum acl modify /vms/145 --roles TofuGuestInPlace --tokens 'infra-actions@pve!deploy' --propagate 0 \
  && pveum user token permissions infra-actions@pve deploy --path /vms/145"

Undo: the same two lines with pveum acl delete /vms/145 …. infra-secrets' docs/proxmox-credentials.md already records this grant, so after it the doc is true again.

> **Don't merge until the deploy token has its grant on `/vms/145`.** Today `infra-actions@pve!deploy` holds `TofuGuestInPlace` on `/vms/143` only: the rows for 145 went with the old Guest. Merged as it is, this deploy goes red at `runner-snapshot`, after 143's snapshot and before anything changes. The Operator's grant is at the bottom. CP-42's last criterion: *the next merge deploys both Guests and leaves a `predeploy-*` snapshot on 143 and on 145.* The service layer already configured both through `site.yml`. The Guest step and the snapshot covered 143 alone. ## Summary ```diff -PROD_STEPS := snapshot guest service verify +PROD_STEPS := snapshot runner-snapshot guest runner-guest service verify ``` ```text make prod NONINTERACTIVE=1 snapshot 143: vmid from semaphore/guest's state -> scripts/snapshot.sh 143 runner-snapshot 145: vmid from runner/guest's state, on the RUNNER_STATE_* pair -> scripts/snapshot.sh 145 guest plan semaphore/guest, judge, apply runner-guest plan runner/guest, judge, apply (existing Target; the judge stands in for the word) service site.yml: server -> runner -> server marks it default verify 143's UI answers 200 ``` - Both restore points exist before either Guest changes, so a red `runner-snapshot` has still changed nothing. - `runner-snapshot` uses the same script, name shape and prune as the server's snapshot. The prune counts per Guest, so each keeps its own newest three. - `guest_identity` takes the Stack's directory as an optional third argument. It defaults to `semaphore/guest`, so every existing caller is unchanged. - `RUNNER_GUEST_IDENTITY := runner_identity` is new. Nothing defined it before. - `deploy.yml` (comments and the step name) and `docs/deploy.md` (the step list) are updated to match. ## Evidence - **The composition:** `make -n prod NONINTERACTIVE=1` shows `snapshot`, `runner-snapshot`, `guest`, `runner-guest`, `service`, `verify`. Both runner steps export `RUNNER_STATE_AWS_*` onto `AWS_*` and `cd` into `runner/guest`. - **New cases in `make plan-test`:** - `prod snapshots both guests before either changes`: the step order, read off `make -n`. - `the runner snapshot reads 145 from the runner state`: `scripts/snapshot.sh` (a stand-in) is handed `145` from the runner Stack's state, with no server Stack in the sandbox. `tofu` saw the runner record's key and not the server's. A state with no vmid is refused (`no runner Guest to snapshot`), and nothing is snapshotted. - **Mutation check:** I reverted `PROD_STEPS` and dropped the directory argument, then ran the cases. They went red: `plan tests: 4 case(s) FAILED.` Then I restored the Makefile byte-identical. - `make check` → exit 0: `env tests: every case passed.`, `plan tests: every case passed.` The package fixture still reports `skip`, because the machine has no `dpkg`. - **The deploy's own credentials against 145, today, read-only.** The command was `make runner-guest-plan`, with the runner's deploy pair and `infra-actions@pve!deploy` in a scratch `.env`, shredded afterwards: ``` proxmox_virtual_environment_container.semaphore_runner: Refreshing state... [id=145] Error: error retrieving container: received an HTTP 403 response - Reason: Permission check failed (/vms/145, VM.Audit) ``` - The deploy's `.env` already carries the runner's pair. Run 61 logged `secret/tofu-state/semaphore-runner/deploy → RUNNER_STATE_AWS_ACCESS_KEY_ID RUNNER_STATE_AWS_SECRET_ACCESS_KEY (rev 2)`, fetched as `cockpit`. - **Not yet run:** a real snapshot of 145, and the runner's apply from the deploy. Both are first exercised by this merge, after the grant. ## Merge Danger **Door:** two-way. With the grant in place, the merge snapshots both Guests and plans both Stacks. Both plans read `No changes` today. Then it re-runs the service layer, a no-op on an unchanged tree. Without the grant, the run is red at `runner-snapshot` and nothing changes. 143 just gets one extra `predeploy-*` snapshot, and its prune keeps three. **Blast Radius:** the deploy. Every future deploy now also needs the runner Stack's state readable, 145 reachable through the API, and `VM.Snapshot` on it. A 145 that's down or unreadable now reds the whole deploy, where before it reddened only the service step. ## The grant (Operator) This mirrors 143's rows exactly: the user and the token, `propagate 0`. With `privsep` the token can't exceed its user, so both rows are needed. ```sh ssh root@10.12.0.4 "pveum acl modify /vms/145 --roles TofuGuestInPlace --users infra-actions@pve --propagate 0 \ && pveum acl modify /vms/145 --roles TofuGuestInPlace --tokens 'infra-actions@pve!deploy' --propagate 0 \ && pveum user token permissions infra-actions@pve deploy --path /vms/145" ``` Undo: the same two lines with `pveum acl delete /vms/145 …`. `infra-secrets`' `docs/proxmox-credentials.md` already records this grant, so after it the doc is true again.
Deploy the runner Guest with the server's, and snapshot it first (CP-42)
All checks were successful
plan / guest-plan-check (pull_request_target) Successful in 17s
plan / runner-guest-plan-check (pull_request_target) Successful in 14s
pr-checks / check (pull_request) Successful in 38s
6c576b9ab7
make prod becomes snapshot runner-snapshot guest runner-guest service
verify. Both Guests have a predeploy-* restore point before either
changes; each Stack is planned, judged and applied; then the service
layer configures both, as site.yml already did.

runner-snapshot reads 145's vmid out of the runner Stack's own state
with the runner's pair and calls the same snapshot script and prune, so
each Guest keeps its own newest three. guest_identity takes the Stack's
directory as an optional third argument for it.

Tests: prod's step order, and runner-snapshot handing the script 145
from the runner's state on the runner's pair, refusing a state with no
vmid. Both mutation-checked.
Member

Review started (round 1/5) on 6c576b9ab7 — reading the diff now.

**Review started** (round 1/5) on 6c576b9ab7a961c9f5b6829018e387a42019485e — reading the diff now.
bot-minos approved these changes 2026-11-06 21:37:00 +00:00
bot-minos left a comment

repo olympus/infra-cockpit · PR #25 · head 6c576b9ab7 · round 1/5 · verdict: merge (0 blockers, 1 advisory). The thread's count is the review list (empty) plus one; the dispatch said 1/5 too.

Recommendation: merge

Condition on the merge, not a finding: the PR's own hold stands. infra-actions@pve!deploy must hold TofuGuestInPlace on /vms/145 first, or the merge's deploy goes red at runner-snapshot. That is fail-closed (143 gets one extra predeploy-*, nothing else changes) and the author disclosed it. I could not read the Proxmox ACL from here, so the grant is unverified.

Spec source: CP-42 in Vikunja (project 11, index 42), read live; the PR body names it. The criterion this PR carries is the last one: "The next merge deploys both Guests and leaves a predeploy-* snapshot on 143 and on 145." The ticket's body line "make prod gains the runner's guest and service steps, and the snapshot covers 145" is the same claim.
Standards source: AGENTS.md (§Rules/Toolchain, §Docs, §Pull requests); no docs/adr/ in this repo. The org ADRs the repo defers to (ADR-0009/0010/0011) were not re-read: nothing in the diff touches their subjects (who deploys, what the judge refuses), and the deploy still applies only judged plans.

Standards

  1. ADVISORY — prose that enumerates the Targets using the runner's pair, or that runs the snapshot script, was not updated for runner-snapshot.
    • docs/environment.md:68: "make runner-guest-plan and make runner-guest put this pair on the backend's AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for their own run". runner-snapshot now does it too (Makefile:426 → runner_guest_stack_init → use_state_creds, Makefile:226).
    • scripts/snapshot.sh:3-5 (untouched): "make snapshot runs it with the vmid it read out of this repository's state; it is the first step of make prod". make runner-snapshot now runs it too, with the vmid from the runner's state.
    • Rests on AGENTS.md §Docs (the docs page owns where every environment name comes from) read for what it intends; the repo does not state a rule that docs change with the code, so this is advice. One finding, two sites.

Smell baseline: nothing worth a flag. Duplicated Code: runner-snapshot repeats snapshot's four-line shape, but it differs in preamble, identity, directory and words, and the author folded the shared part into guest_identity's optional third argument rather than copying it. Speculative Generality: the $(3) argument has a caller, Makefile:427.

Spec

No requirement missing, none partial, no scope creep. Every hunk maps to the criterion: PROD_STEPS (Makefile:61), the runner-snapshot Target (Makefile:425-430), guest_identity's directory argument (Makefile:169-171, 185), RUNNER_GUEST_IDENTITY (Makefile:37), the .PHONY entry (Makefile:266), the deploy.yml comment and step name, docs/deploy.md:67-88, and the two new cases (scripts/tests/plan-check.sh:374, :411). No finding on this axis.

What I verified, and how

All at the head worktree, refs/pull/25/head = 6c576b9… (resolved before and after the work; unchanged). Scratch: cache/scratch/infra-cockpit-25-r1/.

Claim Check Result
Composition make -n prod NONINTERACTIVE=1 prod: make lines read snapshot, runner-snapshot, guest, runner-guest, service, verify
Runner step uses the runner's pair and Stack make -n runner-snapshot RUNNER_STATE_* exported onto AWS_*, cd runner/guest, tofu output reads runner_identity/vmid; runner_identity exists at runner/guest/container.tf:65
make check green mise exec -- make check, rc captured before any pipe rc 0; plan tests: every case passed.; env tests, fmt-check pass
New cases can fail 7 one-line Makefile mutations, make plan-test on each A revert PROD_STEPS → 1 FAIL; B drop the directory argument → 3 FAIL; C snapshot after guest → 1 FAIL (the order case, not just membership); D server preamble in runner-snapshot → 4 FAIL; E wrong identity name → 2 FAIL; F runner-snapshot absent → 1 FAIL; G refusal removed → 3 FAIL. All mutations changed the file (checked with cmp)
Existing callers unchanged the unreadable-state refusal driven with a failing tofu stub, at head and at base 770c0f8 make snapshot prints the same sentence at both, naming cd semaphore/guest; make runner-snapshot names cd runner/guest, rc 2
env.map / .env.example carry the runner pair read at head rows present (env.map "actors=pit,cockpit … RUNNER_STATE_AWS_*"; .env.example:32-33), so runner-snapshot has its credentials in the deploy's .env
CI on the head get_commit_statuses pr-checks / check, plan / guest-plan-check, plan / runner-guest-plan-check: all success

Not verified: the PR's live evidence (the 403 … /vms/145, VM.Audit read, run 61's fetch line); a real snapshot of 145 and the runner's apply from the deploy token, which the author says are first exercised by this merge; the Proxmox grant itself. I have no credentials for PROD and ran none.

Named, not charged

  • .forgejo/workflows/deploy.yml:2 is now 99 characters in a header block wrapped near 80. The base already has two lines over 80 and the repo states no width rule.
  • make help pads the Target name to 14 characters (Makefile:269); runner-snapshot is 15, so its row runs into its description. runner-guest-plan (17) already does the same, and the diff did not introduce the format.
  • The PR body's "Don't merge until the grant" is a note in prose; nothing in the forge enforces it. The author's call, as the Operator holds the merge.

Summary

Axis Findings Worst
Standards 1 (0 blockers, 1 advisory) ADVISORY: docs/environment.md:68 and scripts/snapshot.sh:3-5 no longer enumerate the Targets correctly
Spec 0 none

The recommendation turns on blockers and the advisory count, not on weight: there is no blocker and one advisory, so merge. Merge only after the Operator's grant on /vms/145.

<!-- minos review-loop: repo=olympus/infra-cockpit pr=25 head=6c576b9ab7a961c9f5b6829018e387a42019485e round=1/5 axes=standards,spec --> repo olympus/infra-cockpit · PR #25 · head 6c576b9ab7a961c9f5b6829018e387a42019485e · round 1/5 · verdict: merge (0 blockers, 1 advisory). The thread's count is the review list (empty) plus one; the dispatch said 1/5 too. Recommendation: merge **Condition on the merge, not a finding:** the PR's own hold stands. `infra-actions@pve!deploy` must hold `TofuGuestInPlace` on `/vms/145` first, or the merge's deploy goes red at `runner-snapshot`. That is fail-closed (143 gets one extra `predeploy-*`, nothing else changes) and the author disclosed it. I could not read the Proxmox ACL from here, so the grant is **unverified**. **Spec source:** CP-42 in Vikunja (project 11, index 42), read live; the PR body names it. The criterion this PR carries is the last one: *"The next merge deploys both Guests and leaves a `predeploy-*` snapshot on 143 and on 145."* The ticket's body line "`make prod` gains the runner's guest and service steps, and the snapshot covers 145" is the same claim. **Standards source:** `AGENTS.md` (§Rules/Toolchain, §Docs, §Pull requests); no `docs/adr/` in this repo. The org ADRs the repo defers to (ADR-0009/0010/0011) were not re-read: nothing in the diff touches their subjects (who deploys, what the judge refuses), and the deploy still applies only judged plans. ## Standards 1. **ADVISORY — prose that enumerates the Targets using the runner's pair, or that runs the snapshot script, was not updated for `runner-snapshot`.** - `docs/environment.md:68`: "`make runner-guest-plan` and `make runner-guest` put this pair on the backend's `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` for their own run". `runner-snapshot` now does it too (`Makefile:426` → `runner_guest_stack_init` → `use_state_creds`, `Makefile:226`). - `scripts/snapshot.sh:3-5` (untouched): "`make snapshot` runs it with the vmid it read out of this repository's state; it is the first step of `make prod`". `make runner-snapshot` now runs it too, with the vmid from the runner's state. - Rests on `AGENTS.md §Docs` (the docs page owns where every environment name comes from) read for what it intends; the repo does not state a rule that docs change with the code, so this is advice. One finding, two sites. Smell baseline: nothing worth a flag. `Duplicated Code`: `runner-snapshot` repeats `snapshot`'s four-line shape, but it differs in preamble, identity, directory and words, and the author folded the shared part into `guest_identity`'s optional third argument rather than copying it. `Speculative Generality`: the `$(3)` argument has a caller, `Makefile:427`. ## Spec No requirement missing, none partial, no scope creep. Every hunk maps to the criterion: `PROD_STEPS` (`Makefile:61`), the `runner-snapshot` Target (`Makefile:425-430`), `guest_identity`'s directory argument (`Makefile:169-171`, `185`), `RUNNER_GUEST_IDENTITY` (`Makefile:37`), the `.PHONY` entry (`Makefile:266`), the `deploy.yml` comment and step name, `docs/deploy.md:67-88`, and the two new cases (`scripts/tests/plan-check.sh:374`, `:411`). No finding on this axis. ## What I verified, and how All at the head worktree, `refs/pull/25/head` = `6c576b9…` (resolved before and after the work; unchanged). Scratch: `cache/scratch/infra-cockpit-25-r1/`. | Claim | Check | Result | | --- | --- | --- | | Composition | `make -n prod NONINTERACTIVE=1` | `prod: make` lines read `snapshot`, `runner-snapshot`, `guest`, `runner-guest`, `service`, `verify` | | Runner step uses the runner's pair and Stack | `make -n runner-snapshot` | `RUNNER_STATE_*` exported onto `AWS_*`, `cd runner/guest`, `tofu output` reads `runner_identity`/`vmid`; `runner_identity` exists at `runner/guest/container.tf:65` | | `make check` green | `mise exec -- make check`, rc captured before any pipe | rc 0; `plan tests: every case passed.`; env tests, fmt-check pass | | New cases can fail | 7 one-line Makefile mutations, `make plan-test` on each | A revert `PROD_STEPS` → 1 FAIL; B drop the directory argument → 3 FAIL; C snapshot after `guest` → 1 FAIL (the order case, not just membership); D server preamble in `runner-snapshot` → 4 FAIL; E wrong identity name → 2 FAIL; F `runner-snapshot` absent → 1 FAIL; G refusal removed → 3 FAIL. All mutations changed the file (checked with `cmp`) | | Existing callers unchanged | the unreadable-state refusal driven with a failing `tofu` stub, at head and at base `770c0f8` | `make snapshot` prints the same sentence at both, naming `cd semaphore/guest`; `make runner-snapshot` names `cd runner/guest`, rc 2 | | `env.map` / `.env.example` carry the runner pair | read at head | rows present (`env.map` "actors=pit,cockpit … RUNNER_STATE_AWS_*"; `.env.example:32-33`), so `runner-snapshot` has its credentials in the deploy's `.env` | | CI on the head | `get_commit_statuses` | `pr-checks / check`, `plan / guest-plan-check`, `plan / runner-guest-plan-check`: all `success` | **Not verified:** the PR's live evidence (the `403 … /vms/145, VM.Audit` read, run 61's fetch line); a real snapshot of 145 and the runner's apply from the deploy token, which the author says are first exercised by this merge; the Proxmox grant itself. I have no credentials for PROD and ran none. ## Named, not charged - `.forgejo/workflows/deploy.yml:2` is now 99 characters in a header block wrapped near 80. The base already has two lines over 80 and the repo states no width rule. - `make help` pads the Target name to 14 characters (`Makefile:269`); `runner-snapshot` is 15, so its row runs into its description. `runner-guest-plan` (17) already does the same, and the diff did not introduce the format. - The PR body's "Don't merge until the grant" is a note in prose; nothing in the forge enforces it. The author's call, as the Operator holds the merge. ## Summary | Axis | Findings | Worst | | --- | --- | --- | | Standards | 1 (0 blockers, 1 advisory) | ADVISORY: `docs/environment.md:68` and `scripts/snapshot.sh:3-5` no longer enumerate the Targets correctly | | Spec | 0 | none | The recommendation turns on blockers and the advisory count, not on weight: there is no blocker and one advisory, so merge. Merge only after the Operator's grant on `/vms/145`.
pit merged commit 2929e1e8bb into main 2026-11-06 21:38:06 +00:00
pit deleted branch hermes/cp42-prod-runner 2026-11-06 21:38:06 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
olympus/infra-cockpit!25
No description provided.