The ban scene now waits for the ban pillar instead of sampling one instant
The scene "a ban that cannot be written is not enforced, and says so" read
/admin-api/state and /readyz once, immediately after the fifth refusal. The
ban pillar is not updated on the request path: the write attempt and the
failure to record it land a few seconds later. So the read raced the thing it
was asserting, and the same run's log already carried the sentence the
assertions denied.
Measured on 75ee822, runs of the same tree:
/tmp/c25_compose2.log 180 passed, 4 failed - all four are this scene
/tmp/c25_compose3.log 179 passed, 5 failed - four here, plus "readiness
stops saying ready" at 000
/tmp/c24_mutA_compose.log 161 passed, 4 failed - two of them are this scene
In each case the log line "could not persist a ban for" was present while
banWriteFailures read 0 and /readyz read 200. A gate that picks a moment and
calls it a contract is not a gate: it passes or fails depending on scheduling,
and the flake hides the one regression it exists to catch.
The scene now polls the pillar for up to 20 s and prints the trajectory
("failures/notWritten: 0/0 1/1 ...") plus the reason string it quoted, so
"the counter is 0" and "the field is not in the answer" are no longer the same
word in the log. One assertion was added: the pillar reached its failure state
within the wait budget, which is what fails if the wait itself is what saved
the scene.
Teeth, measured by breaking the scene on purpose (streakThreshold 3 -> 99, so
no ban is ever attempted while the writes are blocked):
/tmp/c25_mutD_banteeth.log 178 passed, 7 failed
FAIL the ban pillar reached its failure state within the wait budget expected 1, got 0
info ban pillar after 20 s of waiting - failures/notWritten: 0/0 (ten times)
info readyz at that moment: 200; the reason quoted: (none)
Green on this tree, three runs in a row: 185 passed, 0 failed
(/tmp/c25_fix1.log, /tmp/c25_fix2.log, /tmp/c25_fix3.log).
This is AC1 and AC2 of OPEN-42, done here because OPEN-25's definition of done
requires the compose gate to be green with numbers that hold; OPEN-42 stays
open for its remaining criteria.
This commit is contained in:
@@ -817,13 +817,39 @@ check 'the scanner really was one source the edge tracked' 'yes' \
|
||||
"$(printf '%s' "$STREAKS_JSON" | streaks_where "b['sourceKey']=='$BAN_SRC'" | awk '{exit ($1+0>=1)?0:1}' && echo yes || echo no)"
|
||||
check 'and no engine ban for it reached storage' 'yes' \
|
||||
"$(admin "$EDGE/admin-api/blocks?source=engine" | jcount "b['sourceKey']=='$BAN_SRC'" | awk '{exit ($1+0==0)?0:1}' && echo yes || echo no)"
|
||||
# The ban pillar is not updated on the request path: the write attempt and the
|
||||
# failure to record it land a moment after the refusal that triggered them. Read
|
||||
# immediately after the fifth refusal, this scene used to see the counters at 0
|
||||
# and /readyz at 200 while the same run's log already carried two lines saying
|
||||
# the ban was not persisted (75ee822: /tmp/c25_compose2.log 180/4 and
|
||||
# /tmp/c25_compose3.log 179/5 — three of the four failures were this read). The
|
||||
# state is therefore polled, and the raw values are printed as a trajectory:
|
||||
# "the counter is 0" and "the field is not in the answer" used to be the same
|
||||
# word in the log, which is where a real regression would hide (OPEN-42).
|
||||
PILLAR_OK=0; PILLAR_WAIT=0; PILLAR_TRAIL=''; PILLAR_READY=''; PILLAR_WHY=''
|
||||
BAN_FAILS=0; NOT_WRITTEN=0
|
||||
for _ in $(seq 1 10); do
|
||||
STATE_JSON=$(admin "$EDGE/admin-api/state")
|
||||
BAN_FAILS=$(printf '%s' "$STATE_JSON" | jval banWriteFailures)
|
||||
NOT_WRITTEN=$(printf '%s' "$STATE_JSON" | jval bansNotWritten)
|
||||
PILLAR_WHY=$(printf '%s' "$STATE_JSON" | jval banLastWriteError)
|
||||
PILLAR_READY=$(code "$EDGE/readyz")
|
||||
PILLAR_TRAIL="$PILLAR_TRAIL ${BAN_FAILS:-?}/${NOT_WRITTEN:-?}"
|
||||
if [ -n "${BAN_FAILS:-}" ] && [ "${BAN_FAILS:-0}" -ge 1 ] && [ "$PILLAR_READY" = "503" ]; then
|
||||
PILLAR_OK=1; break
|
||||
fi
|
||||
PILLAR_WAIT=$((PILLAR_WAIT+2)); sleep 2
|
||||
done
|
||||
printf ' info ban pillar after %s s of waiting — failures/notWritten:%s\n' "$PILLAR_WAIT" "$PILLAR_TRAIL"
|
||||
printf ' info readyz at that moment: %s; the reason quoted: %s\n' "${PILLAR_READY:-none}" "${PILLAR_WHY:-(none)}"
|
||||
check 'the ban pillar reached its failure state within the wait budget' '1' "$PILLAR_OK"
|
||||
check 'the state counts the ban write that failed' 'yes' \
|
||||
"$(admin "$EDGE/admin-api/state" | jval banWriteFailures | awk '{exit ($1+0>=1)?0:1}' && echo yes || echo no)"
|
||||
"$([ "${BAN_FAILS:-0}" -ge 1 ] && echo yes || echo no)"
|
||||
check 'and says how many bans were never written' 'yes' \
|
||||
"$(admin "$EDGE/admin-api/state" | jval bansNotWritten | awk '{exit ($1+0>=1)?0:1}' && echo yes || echo no)"
|
||||
check 'readiness names the ban writes, because this is the enforcement path' '503' "$(code "$EDGE/readyz")"
|
||||
"$([ "${NOT_WRITTEN:-0}" -ge 1 ] && echo yes || echo no)"
|
||||
check 'readiness names the ban writes, because this is the enforcement path' '503' "$PILLAR_READY"
|
||||
check 'the reason it quotes is the storage error, not a concurrency race' 'yes' \
|
||||
"$(admin "$EDGE/admin-api/state" | jval banLastWriteError | grep -qi 'ban write blocked' && echo yes || echo no)"
|
||||
"$(printf '%s' "$PILLAR_WHY" | grep -qi 'ban write blocked' && echo yes || echo no)"
|
||||
# Counted after the wait, so both numbers describe the same moment: the scene
|
||||
# has demonstrably produced its log lines, and none of them is the race sentence.
|
||||
BAN_LOG_LINES=$(log_wait_for 'could not persist a ban for')
|
||||
|
||||
Reference in New Issue
Block a user