fix(778): round 2 — recursive population, and grade down five more overclaims
Build ErsatzTV Image / Delimiter ban (release path) (pull_request) Successful in 22s
PR Gates / Fix proofs (Proves trailers) (pull_request) Successful in 14s
PR Gates / Docs update reminder (pull_request) Successful in 23s
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 9s
PR Gates / decisions lifecycle (pull_request) Successful in 24s
review-verdict/h10 Awaiting review verdict for 84b4c11
Review verdict / Set review-verdict status (pull_request_target) Successful in 22s
PR Gates / Script tests (pytest) (pull_request) Successful in 4m10s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 9m22s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Canceled after 5m4s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Canceled after 0s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Canceled after 0s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Canceled after 0s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Canceled after 0s

Second cold review: no Blockers, 4 High / 1 Medium / 2 Low. All accepted.

POPULATION, WRONG A SECOND TIME. Round 1 removed a content filter that had
omitted `git fetch`. Round 2 found the replacement traversal used non-recursive
`Path.glob`, so four nested files were still outside it — including
scripts/scripted-schedules/entrypoint.py, which calls get_context() against a live
ErsatzTV server and then drives define_content/reset_playout/build_playout off the
result. Now rglob, with scripts/tests/ as the single stated DIRECTORY-level
exclusion (a scope choice, reviewable in one line; not a predicate over content).
Population 55 -> 59, rows 63 -> 68.

The generalisation is in the record, because the deliverable made the same mistake
twice: the scope may be hand-written, but anything narrowing the POPULATION has to
be executed and its output compared against the filesystem — the members it drops
are invisible by construction. That is the #774 rule turned on the artifact meant
to enforce it.

FIVE MORE OVERCLAIMS GRADED DOWN. Both merge-consent head/base rows (the hook
returns `allow` and a separate call merges, so the window is small, not absent —
"no async window" was simply false); the release smoke pull and the ci-image verify
(the concurrency group is PER-REF, so a branch build and a tag build of one commit
can publish the same :<short-sha>); and the workflow base-fetch rows, which are not
advisory — the merge hook reads the COMBINED status, so any red context blocks the
auto-grant. Also fixed a stale cross-reference where the enumeration row still said
it "inherits that row's pins" from a row graded down in the same commit.

Four PINNED rows survive out of 68. That ratio is the honest finding.

CIRCULAR JUSTIFICATION REMOVED. The scheduled-merge row said its residual was
"closed one layer down" by the very branch protection an admin may have removed.
It is not closed, it is BOUNDED by a trust assumption, and the row now says so.

Low: jq's `//` fires on `false` as well as null, so `status_check_contexts: false`
was defaulted to [] and produced a confident deny from a shape never understood —
absent and null are now defaulted explicitly, everything else is "unknown". And the
title sentence claimed "every executable in this repo" while the guard covers four
directories; both it and the docs/README entry now say what is actually enforced.

