fix(778): round 3 — fix the overclaim I left in the code, and defer the pre-existing ones to #803
Build ErsatzTV Image / Delimiter ban (release path) (pull_request) Successful in 18s
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 19s
PR Gates / Docs update reminder (pull_request) Successful in 22s
PR Gates / Fix proofs (Proves trailers) (pull_request) Successful in 14s
PR Gates / decisions lifecycle (pull_request) Successful in 26s
review-verdict/h10 Awaiting review verdict for 8e02b99
Review verdict / Set review-verdict status (pull_request_target) Successful in 17s
PR Gates / Script tests (pytest) (pull_request) Successful in 4m9s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 9m24s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 6m57s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Skipped
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 6m53s
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
Build ErsatzTV Image / Delimiter ban (release path) (pull_request) Successful in 18s
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 19s
PR Gates / Docs update reminder (pull_request) Successful in 22s
PR Gates / Fix proofs (Proves trailers) (pull_request) Successful in 14s
PR Gates / decisions lifecycle (pull_request) Successful in 26s
review-verdict/h10 Awaiting review verdict for 8e02b99
Review verdict / Set review-verdict status (pull_request_target) Successful in 17s
PR Gates / Script tests (pytest) (pull_request) Successful in 4m9s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 9m24s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 6m57s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Skipped
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 6m53s
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
Fourth cold review: no Blockers, 2 High / 2 Medium / 2 Low. It independently re-derived the population (59 files, 59 sites, 69 rows, 3 PINNED) and verified every numeric and factual claim in the diff, including the corrected confinement rationale. THE ONE THAT STINGS. The grant reason string still said a commit pushed before Gitea merges "will clear it and block the merge" — the exact sentence the new decision record quotes as THE overclaim this issue exists to remove. I documented it in three files and left it in the code a human actually reads. It now states the guarantee and its condition: the required check was confirmed rather than assumed, and it holds while that branch protection stands. FIXED HERE (all in files this PR already touches): - enable_status_check is validated as a BOOLEAN. `"true"` is not `true`, and comparing the string to `true` produced a confident deny from a payload never understood — the tri-state collapsing to two, the same defect as the contexts shape one line down. - `.statuses` members are validated, not just the array (see the honest caveat below). - the docs-reminder N/A rationale said "the job cannot fail and never reaches the combined status", which is false — any job's status joins the combined state. The true, narrower reason is that its fetch and diff are failure-swallowed, so the remote read can only change the warning's wording. - docs/README names the scripts/tests exclusion in BOTH statements. A VACUOUS TEST, CAUGHT BY ITS OWN MUTATION PROOF. The regression case for the `.statuses` member validation stays GREEN against the predecessor: the #632 base-retarget block runs first and already validates every member it consumes, so it catches the payload before the scheduled branch is reached. The two guards overlap — duplicate guards masking each other, again — which makes that finding LATENT, not live, and my added clause defence-in-depth rather than a fix. The test now asserts the observable contract (a decision is always emitted) and says plainly that it is not a mutation proof of the newer clause. Shipping it as one would have been the exact grade inflation round 2 rejected. DEFERRED to #803, with the reason stated rather than implied: a head-ABA (force-push H1 -> H2 -> H1 during pagination) defeats pr-changed-files.sh, and three OLDER contracts still assert more than the new inventory rows do. That residual predates #778 and lives in #707's mechanism; correcting another active decision record inside a PR already at four review rounds is how a scoped change stops being reviewable. The inventory rows are accurate today and now point at #803. refs #778 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -86,6 +86,9 @@ 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 == "STRING-ENABLE":
|
||||
respond('{"enable_status_check": "true",'
|
||||
' "status_check_contexts": ["review-verdict/h10"]}')
|
||||
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.
|
||||
@@ -121,6 +124,12 @@ if "/pulls/" in url and "/files" in url:
|
||||
sys.exit(0)
|
||||
|
||||
if "/status" in url:
|
||||
# A 2xx body whose `.statuses` IS an array but whose members are scalars. `.statuses | type ==
|
||||
# "array"` passes; indexing a number then makes jq exit 5 and, under `set -e`, kills the hook
|
||||
# with no JSON at all.
|
||||
if (state / "bp").read_text().strip() == "SCALAR-STATUS-ROW":
|
||||
print('{"state":"success","statuses":[1]}')
|
||||
sys.exit(0)
|
||||
print(json.dumps({"state": "success", "statuses": [
|
||||
{"context": "review-verdict/h10", "status": "success",
|
||||
"description": "Review-verdict: MERGEABLE @ %s (base: main)" % os.environ["STUB_SHORT"]}]}))
|
||||
@@ -349,3 +358,39 @@ def test_an_IMMEDIATE_merge_is_not_subjected_to_this_check(hook):
|
||||
reason = hook.reason(scheduled=False)
|
||||
assert "NOT a required status check" not in reason, (
|
||||
"the required-check deny fired on an immediate merge, which has no post-scheduling window")
|
||||
|
||||
|
||||
def test_a_NON_BOOLEAN_enable_status_check_asks(hook):
|
||||
"""`"true"` is not `true`. Comparing the string to `true` yields a confident "no" -> deny from a
|
||||
payload never understood, which collapses the documented tri-state into two states. Every
|
||||
malformed shape on this endpoint has to reach the same ask arm."""
|
||||
hook.set_branch_protection("STRING-ENABLE")
|
||||
reason = hook.reason()
|
||||
assert "ask" in reason, "a string enable_status_check produced a decision instead of a question"
|
||||
assert "NOT a required status check" not in reason
|
||||
|
||||
|
||||
def test_a_SCALAR_status_row_asks_instead_of_killing_the_hook(hook):
|
||||
"""The consent hook's contract is that it always emits exactly one of grant/deny/ask, and
|
||||
`{"statuses":[1]}` is the payload that can break it: it passes an `.statuses | type == "array"`
|
||||
check, after which indexing a number errors and exits 5, which under `set -e` aborts the hook
|
||||
with NO JSON at all. A gate that emits nothing has not failed closed; it has failed to decide.
|
||||
|
||||
WHAT THIS TEST DOES *NOT* PROVE, stated because the mutation showed it. Restoring the
|
||||
scheduled-branch validation to its predecessor leaves this test GREEN, because the #632
|
||||
base-retarget block runs FIRST and already validates every member it consumes — so it catches
|
||||
this payload and asks before the scheduled branch is ever reached. The two guards overlap, which
|
||||
is the masking shape `duplicate guards mask each other` describes, and it means the member
|
||||
validation added to the scheduled branch is DEFENCE IN DEPTH against a reordering or a removal
|
||||
of the earlier block, not a fix for a reachable live defect.
|
||||
|
||||
So this asserts the OBSERVABLE contract — a decision is always emitted for this payload — which
|
||||
is true and worth pinning whichever guard supplies it. It is deliberately not offered as a
|
||||
mutation proof of the newer clause, because it is not one.
|
||||
"""
|
||||
hook.set_branch_protection("SCALAR-STATUS-ROW")
|
||||
decision = hook.decision()
|
||||
assert decision is not None, (
|
||||
"the hook emitted no decision at all for a malformed statuses payload — it neither granted, "
|
||||
"denied nor asked")
|
||||
assert decision["hookSpecificOutput"]["permissionDecision"] == "ask"
|
||||
|
||||
Reference in New Issue
Block a user