fix(794): an EMPTY Proves: trailer was skipped in silence
review-verdict/h10 Review-verdict: MERGEABLE @ 163522f (base: main)
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 11s
PR Gates / Docs update reminder (pull_request) Successful in 11s
Build ErsatzTV Image / Delimiter ban (release path) (pull_request) Successful in 20s
PR Gates / decisions lifecycle (pull_request) Successful in 14s
PR Gates / Fix proofs (Proves trailers) (pull_request) Successful in 11s
Review verdict / Set review-verdict status (pull_request_target) Successful in 12s
PR Gates / Script tests (pytest) (pull_request) Successful in 3m38s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 9m18s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 6m45s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Skipped
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 6m37s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 8s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 5s

Cold review of the delta returned MERGEABLE with one MEDIUM it judged below the
blocking bar but would fold in before merge. Folding it in, because it is the same
script/CI asymmetry the previous commit set out to close.

`%(trailers:key=Proves,valueonly)` renders a bare `Proves:` as an EMPTY line, so
counting non-empty value lines missed a commit whose FIRST trailer is empty: the
multi-trailer guard did not fire, `sel` came out empty, and `[ -n "$sel" ] || continue`
dropped the commit without a word — with a real second selector never checked. If such
a commit were a PR's only claim, the job would print "No commit in this PR carries a
'Proves:' trailer", which is then simply false. No false PROVEN, but a claim that reads
as absent is still a claim that never ran.

Counting trailer PRESENCE (`%(trailers:key=Proves)`) catches it, and a present-but-empty
trailer is now refused loudly. Verified on both of the reviewer's scenarios: the
empty-first case counts 1 by the old expression and 2 by the new one, and a lone bare
trailer now errors instead of being skipped.

Also from the same review:
- docs/ci-cd.md had the direction backwards — a wobble DOES redden this job (exit 5 on a
  harness failure or signal); what the exit-code discipline buys is that a GREEN can
  never come from a cancelled or broken run. Reworded.
- the PR-gates enumeration still said "four git-only gates"; there are five, and
  prove-fix is the one that is not merely checkout + git diff.
- the last unqualified copy of the retracted SIGTERM claim now says "in the draft", and
  a 150-char comment line was rewrapped.

Verified: scripts/tests 681 passed, 2 skipped; yaml parses; bash -n clean; no line over
100 chars in the script.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-16 12:00:34 +02:00
co-authored by Claude Opus 5
parent 6e79c155f1
commit 163522fb3a
3 changed files with 23 additions and 6 deletions
+15 -1
View File
@@ -271,7 +271,13 @@ jobs:
# explicitly, so the guard was bypassed on the one path that actually enforces.
# Measured: a commit with two trailers reported PROVEN while the second was never
# run. Fixing the script and not its twin is how a guard reads as coverage.
if [ "$(printf '%s\n' "$raw" | grep -c .)" -gt 1 ]; then
# Count trailer PRESENCE, not non-empty values: `%(...valueonly)` renders a bare
# `Proves:` as an empty line, so counting non-empty lines misses a commit whose
# FIRST trailer is empty — `sel` then comes out empty and the commit is skipped
# in silence, with a real second selector never checked. Fail-open in CI while
# the script is fail-closed is the same asymmetry this guard exists to remove.
present="$(git show -s --format='%(trailers:key=Proves)' "$sha")"
if [ "$(printf '%s\n' "$present" | grep -c .)" -gt 1 ]; then
claimed=$((claimed + 1)); failed=$((failed + 1))
echo "::error::commit $sha carries more than one 'Proves:' trailer; only the" \
"first would be checked, so the rest would read as proven without ever" \
@@ -279,6 +285,14 @@ jobs:
continue
fi
sel="$(printf '%s\n' "$raw" | head -1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
# A trailer that is PRESENT but empty is a claim with no selector. Refuse it
# loudly; skipping it silently would let the job report "no claims" for a PR that
# made one.
if [ -n "$present" ] && [ -z "$sel" ]; then
claimed=$((claimed + 1)); failed=$((failed + 1))
echo "::error::commit $sha carries a 'Proves:' trailer with no selector."
continue
fi
[ -n "$sel" ] || continue
claimed=$((claimed + 1))
+5 -3
View File
@@ -899,8 +899,10 @@ Three refusals worth knowing before you write a trailer:
**Only pytest exit 1 counts as red.** 2 is an interrupted collection, 3 internal, 4 usage, 5 nothing
collected, 143 a signal; `--continue-on-collection-errors` converts a genuine collection failure to
1 so add-a-file fixes stay provable. The job inherits that, so a red here means a claim failed, not
that the runner wobbled.
1 so add-a-file fixes stay provable. The job inherits that. Note the direction: a wobble DOES redden
this job (`prove-fix.sh` exits 5 on a harness/git failure or a signal, and the job turns that into an
error), so what the exit-code discipline buys is the other way round — a **green** here means a claim
was witnessed, never that a run was cancelled or broke.
### `script-tests` job (`Script tests (pytest)`, PR-only — in `pr-checks.yml`)
@@ -995,7 +997,7 @@ assumed.
**File:** `.gitea/workflows/pr-checks.yml` — `on: pull_request` only.
The four git-only PR gates — `ci-image-pin`, `docs-reminder`, `decisions-guard`, `script-tests`
The five PR gates — `ci-image-pin`, `docs-reminder`, `decisions-guard`, `script-tests`, and `prove-fix` (the one member that is NOT merely checkout + `git diff`: it installs pytest and creates worktrees)
(all described above) — live here, **not** in `docker-build.yml`, and that separation is the fix
for **ersatztv#535**.
+3 -2
View File
@@ -17,7 +17,8 @@
# error, 5 nothing collected, and a killed run gives 143. Cold review measured a SIGTERM
# being read as red in an early DRAFT — cancellation masquerading as evidence. On the first
# COMMITTED version the reproducible false PROVEN is the marker case (a failed `cd` giving
# the subshell status 1), not the signal one; see the decision record. `--continue-on-collection-errors` is passed so a genuine collection failure
# the subshell status 1), not the signal one; see the decision record.
# `--continue-on-collection-errors` is passed so a genuine collection failure
# (what happens when the fix ADDED the module the test imports) is reported as a test
# error and exits 1 instead of vanishing into the ambiguous 2/3 band. Measured: pass 0,
# fail 1, collection-error 2 (1 with the flag), SIGTERM 143.
@@ -71,7 +72,7 @@ cleanup() {
}
# A signal must not look like a verdict: clean up, then exit non-zero EXPLICITLY. Without
# that explicit exit the handler falls through and the previous status stands, which is
# how a cancelled run printed PROVEN.
# how a cancelled run printed PROVEN in the draft.
on_signal() { cleanup; trap - EXIT; printf 'prove-fix: interrupted by signal\n' >&2; exit 5; }
trap cleanup EXIT
trap on_signal INT TERM