refs #778

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-16 13:44:10 +02:00
co-authored by Claude Opus 5
parent a0849eec58
commit 84b4c11188
6 changed files with 107 additions and 25 deletions
@@ -86,6 +86,10 @@ if "/branch_protections/" in url:
# string is substring search, so the naive membership test answers "yes" here.
respond('{"enable_status_check": true,'
' "status_check_contexts": "prefix-review-verdict/h10-suffix"}')
if mode == "FALSE-CONTEXTS":
# jq's `//` alternative fires on FALSE as well as null, so `// []` silently turned this
# malformed shape into an empty list and produced a confident deny.
respond('{"enable_status_check": true, "status_check_contexts": false}')
if mode == "NON-STRING-MEMBER":
respond('{"enable_status_check": true, "status_check_contexts": [7, "review-verdict/h10"]}')
if mode == "EMPTY-CONTEXTS":
@@ -252,6 +256,15 @@ def test_an_empty_or_null_contexts_list_DENIES_rather_than_asking(hook, shape):
f"{shape} was treated as unreadable rather than as a confirmed absent required check")
def test_a_FALSE_contexts_value_asks_rather_than_denying(hook):
"""jq's `//` alternative fires on `false`, not only on null, so `// []` mapped this malformed
payload to an empty list and answered "no" — a confident deny derived from a shape that was
never understood. Absent and null are defaulted explicitly; everything else is unknown."""
hook.set_branch_protection("FALSE-CONTEXTS")
reason = hook.reason()
assert "ask" in reason, "a false contexts value was defaulted to [] and produced a deny"
def test_a_non_string_MEMBER_inside_the_array_asks(hook):
"""`[7, "review-verdict/h10"]` contains the context, but the payload is not the shape this
guard knows how to reason about. Answering "yes" would mean trusting a structure we cannot
@@ -323,10 +336,15 @@ def test_an_UNREADABLE_branch_protection_asks_rather_than_denying_or_passing(hoo
def test_an_IMMEDIATE_merge_is_not_subjected_to_this_check(hook):
"""Scope, deliberately narrow. Without `merge_when_checks_succeed` there is no async window:
the merge happens now, against the head just verified. The required check is what protects the
SCHEDULED path specifically, so denying an immediate merge over branch-protection config would
block a safe operation and invite the guard being switched off wholesale."""
"""Scope, deliberately narrow — and stated without the overclaim cold review removed.
An immediate merge is not window-FREE: the hook returns `allow` and a separate call performs the
merge, so a push can still land in between. What it lacks is a SCHEDULER — nothing waits on
pending checks, so the gap is one tool call rather than however long CI takes. The required
branch-protection check is what protects the scheduled path specifically, so extending this deny
to immediate merges would block a materially safer operation and invite the whole guard being
switched off. The residual on this path is carried in docs/remote-state-inventory.md.
"""
hook.set_branch_protection("MISSING-CONTEXT")
reason = hook.reason(scheduled=False)
assert "NOT a required status check" not in reason, (
+33 -8
View File
@@ -15,11 +15,20 @@ The split is deliberate and mirrors `test_guard_inventory.py`:
* whether a `PINNED` row is TELLING THE TRUTH is not checked here and cannot be. That stays with
review, and the inventory's prose is what review reads.
SCOPE vs POPULATION, per `testing.guard-derives-population-from-source`: the scope (which
directories, and the outbound-network token set) is a hand-written policy choice. The population
inside that scope is derived every run. The token filter deliberately OVER-includes — a file
mentioning `curl` only in a comment still needs a row — because over-inclusion costs one row and
under-inclusion costs a blind spot.
SCOPE vs POPULATION, per `testing.guard-derives-population-from-source`: the SCOPE — four
directories, two file extensions, and one excluded subdirectory — is a hand-written policy choice
and is reviewable as one. The POPULATION inside that scope is derived on every run, RECURSIVELY,
with no content predicate at all: a file that reads no remote state earns an explicit `N/A` row
rather than staying out.
That wording is the third version, and the history is the point. The first filtered the scope by an
outbound-network token list, which omitted `git fetch` — this repo's commonest remote read — so a
hook that fetches `origin/main` and derives a push decision was invisible. The second dropped the
filter but used non-recursive `glob`, so four nested files were invisible, including one that calls
a live ErsatzTV API and acts on the reply. Both were the same error at different depths: a
completeness claim resting on a traversal nobody had compared against the filesystem. Hence the
anti-vacuity floor below, and hence the scope being stated as directories rather than as a
predicate over content.
"""
from __future__ import annotations
@@ -55,6 +64,19 @@ SCOPE = (
(REPO_ROOT / ".gitea" / "workflows", ("*.yml",)),
)
# RECURSIVE. `Path.glob` is not, and the second cold review found the consequence: four nested files
# were outside the population, one of them `scripts/scripted-schedules/entrypoint.py`, which calls
# `get_context` against a live ErsatzTV server and then acts on the result. That is the third time
# this population has been found incomplete, each time by a different mechanism — first a content
# filter that omitted `git fetch`, then a non-recursive glob. Both were the same error: a claim of
# completeness resting on a traversal nobody had checked against the filesystem.
#
# `scripts/tests/` is the one DIRECTORY-level exclusion, and it is a scope decision rather than a
# content filter: those files run only under pytest, authorize nothing, and their only network calls
# are to stub executables the tests themselves place on PATH. Excluding a directory is reviewable in
# one line; excluding files by what they contain is what kept failing.
EXCLUDED_DIRS = (REPO_ROOT / "scripts" / "tests",)
# `| ` + backticked path, optionally followed by ` — <site description>`, then the class cell.
_ROW = re.compile(r"^\|\s*`([^`]+?)`[^|]*\|\s*`([^`]+)`\s*\|", re.M)
@@ -66,9 +88,12 @@ def derived_population() -> set[str]:
if not directory.is_dir():
continue
for pattern in globs:
for path in sorted(directory.glob(pattern)):
if path.is_file():
found.add(path.relative_to(REPO_ROOT).as_posix())
for path in sorted(directory.rglob(pattern)):
if not path.is_file():
continue
if any(excluded in path.parents for excluded in EXCLUDED_DIRS):
continue
found.add(path.relative_to(REPO_ROOT).as_posix())
return found