Skip to content

fix(publish-verify): demonstrate the gate's red state in CI on every run (#930) - #983

Merged
bpalermo merged 2 commits into
mainfrom
fix/publish-verify-red-state
Sep 27, 2026
Merged

bpalermo merged 2 commits into
mainfrom
fix/publish-verify-red-state

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Why

The artifact gate's only demonstrated red state was a real defect: 1e31e3a published unsigned (#929). That red aged out of the --recent window three runs later, and nothing had been fixed. Since then the gate's failure path has been asserted, not shown (#853). #978 proved the red once, locally. This PR makes every publish-verify run prove it again.

What

Expected-red control, on every publish-verify run (scripts/publish-verify-control.sh). It runs as its own step before the gate:

  • Control commit: built at run time with git commit-tree. It uses origin/main's tree, has origin/main as its parent, and carries a fixed identity and fixed dates, so the same base always gives the same sha. No ref points at it and it is never pushed, so no publish can ever have produced it, and it cannot age out. A pinned sha (ef44437, 1e31e3a) or "the newest non-push-head in the activity log" both age out: the second finds nothing on any month without a stack merge. The commit's tree is main's real tree, so the verifier asks the registry for real, correctly shaped coordinates (real Chart.yaml versions). Only the sha is one that was never published.

  • Checks that the red has the right cause. All of these must hold:

    • the verifier exits exactly 1;
    • there are exactly 20 MISSING lines (4 charts + 8 images + 8 signatures, derived from ghcr-lib.sh), and every one names the control sha;
    • there is no ok line;
    • all 12 tag scans are non-empty. "not found in 0 tags" means the registry was not read, not that the artifact is absent;
    • the summary line reads FAIL: 20 of 20 artifact(s) missing across 1 commit(s).

    If the verifier exits 2, the control reports inconclusive (exit 2).

  • Workflow: two clearly named steps, Expected-red control and Gate. The control writes neither verify.log nor the job summary, so its MISSING lines can never file the "artifacts missing" issue. The gate runs whatever the control concluded. A failed control files its own rolling issue, "publish-verify: the expected-red control did not go red".

Offline check in ci's shell job (scripts/check-publish-verify-control.sh, no network). This is #930's option 1. It drives the real, unmodified verifier against a fake registry: ghcr-lib.sh with its three network functions overridden, copied next to the verifier in a temp dir. 10 cases:

  • Accepts:
    • the real verifier on a non-empty registry that lacks the control sha (control exit 0, verifier printed FAIL: 20 of 20);
    • a hand-written correct red.
  • Deterministic: the same base gives the same control sha, and that sha is not the base.
  • Rejects:
    • a mutated verifier whose absent() no longer counts, so it prints MISSING but exits 0;
    • the real verifier on EMPTY tag lists;
    • a MISSING line naming another commit;
    • a stray ok line;
    • a perfect red printout with exit 0.
  • Inconclusive: a verifier that exits 2 makes the control exit 2.

Mutation-tested: when I dropped the control's "exit 0 ⇒ fail" branch, only the exit-0 stub case went red (1 FAIL, exit 1). Every other assertion is backed by at least one case.

docs/runbook.md: the publish-verify section gains a paragraph on the control.

Validation (local)

  • Control against real GHCR: exit 0. Control sha 04aa13cba3627ff8283f57ccf308e378a71e1e47, built from 1ad4b6a. The verifier inside it exited 1: FAIL: 20 of 20 artifact(s) missing across 1 commit(s), 20/20 MISSING naming the control sha, tag scans 220–914 each.
  • Gate, --recent on today's main: exit 0, 13 push head(s) … (4 non-head commit(s) skipped), PASS: 260 artifact(s) present across 13 commit(s).
  • scripts/check-publish-verify-control.sh: 10/10.
  • bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //scripts/... is clean. make format-check is clean. check-shell-lint.sh covers all 28 scripts. Both workflows parse as YAML.

Finding, not fixed here

My first --recent run went red: FAIL: 1 of 260, the cni-install signature for d526bf2 (sha256-217b6449…). The same tag was present minutes later, and a rerun passed. During the first run a publish (9891ae0, 11:24Z) was pushing, and cni-install's tag count moved 898 → 902. That points at ghcr_all_tags pagination dropping a tag under concurrent writes, which would make the gate cry wolf. It needs its own issue.

Not run

  • The workflow has not run in Actions. In particular, git commit-tree on the runner (no git identity configured; the script passes identity via env) and GHCR_TOKEN: github.token for the control's registry reads were not exercised there.
  • The vacuous-gate issue step has not been exercised.

Closes #930

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

bpalermo and others added 2 commits September 27, 2026 09:00
…run (#930)

The artifact gate's only demonstrated red was a real defect (1e31e3a, #929)
that aged out of the sweep window with nothing fixed, leaving a gate whose
failure path was asserted rather than shown (#853).

- scripts/publish-verify-control.sh: the expected-red control. Builds a
  commit with `git commit-tree` on origin/main's tree (fixed identity and
  dates, so deterministic per base; never pushed, no ref), runs the verifier
  on it and asserts it goes red for the right reason: exit exactly 1, 20
  MISSING lines all naming that sha, no `ok` line, 12 non-empty tag scans,
  and the `FAIL: 20 of 20` summary. Verifier exit 2 is inconclusive (2).
  A constructed commit never ages out; a pinned one (ef44437, 1e31e3a) does.
- publish-verify.yaml: the control runs before the gate on every trigger, in
  its own step; the gate runs regardless of the control's outcome; a failed
  control files its own rolling issue, separate from "artifacts missing".
- scripts/check-publish-verify-control.sh (ci.yaml `shell` job, no network):
  drives the REAL verifier against a fake registry (#930 option 1) and shows
  the control rejects a verifier that stopped counting MISSING, empty tag
  listings, a MISSING line for another commit, a stray `ok`, and a perfect red
  with exit 0; accepts a correct red; reports exit 2 as inconclusive.
- docs/runbook.md: publish-verify paragraph.

Closes #930

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
@bpalermo
bpalermo force-pushed the fix/publish-verify-red-state branch from dd03294 to 42d5640 Compare September 27, 2026 12:01
@bpalermo
bpalermo merged commit 1ee7250 into main Sep 27, 2026
24 checks passed
@bpalermo
bpalermo deleted the fix/publish-verify-red-state branch September 27, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

publish-verify: the artifact gate has no demonstrated red state, and the one it had just aged out

1 participant