From cf5858bb606e472f2b459ae0f3f5327a49c67950 Mon Sep 17 00:00:00 2001 From: cluade-reviewer-andresmgsl Date: Mon, 27 Jul 2026 21:19:33 +0000 Subject: [PATCH] fix: one checksum policy, labeler coverage, orphaned-unit removal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Net-new review findings from grok and kimi on !110. Their items 1-3 were codex's, already fixed in 1933b07; these are the ones only they raised. grok #4 — the two downloaders would drift. docs/templates/ci-box/install.sh and the download block in forgejo-runner-install.sh were near-copies, and grok named the exact consequence with the exact evidence: fail-open survived in BOTH while a grep for "checksum mismatch" passed against both, because the string it looked for sat right beside the branch it could not see. The whole policy — fetch, unreadable, mismatch — is now fetch_and_verify_sha256, byte-identical in both files and diffed by test/cli.sh. They cannot share a lib: the command sources commands/lib/, and the template is a registry definition that runs standalone inside a mint with rig's tree nowhere in reach, which is the same situation valid_version faces between bin/rig and install.sh. Mutation-checked by drifting one copy's message and confirming the diff goes red. kimi #2 — the labeler could not see this family. scope:runner matched commands/runner-*.sh only, so forgejo-runner-*.sh and the staged ci-box definition scored no scope at all. Globs extended and the label's description now says either forge rather than GitHub. kimi #4 — remove stranded a unit whose user was gone. The missing-user check exited 0 before the unit was ever looked at, so a deleted account with a leftover forgejo-runner.service reported "nothing to remove" while the absence-assert that never ran implied the opposite. The unit is now checked independently. Auditing that fix surfaced a hazard kimi did not mention: with the user gone RUNNER_DIR is "", and the later unguarded "$RUNNER_DIR/.rig-labels" would have expanded to "/.rig-labels" — an rm at the filesystem root, as root. Every RUNNER_DIR path is now gated, and a test pins that none is unguarded. kimi #1 — the README handed out a config that breaks rig's own gates. DEFAULT_ACTIONS_URL is a single fallback and rig's workflows need two origins; measured: code.forgejo.org serves actions/checkout (200) but not heavy-duty/ceremony (404), which lives on the Forgejo instance. With the value the README recommended, all eight ceremony references fail to resolve. The section now states the conflict with the counts, says which references would break, and explicitly does NOT pick a side — that is an infra decision, and rig's CI running on Forgejo is not something rig forgejo-runner depends on. Asked the maintainer for direction. 746/31/43 pass, shellcheck clean, labeler.yml parses. forgejo#109 Co-Authored-By: Claude Opus 5 (1M context) --- .github/labeler.yml | 4 +- .github/labels.conf | 2 +- README.md | 22 ++++++++ commands/forgejo-runner-install.sh | 80 +++++++++++++++++++----------- commands/forgejo-runner-remove.sh | 48 +++++++++++++----- docs/templates/ci-box/install.sh | 74 ++++++++++++++++++--------- test/cli.sh | 49 +++++++++++++++--- 7 files changed, 207 insertions(+), 72 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 2328070..acb71bc 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -11,7 +11,9 @@ "scope:runner": - changed-files: - any-glob-to-any-file: - ["commands/runner-*.sh", "commands/lib/runner-config.sh"] + ["commands/runner-*.sh", "commands/lib/runner-config.sh", + "commands/forgejo-runner-*.sh", "commands/lib/forgejo-runner-config.sh", + "docs/templates/ci-box/**"] "scope:coolify": - changed-files: - any-glob-to-any-file: ["commands/coolify-*.sh"] diff --git a/.github/labels.conf b/.github/labels.conf index 94167b5..ef6116e 100644 --- a/.github/labels.conf +++ b/.github/labels.conf @@ -2,7 +2,7 @@ panel=claude-bot-andresmgsl codex-bot-andresmgsl grok-bot-andresmgsl kimi-bot-an triage-actors=dan-claude-bot scope:bootstrap|C5DEF5|bootstrap — hardening a pristine server into a node scope:users|C5DEF5|users-* — class model, apply/status, close-root -scope:runner|C5DEF5|runner-* — GitHub runner lifecycle +scope:runner|C5DEF5|runner-* / forgejo-runner-* — CI runner lifecycle, either forge scope:coolify|C5DEF5|coolify-* — Coolify and backup install scope:db|C5DEF5|db.sh — dump/restore scope:installer|C5DEF5|install.sh — how rig lands on a machine diff --git a/README.md b/README.md index 38ed5bb..ffd76ef 100644 --- a/README.md +++ b/README.md @@ -1174,6 +1174,28 @@ FORGEJO__actions__ENABLED=true FORGEJO__actions__DEFAULT_ACTIONS_URL=https://code.forgejo.org ``` +> **`DEFAULT_ACTIONS_URL` is a single fallback, and rig's own workflows need +> two origins.** It decides where a *bare* `uses: owner/repo@ref` resolves. +> Measured: +> +> | reference | count in `.github/workflows/` | `code.forgejo.org` | +> |---|---|---| +> | `actions/checkout@v4` | 3 | **200** — mirrored | +> | `heavy-duty/ceremony/...@0.3.0` | 8 | **404** — lives on this Forgejo instead | +> +> So with the value above, every ceremony guard (`changelog-armed`, +> `changelog-monotonic`, `changelog-assembled`, `drill-recorded`, +> `runner-isolated`, `docs-sync`, and the release/labels callers) fails to +> resolve the moment rig's CI actually runs on the forge. +> +> Forgejo accepts an absolute URL per step, so one side has to be explicit — +> which one is a **decision this PR does not make**. Either set the default to +> this instance and make the three `actions/*` references absolute +> (`uses: https://code.forgejo.org/actions/checkout@v4`), or keep the value +> above and make the eight ceremony references absolute. Until that lands, +> **rig's CI is not expected to run on Forgejo** — `rig forgejo-runner` is for +> running *your* repositories' workflows, and does not depend on this. + > **A registry served from Forgejo needs one more.** `RIG_TEMPLATES_HOST` > (below) lets the template registry live on any forge, but the mint-time fetch > is **unauthenticated by contract** — box auto-runs `rig bootstrap -box` diff --git a/commands/forgejo-runner-install.sh b/commands/forgejo-runner-install.sh index f6ce3d6..e3a6fb5 100755 --- a/commands/forgejo-runner-install.sh +++ b/commands/forgejo-runner-install.sh @@ -33,6 +33,55 @@ die() { printf 'rig-forgejo-runner: ERROR: %s\n' "$1" >&2; exit "${2:-1}"; } # from a shared CI server, and inside a box that boundary is already paid for. DEFAULT_LABELS='ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-22.04,docker:docker://node:22-bookworm' +# fetch_and_verify_sha256