fix(772,792): close the fix-round review — the doc still described the semantics the fix reversed

The re-review's one HIGH was mine and was the obvious one to miss: the previous commit changed
the preflight so an unverifiable answer FAILS, and left a `docs/ci-cd.md` paragraph two
screens away still saying "anything else is reported as could-not-tell". That paragraph is
the one an operator reads when the job goes red, and it would have talked them into
reinstating the defect. Replaced with the full arm table, including the two rows the first
draft got wrong and why.

  * "gates nothing" was false in the way this repo has recorded before (#598): the
    merge-consent hook reads the COMBINED status, so a red preflight blocks the merge like
    any other red job. It does not SKIP the jobs it diagnoses; that is the accurate claim,
    in ci-cd.md and in the remote-state row.
  * The production retry defaults were evaluated by nothing — every test overrode both
    knobs. A test now drops the overrides and measures three attempts and a real pause, so
    editing the default to 1/0 (which would falsify the "a blip does not redden a PR"
    argument) goes red.
  * `journalctl -u gitea | grep ExecuteCleanupRules` is not a reproduction: that identifier
    reaches the log only through slow-query warnings, so an empty grep on a healthy host
    reads as "the rule never ran" — the inverse. Replaced with the admin cron API, which
    answers deterministically.
  * The recovery recipe's `docker buildx use default` needs the containerd image store to
    `--push` (both named hosts have it, checked today) and mutated the operator's builder
    selection without restoring it.
  * The stub's comment claimed both halves of real curl's transport failure mattered; only
    the exit status is observable, because `|| resp=""` discards what curl printed.
  * The empty-half credential refusal echoed the username; it needs no value at all. The
    401/403 arm aborts the remaining pins while 404 continues — deliberate, now stated.
  * `curl -u "$VAR"` puts a credential in argv, and this job runs container-free on a shared
    host. NOT fixed here: it is the shape all five `scripts/` callers already use, so fixing
    one site leaves the class and splits the codebase. Filed as #821 and named at the site.

refs #772
refs #792
This commit is contained in:
2026-08-22 23:48:20 +02:00
parent 0cf355e494
commit 30640bb780
4 changed files with 72 additions and 9 deletions
+36 -5
View File
@@ -1610,10 +1610,17 @@ package — every `:<sha>` older than the 15-slot window gone, every `keep_patte
`26.3.1`. Reproduce both halves on the Gitea host (LXC 119, `192.168.1.95`):
```bash
# on the Gitea host: the rule itself
sqlite3 /var/lib/gitea/data/gitea.db 'select * from package_cleanup_rule;'
journalctl -u gitea --since 2026-08-11 --until 2026-08-14 | grep ExecuteCleanupRules
# from anywhere: that the cleanup task is scheduled and has been running (schedule/prev/exec_times)
curl -s -u user:pass http://192.168.1.95:3000/api/v1/admin/cron?limit=50 \
| jq '.[] | select(.name == "cleanup_packages")'
```
(Do **not** reach for `journalctl -u gitea | grep ExecuteCleanupRules` — that identifier reaches the
log only via slow-query warnings, so an empty grep on a healthy host would read as "the rule never
ran", which is the inverse of what it means.)
If a pin disappears again *after* #842 changes that rule, treat this cause as refuted rather than
re-applying it — something else is deleting tags.
@@ -1621,9 +1628,30 @@ re-applying it — something else is deleting tags.
resolves every pin in `docker-build.yml` against the registry on every run and fails with a message
that names the tag. It is container-free by necessity — a job consuming the missing image could not
run to report it — and deliberately **not** a `needs:` of the five jobs it diagnoses: the container
jobs already fail fast, so gating them would tax every green run to speed up a rare red one. Only
HTTP 404 is treated as "gone"; anything else (a 5xx, an unreachable host) is reported as
could-not-tell, and rejected credentials fail the job rather than passing as unknown.
jobs already fail fast, so gating them would tax every green run to speed up a rare red one.
**Everything it cannot establish is a FAILURE, not a warning**, and the arms are worth knowing
because they send you to different places:
| Answer | Job | Message says |
|---|---|---|
| HTTP 200 with a manifest body | green | resolves |
| HTTP 404 | **red** | `IS GONE` — rebuild the tag (recovery above) |
| HTTP 200, body is not a manifest | **red** | something is answering for the registry (proxy, login page) |
| 401 / 403 | **red** | the credentials were rejected — fix the secrets |
| anything else (5xx, unreachable, no `curl`) | **red** after `ETV_CI_ATTEMPTS` tries | `could NOT VERIFY` — check the registry's health, NOT the pin |
| `ETV_REGISTRY_AUTH` unset, or either half empty | **red**, before any query | an absent secret interpolates to `":"`, which is not a credential |
The first draft warned and exited 0 on the last two rows. Both cold reviews found it independently
and they were right: that makes a missing `curl` or a moved registry indistinguishable from a healthy
pin, and the job would have been green forever having checked nothing. The unknown arm retries first
(`ETV_CI_ATTEMPTS`, default 3, `ETV_CI_RETRY_SECONDS` apart) so an ordinary registry blip does not
redden a PR.
**It is not a `needs:` of anything, but it is not consequence-free either.** The merge-consent hook
reads the PR's **combined** status and denies on any non-`success` context (ersatztv#598), so a red
preflight blocks the merge exactly like any other red job. "Advisory" would be the wrong word for
it — what it does not do is *skip* the jobs it diagnoses.
**Recovery, without needing CI to be healthy.** The tag names a commit, and that commit still builds
the same image, so the fastest fix is to republish the *same* tag by hand — no PR, no pin bump, no
@@ -1643,12 +1671,15 @@ cd /tmp/etv-toolchain
# driver the same inline config ci-image.yml passes it:
# [registry."192.168.1.95:3000"]
# http = true
docker buildx use default
prev_builder=$(docker buildx inspect --bootstrap 2>/dev/null | awk '/^Name:/{print $2; exit}')
docker buildx use default # needs the containerd image store to --push;
# both named hosts have it (checked 2026-08-22)
docker login 192.168.1.95:3000 -u timothy
docker buildx build --platform linux/amd64 --provenance=false \
-f docker/ci/Dockerfile -t "192.168.1.95:3000/timothy/ersatztv-ci:$pin" --push .
cd "$repo" && git worktree remove /tmp/etv-toolchain
docker buildx use "$prev_builder" # leave the operator's builder as you found it
```
Then confirm the tag resolves before re-running anything — the preflight script does exactly this
+1 -1
View File
@@ -128,7 +128,7 @@ classifications differ; otherwise the strictest applies and the Note names the e
| `scripts/ci-peak-anon.sh` | `N/A` | Reads no live remote state — samples the runner's local cgroup `memory.stat`/`memory.peak`. |
| `scripts/ci-prove-ban-detects.sh` | `N/A` | Reads no live remote state — mutates a local workflow copy and runs pytest against the local checkout. |
| `scripts/ci-step-ran.sh` | `N/A` | Reads no live remote state — reads runner-supplied env vars and local marker files it wrote itself. |
| `scripts/ci-toolchain-image-resolves.sh` — registry manifest read for the pinned toolchain tag | `UNSAFE-KNOWN` | Reads a MUTABLE identifier (a registry tag) with nothing re-checking it before the `container:` jobs pull, so a tag deleted between the preflight and the pull is reported as present. Graded `UNSAFE-KNOWN` rather than `N/A` deliberately: it authorizes nothing — it can only turn its own non-required job red — but a stale PASS is read by a human as "the image is fine", which is an assertion about remote state this file exists to grade. The residual is bounded by what it degrades to: a stale pass leaves exactly the pre-#772 behaviour (five jobs failing at pull), never anything that proceeds on the strength of the read. The opposite error is closed rather than accepted, and closed by the EXIT CODE rather than by wording: an unusable credential, an unverifiable answer (after retries) and an HTTP 200 whose body is not a manifest all FAIL the job. An earlier draft warned and exited 0 on those, which would have let a missing `curl` or a moved registry keep the job green forever — "the check could not run" presenting as "the pin is fine", which is the thing this row would otherwise be asserting falsely. |
| `scripts/ci-toolchain-image-resolves.sh` — registry manifest read for the pinned toolchain tag | `UNSAFE-KNOWN` | Reads a MUTABLE identifier (a registry tag) with nothing re-checking it before the `container:` jobs pull, so a tag deleted between the preflight and the pull is reported as present. Graded `UNSAFE-KNOWN` rather than `N/A` deliberately: nothing proceeds on the strength of the read — it can only turn its own job red, which is not nothing (the merge-consent hook denies on the COMBINED status, ersatztv#598) but is not authorization either — while a stale PASS is read by a human as "the image is fine", which is an assertion about remote state this file exists to grade. The residual is bounded by what it degrades to: a stale pass leaves exactly the pre-#772 behaviour (five jobs failing at pull), never anything that proceeds on the strength of the read. The opposite error is closed rather than accepted, and closed by the EXIT CODE rather than by wording: an unusable credential, an unverifiable answer (after retries) and an HTTP 200 whose body is not a manifest all FAIL the job. An earlier draft warned and exited 0 on those, which would have let a missing `curl` or a moved registry keep the job green forever — "the check could not run" presenting as "the pin is fine", which is the thing this row would otherwise be asserting falsely. |
| `scripts/set-provider.sh` | `N/A` | Reads no live remote state — sets local `dotnet user-secrets` values. |
| `scripts/__init__.py` | `N/A` | Empty package marker — executes nothing. |
| `scripts/scripted-schedules/entrypoint.py` — `ScriptedScheduleApi.get_context(build_id)`, then `define_content` / `reset_playout` / `build_playout` against the same live server | `UNSAFE-KNOWN` | A genuine read-then-act over live ErsatzTV state, and the row cold review found missing when the population was still non-recursive. The context is fetched, handed to user-supplied script functions that mutate the playout, and re-fetched after a reset with nothing pinning either read — a concurrent build or edit between them is invisible. Accepted because it runs inside a single scripted-schedule build the server itself serialises per playout, and because the API exposes no version or ETag on the context to compare against; the honest bound is that the blast radius is one playout's content, reversible by rebuilding. |