fix(763): round 8 — a fixture must pose the scenario it narrates

A fifth cold review confirmed the gate's behaviour is correct and proof-backed,
and blocked on three non-behavioural items. All three fixed; none touches the
shipped logic.

MEDIUM — the round-7 fixture narrated a raced human verdict it did not
construct. `null-page1-after-post` appended the row unconditionally, so it also
joined the PRE-write read and lifted the high-water mark above itself; removing
it changed nothing. The reviewer's suggested fix was to gate the append on the
post-write read. Measured after gating: still inert, because page 1 answers
`null` before any row reaches the wire.

So the row is gone rather than gated, and the prose now describes what the
fixture actually poses: a response asserting an empty history for a sha this job
wrote to must not be accepted as proof that nothing raced. Whether a verdict
really raced is not modelled and does not need to be — the response is not
evidence either way. A row the test cannot observe is decoration that reads as
coverage, which is the same class this branch has now been blocked on five
times.

LOW — the comment claimed the predecessor "at least produced a `::warning::`".
Half false, measured against `origin/main`: its `jq -e 'type == "array"'` gate
ACCEPTED `[]` silently and warned only on `null`. What is actually new is that
the paged walk reports such a read as a SUCCESS.

LOW — when the empty clause fired it set `ph_ok=no`, so the log said "could not
be read completely" beside a walk that completed on a validated terminator. The
answer was impossible, not unreadable, and an operator holding a sticky sentinel
needs to know which. It now carries its own `raced_why`, asserted by the test.

Both clauses mutation-proved: disarming the empty check, and reverting to the
borrowed wording, each redden the named test.

Verification: `scripts/tests` 1097 passed, 2 skipped; decisions_validate and
build_decisions_catalog --check exit 0.

