diff --git a/scripts/post-review-verdict.sh b/scripts/post-review-verdict.sh index 5d02a471b..28ecdfa84 100755 --- a/scripts/post-review-verdict.sh +++ b/scripts/post-review-verdict.sh @@ -301,9 +301,16 @@ fi # so the two stay wrong or right together. `.state` is accepted as a fallback only so a server that # spells it the other way degrades to working rather than to a deadlock; it is never a second source # of truth, because the value still has to EQUAL the state this run posted. -readback_state=$(printf '%s' "$readback_entry" | jq -r '(.status // .state) // ""') -readback_desc=$(printf '%s' "$readback_entry" | jq -r '.description // ""') -readback_creator=$(printf '%s' "$readback_entry" | jq -r '.creator.login // ""') +# Each extraction carries its own `|| die`. Without one they still fail closed — a jq error under +# `set -e` aborts the script before the comment — but with only jq's own stderr, which does not say +# that a status was left standing on the head. `.creator` arriving as a STRING rather than an object +# is the shape that reaches this (probed: jq exits 5, "Cannot index string with string"). +readback_state=$(printf '%s' "$readback_entry" | jq -r '(.status // .state) // ""') \ + || die "the '$STATUS_CONTEXT' status was posted on $short but its state could not be read from the response — no comment was written." +readback_desc=$(printf '%s' "$readback_entry" | jq -r '.description // ""') \ + || die "the '$STATUS_CONTEXT' status was posted on $short but its description could not be read from the response — no comment was written." +readback_creator=$(printf '%s' "$readback_entry" | jq -r '.creator.login // ""') \ + || die "the '$STATUS_CONTEXT' status was posted on $short but its creator could not be read from the response — no comment was written. The verdict is UNPROVEN, not necessarily wrong." # A row carrying NEITHER key is a SHAPE problem, not an overwrite. Kept separate because a refusal # that states a cause which did not happen is its own defect class in this repo (#859): "something # overwrote it" would send the reader looking for a race that never occurred. @@ -318,7 +325,10 @@ if [ "$readback_state" != "$state" ] || [ "$readback_desc" != "$status_desc" ]; die "the '$STATUS_CONTEXT' status standing on $short is not the one just written (state '$readback_state', description '$readback_desc') — something overwrote it, so this verdict is not in force. No comment was written. Re-review the current head and run this again." fi if [ -z "$readback_creator" ]; then - die "the '$STATUS_CONTEXT' status on $short reads back with no creator, which is how a status posted by an ACTIONS token appears. The gate never inherits one of those as a reviewer verdict (ersatztv#742), so this verdict would be silently re-derived. No comment was written. Post it with a reviewer's own credential." + # States the fact first and the likely cause second. `creator` absent, null, or carrying an empty + # login all land here; an ACTIONS-token status is the one that actually occurs, but saying it IS + # one would assert a cause this response cannot establish. + die "the '$STATUS_CONTEXT' status on $short reads back with no attributable creator (absent, null, or an empty login). A status POSTed by an ACTIONS token reads exactly this way, and the gate never inherits one as a reviewer verdict (ersatztv#742), so this verdict would be silently re-derived. No comment was written. Post it with a reviewer's own credential." fi # Explicit capture rather than `if ! etv_h10_reviewers_contains ...`, so the THIRD outcome cannot be # folded into the second. The function answers 0 member / 1 not-a-member / 2 cannot-tell, and an