refs #763

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-28 18:18:37 +02:00
co-authored by Claude Opus 5
parent e6f04cc739
commit 4164efbc3e
2 changed files with 37 additions and 17 deletions
+14 -8
View File
@@ -1331,9 +1331,10 @@ jobs:
# saying "no statuses exist" contradicts a write that succeeded. Accepting it yields
# `raced=0` — a green concluded from a list that cannot be real — on the one path whose
# failure direction is toward SUCCESS, and silently, since the walk itself reports
# success. Before this endpoint was paged, the equivalent response at least produced a
# `::warning::`; tolerating a `null`/`[]` page 1 here would have turned a logged fail-open
# into an unlogged one.
# success. The predecessor was not better in the way it first appears: its
# `jq -e 'type == "array"'` gate ACCEPTED `[]` and warned only on `null`, so the `[]` half
# of this fail-open was already unlogged on `main`. What is new is that the paged walk
# additionally reports such a read as a SUCCESS, which is why the rejection lives here.
#
# THIS IS NOT THE WITHDRAWN CURRENCY WITNESS, and the difference is what makes it safe.
# That mechanism asked "is there ANY row above the mark", which an unrelated newer row
@@ -1342,15 +1343,20 @@ jobs:
# ordering can disguise. It carries neither defect.
ph_len_after=$(printf '%s' "$ph_rows" | jq -r 'if type == "array" then length else 0 end' 2>/dev/null) || ph_len_after=0
case "$ph_len_after" in ''|*[!0-9]*) ph_len_after=0 ;; esac
if [ "$ph_ok" = yes ] && [ "$ph_len_after" -eq 0 ]; then
echo "::warning::The status history for ${SHA:0:7} came back empty after this job posted to it, which cannot be true, so a raced verdict could not be ruled out. Repairing ${CONTEXT} to pending."
ph_ok=no
fi
# WHY the repair fired, so the log can stop asserting something it does not know. The
# sentinel DESCRIPTION stays generic on purpose — the classification recognises it as a
# fixed point, so its wording is load-bearing — but the `::error::` beside it need not be.
#
# THE EMPTY CASE GETS ITS OWN REASON rather than borrowing the unreadable one. Routing it
# through "could not be read completely" would print that beside a walk that DID complete,
# on a validated terminator — the answer was impossible, not unreadable, and an operator
# reading a sticky sentinel needs to know which.
raced_why=human
if [ "$ph_ok" != yes ]; then
if [ "$ph_ok" = yes ] && [ "$ph_len_after" -eq 0 ]; then
echo "::warning::The status history for ${SHA:0:7} came back empty after this job posted to it, which cannot be true, so a raced verdict could not be ruled out. Repairing ${CONTEXT} to pending."
raced_why="the status history came back empty after this job posted to it"
raced=1
elif [ "$ph_ok" != yes ]; then
# FAIL CLOSED, AND THAT IS A BEHAVIOUR CHANGE (ersatztv#763). This used to warn and leave
# the exemption green, while #751's page-2 probe (since deleted) repaired on
# exactly the same uncertainty — the two halves of one check disagreed about which way
+23 -9
View File
@@ -1147,13 +1147,19 @@ if "/statuses/" in url:
"description": "Review-verdict: MERGEABLE @ a9e3e23 (base: other)"})
rows.sort(key=lambda r: r["id"])
elif mode == "null-page1-after-post":
# The post-write read answers "no statuses exist" for a sha this job has just POSTed to —
# impossible, but well-formed, so no retry fires and the walk reports success over it. A
# human verdict really did land in the write window, and accepting the empty answer buries
# it behind a green nobody could see was unverified.
# The post-write read answers "no statuses exist" for a sha this job has just POSTed to.
# That is impossible — the endpoint returns one row per POST — but it is well-formed, so
# nothing retries it and the walk reports SUCCESS over it.
#
# NO RACED VERDICT IS PLANTED, deliberately. An earlier shape appended one to dramatise
# the stakes, and it was inert twice over: unconditionally it also joined the PRE-write
# read and lifted the mark above itself, and gated to the post-write read it is never
# served, because page 1 answers `null` before any row reaches the wire. A row the test
# cannot observe is decoration that reads as coverage. What is actually under test is
# narrower and sufficient: a response asserting an empty history for a sha this job wrote
# to must not be accepted as proof that nothing raced.
rows = [{"id": 7000 + i, "context": "ci/other", "status": "success",
"creator": None, "description": "unrelated"} for i in range(3)]
rows.append(dict(raced_row))
elif mode == "null-terminator":
# This endpoint returns `[]` past the end today. `null` is what `/issues/{n}/timeline`
# returns, and an array-only gate on THAT endpoint was ersatztv#751 — the walk never
@@ -3856,8 +3862,9 @@ def test_an_EMPTY_post_write_history_is_not_evidence_that_nothing_raced(tmp_path
succeeded. Nothing retries it either, because the body is valid JSON of the right type.
Accepting it yields `raced=0` from a list that cannot be real, on the one path whose failure
direction is toward SUCCESS — and silently, since the walk reports success. Here a human verdict
really did land in the write window and would be buried behind an unverified green.
direction is toward SUCCESS — and silently, since the walk itself reports success. Whether a
verdict actually raced this particular write is not the point and is not modelled here: the
response is not evidence either way, so concluding "nothing raced" from it is unsound regardless.
This is NOT the withdrawn currency witness. That asked "is there ANY row above the mark", which an
unrelated newer row satisfied while the rejection stayed hidden. This asks only whether the list is
@@ -3868,8 +3875,8 @@ def test_an_EMPTY_post_write_history_is_not_evidence_that_nothing_raced(tmp_path
log = r.stdout + r.stderr
seq = _posted_sequence(tmp_path)
assert len(seq) == 2, (
"an empty post-write history was accepted as proof that nothing raced this write, so the "
f"exemption stands over a verdict it cannot have seen. Posts: {seq}\n{r.stdout[-900:]}"
"an empty post-write history was accepted as proof that nothing raced this write, so an "
f"exemption stands on a head whose write window was never inspected. Posts: {seq}\n{r.stdout[-900:]}"
)
assert seq[0]["state"] == "success" and seq[1]["state"] == "pending", (
f"expected an exemption then a repair to pending; got {seq}"
@@ -3880,6 +3887,13 @@ def test_an_EMPTY_post_write_history_is_not_evidence_that_nothing_raced(tmp_path
assert "was overwritten" not in log, (
f"an unverifiable read was reported as an overwritten human verdict:\n{r.stdout[-900:]}"
)
# The walk COMPLETED here, on a validated terminator — the answer was impossible, not unreadable.
# Borrowing the unreadable-history wording would send an operator staring at a sticky sentinel
# looking for an API failure that never happened.
assert "could not be read completely" not in log, (
"an empty-but-complete read was reported as an incomplete one, which points at the wrong "
f"cause:\n{r.stdout[-900:]}"
)
def test_a_NULL_page_terminates_the_walk_as_an_empty_one(tmp_path):