two compose-gate assertions reported a pass about an edge that had never started
ci / build, test, smoke (push) Successful in 3m54s
ci / the same smoke on an image with no base (push) Successful in 4m2s
ci / lint the workflow and the shell (push) Successful in 7s
ci / the operator page in a real browser (push) Successful in 2m23s
ci / build the image and smoke it (push) Successful in 4m1s

The NativeAOT measurement run of 2026-10-06 (/tmp/aot-smoke.log, the tree that
became d08ec30) is a run against an edge that dies at start-up, and the gate
answered it with 125 Python tracebacks, 32 `integer expression expected` shell
errors, `docker: volumes-from specification cannot be an empty string` 6 times
and `invalid container name or ID: value is empty` 121 times. Two assertions came
back `ok` in that run — `the state counts a policy pillar that cannot read its
table yes`, printed directly under `policy reload failures counted after the
table went away: NO_JSON_BODY`, and the same pair for the observation pillar —
because the comparison was `!= "0"` and a value that was never read is not the
string `0`. OPEN-48 fixed exactly this shape for jval; jcount and jget never got
it, and the `!= 0` sites were worse than the tracebacks: a green assertion about a
dead process.

jcount now answers -1 for a body it cannot read — the sentinel streaks_where has
used since it was written — and jget answers the NO_JSON_BODY jval prints. Every
count comparison goes through is_count/count_ge/count_gt/count_moved/count_sub,
so a value that is not a run of digits is "not read" rather than a number or the
shell's problem, and a delta whose either side was not read prints -1 where a
misleading 0 used to sit. The sidecar names the edge container it cannot share a
volume with instead of handing docker an empty --volumes-from, and the health wait
answers `no-container` instead of asking docker about an empty id once per
half-second. The dead-edge scene asserts all of it against a container that is
really stopped rather than a canned string: the three helpers answer their
sentinels, a comparison on a value that was never read answers no, and none of
those reads or comparisons wrote a line to stderr. Five assertions, 368 -> 373.

Measured here: compose-smoke 373 passed / 0 failed against the chiseled image and
373 / 0 against the scratch image, same arm64 host; the five new assertions were
green in all four runs of the gate today, including the two that went red
elsewhere. `readme-counts` agrees (373=373). shellcheck 0.11.0 clean over
scripts/*.sh; actionlint cannot run on darwin and the lint gate says so with exit
2 — the ci.yml change is a comment.

Two of those red runs are recorded in the README rather than smoothed: one lost
four alert assertions, the other five range assertions, and the second names its
own cause (`curl answered 000 … the edge container reports running/healthy`,
another project's dotnet suite running on the same daemon, load average 11). The
new arithmetic separates the two shapes a red alert scene can mean — a read that
did not parse prints -1, a row that is not there yet prints 0 — and both runs
printed 0.
This commit is contained in:
Pavlo Ratushnyi
2026-10-06 19:55:25 +02:00
parent e81f27e931
commit 179e0f51a0
4 changed files with 159 additions and 34 deletions
+1 -1
View File
@@ -267,7 +267,7 @@ jobs:
- name: README assertion counts match what the gate ran
run: ./scripts/ci-gates.sh readme-counts scripts/compose-smoke.sh
# The same stack, the same 368 assertions, and an image whose base is nothing:
# The same stack, the same 373 assertions, and an image whose base is nothing:
# scratch plus the shared objects the program was linked against, the NSS
# modules getaddrinfo needs, OpenSSL, and the CA bundle. This is the job that
# answers "will it behave on a production host" for that shape — the first
+55 -5
View File
@@ -333,7 +333,7 @@ after a rebuild**. Measured on 2026-10-01: the same rebuilt image reported
`docker volume rm openwaf_openwaf-geoip`. That is the command to reach for when
the pin moves.
### Two images, one program, and the same 368 assertions against both
### Two images, one program, and the same 373 assertions against both
`Dockerfile` ships the edge on `aspnet:10.0-noble-chiseled`: a distroless
runtime, no shell, no package manager. `Dockerfile.scratch` ships the same
@@ -349,7 +349,10 @@ Actions run 2476, head `be6c608`, the `scratch-image` job): RID `linux-x64`, the
same **12** shared objects and **19.9 MB**, scratch **218 MB** against chiseled
**258 MB**. `scripts/compose-smoke.sh` runs unchanged against either image — the
only change is the `docker-compose.scratch.yml` override — and it answered
**368 passed, 0 failed** on both architectures.
**368 passed, 0 failed** on both architectures. Re-measured on the same arm64
host the evening of 2026-10-06, against the 373-assertion version of this gate:
**373 passed, 0 failed** against the chiseled image and **373 passed, 0 failed**
against scratch.
The assertions are the reason the second Dockerfile is worth having, and the
first scratch image built here is the reason they were needed: it started, its
@@ -365,7 +368,7 @@ by application code."* A healthy container was not a working edge.
```
scripts/ci-gates.sh scratch-image # build it, print both images' sizes
scripts/ci-gates.sh scratch-smoke # the 368, against it
scripts/ci-gates.sh scratch-smoke # the 373, against it
```
And the fully static shape, measured the same day rather than argued:
@@ -1742,7 +1745,7 @@ cannot mean different things.
```
scripts/ci-gates.sh all # restore, build, unit, integration, smoke, both images, both smokes
scripts/ci-gates.sh scratch-smoke # the 368, against the image with no base
scripts/ci-gates.sh scratch-smoke # the 373, against the image with no base
scripts/ci-gates.sh unit # or any one gate on its own
scripts/ci-gates.sh console # the page, in a real Chromium (not part of `all`)
```
@@ -1819,6 +1822,53 @@ with a scene that makes the dead case happen on purpose — `compose stop edge`,
one request, `exited/unhealthy` in the log beside the `000`, `compose start`, and
the stack back to `running/healthy` answering 404. Five assertions.
The gate also has to refuse to describe *its own* failure as the product's, and
until 2026-10-06 it did not. `jval` was given three answers for three states
(OPEN-48) — no body, a field the object does not carry, a field that is there —
and `jcount` and `jget` never received the same treatment: they piped the body
straight into `json.load`. Measured in the NativeAOT measurement run of that day
(`/tmp/aot-smoke.log`), which is what a run against an edge that dies at
start-up looks like: **125 Python tracebacks**, **32 `integer expression
expected` shell errors**, `docker: volumes-from specification cannot be an empty
string` **6** times, `invalid container name or ID: value is empty` **121**
times. And two assertions reported **pass** about an edge that had never started:
```
info policy reload failures counted after the table went away: NO_JSON_BODY
ok the state counts a policy pillar that cannot read its table yes
info observation write failures counted after writes were blocked: NO_JSON_BODY
ok the state counts observations this edge could not persist yes
```
because the comparison was `!= "0"`, and a value that was never read is not the
string `0`. That is the worst shape this file has caught: not a red gate, a green
one about a dead process. Now `jcount` answers `-1` for a body it cannot read —
the sentinel `streaks_where` has used since it was written — and `jget` answers
the `NO_JSON_BODY` that `jval` prints; every count comparison goes through
`count_ge`/`count_gt`/`count_moved`/`count_sub`, which treat anything that is not
a run of digits as "not read" rather than as a number or as the shell's problem;
the sidecar names the edge container it cannot share a volume with instead of
handing docker an empty `--volumes-from`; and the health wait asks a container
that is not there for its health in words (`no-container`), which is what the
121 `docker inspect ""` lines become. The dead-edge scene asserts the behaviour
against a container that is really stopped rather than against a canned string:
the three helpers answer their sentinels, a comparison on a value that was never
read answers no, and none of those reads or comparisons wrote a line to stderr.
Five assertions, green in both runs that first made them, and the gate's total
moved from 368 to **373**.
Two runs on that same day went red on this tree and neither red was this file's
fault, so they are recorded rather than smoothed: one lost four alert assertions
(`alert rows for 12 server errors at N=3: 0`) and the other lost five range
assertions, and the second names its own cause — `curl answered 000 … the edge
container reports running/healthy`, a request the gate could not make while
another project's dotnet suite was running on the same daemon and the same
machine (load average 11, and the run that followed it, on a quieter host, was
373/0). The count arithmetic now separates the two shapes a red alert scene can
mean: a read that did not parse prints `-1` where a real zero would sit, and both
of those runs printed `0`, so in the first the reads answered and agreed — what
was missing was the requests, or the rows, not the parse.
The README's own numbers became a gate. `scripts/ci-gates.sh readme-counts
scripts/<gate>` compares the assertion count the README prints for a gate with the
total that gate recorded in this run — each gate writes its total into
@@ -2251,7 +2301,7 @@ dotnet/
OpenWaf.Tests.Unit/ 378 tests over the decision logic, the budget window, the refusal wording, the schema baseline and the durability counters
OpenWaf.Tests.Integration/ 405 tests driving the real pipeline against a fake upstream
scripts/smoke.sh 256 assertions against a running edge + a real upstream
scripts/compose-smoke.sh 368 assertions against the built image (compose + nginx)
scripts/compose-smoke.sh 373 assertions against the built image (compose + nginx)
scripts/console-check.cjs 168 assertions against the page, in a real Chromium
scripts/geo-db-freshness.sh the pinned geo database vs the vendor (0/1/2)
.github/workflows/ci.yml runs the gates on every push
+1 -1
View File
@@ -268,7 +268,7 @@ case "${1:-all}" in
# same invocation.
export GATE_TOTALS_DIR="${GATE_TOTALS_DIR:-$(mktemp -d)}"
restore; build; unit; integration; schema-script; smoke; image; compose_smoke
# The scratch image and the same 368 assertions against it. It is in `all`
# The scratch image and the same 373 assertions against it. It is in `all`
# because it is the shipped shape, not an experiment: the only difference a
# caller can see is what is under the program.
scratch_image; scratch_smoke
+102 -27
View File
@@ -38,10 +38,27 @@ admin() { curl -s -m 10 -H "X-Admin-Token: $OPENWAF_ADMIN_TOKEN" "$@"; }
# jcount/jget evaluate a python expression over the JSON on stdin. `b`/`o` is
# the list, and the predicate is written once here instead of being re-sedged
# per assertion — sed over JSON silently returns the first match of anything.
#
# Three states, three answers — the rule OPEN-48 wrote for jval, which these two
# never received. Measured in the NativeAOT measurement run of 2026-10-06
# (/tmp/aot-smoke.log, the tree that became d08ec30), which is what a run against
# an edge that dies at startup looks like: 125 Python tracebacks and 32 `integer
# expression expected` shell errors, every one of them one of these two helpers
# handed a body that was not there. jcount now answers -1 — the sentinel
# streaks_where has used since it was written, a number that can never be a real
# count — and jget answers the same NO_JSON_BODY jval prints. A count read off a
# failed answer is still a wrong number; what it is no longer is indistinguishable
# from an empty one, and it no longer reaches `[ -ge ]` as one.
jcount() { python3 -c "import json,sys
d=json.load(sys.stdin); print(sum(1 for b in d if $1))"; }
try:
d=json.load(sys.stdin); print(sum(1 for b in d if $1))
except Exception:
print(-1)"; }
jget() { python3 -c "import json,sys
d=json.load(sys.stdin)
try:
d=json.load(sys.stdin)
except Exception:
print('NO_JSON_BODY'); raise SystemExit(0)
for o in d:
if $1: print(o.get('$2') or ''); break"; }
# /admin-api/streaks answers with an OBJECT that wraps the list, so a predicate
@@ -146,6 +163,21 @@ except ValueError:
print('NO_JSON_BODY'); raise SystemExit(0)
v=d.get('$1')
print('' if v is None else (json.dumps(v) if isinstance(v,(bool,int,float)) else v))"; }
# A count the edge actually answered is a run of digits. The three helpers above
# answer NO_JSON_BODY, -1 or the empty string when it answered nothing, and
# handing any of those to `[ -ge ]` makes the shell complain rather than the
# assertion fail: `[: NO_JSON_BODY: integer expression expected`, ten times in
# the ten-iteration poll of the ban-pillar scene, in the run named above. A
# comparison is the assertion, so it has to be able to lose quietly.
is_count() { case $1 in (''|*[!0-9]*) return 1 ;; (*) return 0 ;; esac; }
count_ge() { is_count "$1" && [ "$1" -ge "$2" ]; }
count_gt() { is_count "$1" && is_count "$2" && [ "$1" -gt "$2" ]; }
# `!= 0` was the shape these scenes used, and it is the dangerous one: a body
# that was never read is not the string "0", so the loop stopped early and the
# assertion that followed reported the counter as moved. It did not move. It was
# not read.
count_moved() { is_count "$1" && [ "$1" != 0 ]; }
count_sub() { if is_count "$1" && is_count "$2"; then printf '%s' "$(( $1 - $2 ))"; else printf '%s' -1; fi; }
# Alerts are counted as a delta (see the alert sections): the data volume
# survives `compose down`, so an absolute count would be history, not this run.
# jcount's loop variable is `b` (jget's is `o`) — the two helpers read the same
@@ -201,14 +233,24 @@ rm -f "$UP_LOG"
for _ in $(seq 1 120); do curl -fsS "$EDGE/healthz" >/dev/null 2>&1 && break; sleep 0.5; done
CID=$(docker compose ps -q edge)
# The same three states edge_state gives a stopped container: an empty id is not
# a container whose health can be asked about. In the NativeAOT measurement run
# of 2026-10-06 this loop asked `docker inspect ""` once per half-second of the
# wait, and the log carried `invalid container name or ID: value is empty` 121
# times — the gate's own absent container, reported as a docker usage error.
health_of() {
if [ -z "${CID:-}" ]; then printf 'no-container'; return; fi
docker inspect --format '{{.State.Health.Status}}' "$CID" 2>/dev/null \
|| printf 'uninspectable'
}
# The image's own HEALTHCHECK is the probe (a chiseled base has no shell), so
# this waits for it rather than for the port: the port answers long before the
# first check has run.
for _ in $(seq 1 120); do
[ "$(docker inspect --format '{{.State.Health.Status}}' "$CID")" = healthy ] && break
[ "$(health_of)" = healthy ] && break
sleep 0.5
done
check 'image HEALTHCHECK reports healthy' 'healthy' "$(docker inspect --format '{{.State.Health.Status}}' "$CID")"
check 'image HEALTHCHECK reports healthy' 'healthy' "$(health_of)"
check 'healthz says ok' 'ok' "$(curl -s "$EDGE/healthz" | sed -n 's/.*"status":"\([^"]*\)".*/\1/p')"
check 'geo database is loaded' 'true' "$(curl -s "$EDGE/healthz" | sed -n 's/.*"geoLoaded":\([^,]*\).*/\1/p')"
check 'healthz names the geo database' 'yes' "$(curl -s "$EDGE/healthz" | grep -q '"geoDatabase":"DBIP' && echo yes || echo no)"
@@ -381,11 +423,11 @@ check 'and no engine ban was written for it' '0' "$(adm
ACOUNT=0
for _ in $(seq 1 20); do
ACOUNT=$(alerts_for server_error_streak "$ERR_SRC")
[ "${ACOUNT:-0}" -gt "${BEFORE_ERR:-0}" ] && break
count_gt "${ACOUNT:-0}" "${BEFORE_ERR:-0}" && break
sleep 0.5
done
ERR_DELTA=$(( ${ACOUNT:-0} - ${BEFORE_ERR:-0} ))
check 'a server_error_streak alert was written for that source' 'yes' "$([ "$ERR_DELTA" -ge 1 ] && echo yes || echo no)"
ERR_DELTA=$(count_sub "${ACOUNT:-0}" "${BEFORE_ERR:-0}")
check 'a server_error_streak alert was written for that source' 'yes' "$(count_ge "$ERR_DELTA" 1 && echo yes || echo no)"
# A measurement *and* an assertion. The alert is edge-triggered: it speaks when
# the streak crosses N and then when the count doubles, so twelve 502s at N=3
# cost three rows (at 3, 6 and 12) and not ten. Before this was level-triggered
@@ -400,7 +442,7 @@ check 'a server_error_streak alert was written for that source' 'yes' "$([ "$ERR
# — the first version of this line read 1 where the settled number was 2, and a
# number that is wrong by a race is worse than no number.
ERR_SETTLED=$(settle_alerts server_error_streak "$ERR_SRC")
ERR_ROWS=$(( ${ERR_SETTLED:-0} - ${BEFORE_ERR:-0} ))
ERR_ROWS=$(count_sub "${ERR_SETTLED:-0}" "${BEFORE_ERR:-0}")
printf ' info alert rows for 12 server errors at N=3: %s (expected 3: the crossing, then the doublings)\n' "$ERR_ROWS"
check 'a 5xx storm alerts per escalation, not per request' '3' "$ERR_ROWS"
@@ -416,7 +458,7 @@ check 'ten refusals in Observe mode still reach the upstream' '404' "$(code -H "
check 'and no engine ban was written in Observe mode' '0' "$(admin "$EDGE/admin-api/blocks" | jcount "b['sourceKey']=='$OBS_SRC'")"
OBS_ALERT=no
for _ in $(seq 1 20); do
[ "$(alerts_for candidate_ban "$OBS_SRC")" -gt "${BEFORE_OBS:-0}" ] && OBS_ALERT=yes && break
count_gt "$(alerts_for candidate_ban "$OBS_SRC")" "${BEFORE_OBS:-0}" && OBS_ALERT=yes && break
sleep 0.5
done
check 'the dry run is visible as a candidate_ban alert' 'yes' "$OBS_ALERT"
@@ -425,7 +467,7 @@ check 'the dry run is visible as a candidate_ban alert' 'yes' "$OBS_ALERT"
# observed and the threshold stays "triggered" on all eight past N. A dry run
# that writes a row per request is the safest mode doubling as a way to grow the
# operator's tables.
OBS_ROWS=$(( $(settle_alerts candidate_ban "$OBS_SRC") - ${BEFORE_OBS:-0} ))
OBS_ROWS=$(count_sub "$(settle_alerts candidate_ban "$OBS_SRC")" "${BEFORE_OBS:-0}")
printf ' info candidate_ban rows for 10 refusals at N=3: %s (expected 2: at 3 and at 6)\n' "$OBS_ROWS"
check 'a dry run announces a candidate ban per escalation, not per request' '2' "$OBS_ROWS"
admin -X PUT -H 'Content-Type: application/json' \
@@ -467,7 +509,7 @@ FILTER_ROWS=0
for _ in $(seq 1 12); do
FILTER_ROWS=$(admin "$EDGE/admin-api/observations?limit=1000&source=203.0.113.250" \
| jcount "b['sourceKey']=='203.0.113.250'")
[ "${FILTER_ROWS:-0}" != "0" ] && break
count_moved "${FILTER_ROWS:-0}" && break
sleep 3
done
printf ' info rows the source filter returns for a source this run just created: %s\n' "$FILTER_ROWS"
@@ -720,7 +762,20 @@ echo '- a pillar that stops reading its table says so'
# longer matured a ban. Keeping the last good value is the right failure posture;
# keeping it unmentioned is not.
EDGE_CID=$(docker compose ps -q edge)
sidecar() { docker run --rm -i --volumes-from "$EDGE_CID" python:3.12-slim python -; }
sidecar() {
# The volume is the edge container's, so a run with no edge container has
# nothing to share — and in the NativeAOT measurement run that was the state
# from the first scene on: EDGE_CID was empty and docker answered `volumes-from
# specification cannot be an empty string`, six times, each one a scene whose
# break never happened reporting a docker usage error. A missing container is
# news about the stack, so it is named as news about the stack.
if [ -z "${EDGE_CID:-}" ] || ! docker inspect -f '{{.State.Status}}' "$EDGE_CID" >/dev/null 2>&1; then
printf ' info the sidecar cannot run: no edge container to share a volume with (the edge reports %s)\n' \
"$(edge_state)" >&2
return 2
fi
docker run --rm -i --volumes-from "$EDGE_CID" python:3.12-slim python -
}
sidecar <<'PYSQL'
import sqlite3
c = sqlite3.connect("/app/data/openwaf.db", isolation_level=None)
@@ -731,12 +786,12 @@ PYSQL
for _ in $(seq 1 15); do
code "$EDGE/no-such-page" >/dev/null
POLICY_FAILS=$(admin "$EDGE/admin-api/state" | jval policyReloadFailures)
[ "${POLICY_FAILS:-0}" != "0" ] && break
count_moved "${POLICY_FAILS:-0}" && break
sleep 3
done
printf ' info policy reload failures counted after the table went away: %s\n' "${POLICY_FAILS:-0}"
check 'the state counts a policy pillar that cannot read its table' 'yes' \
"$([ "${POLICY_FAILS:-0}" != "0" ] && echo yes || echo no)"
"$(count_moved "${POLICY_FAILS:-0}" && echo yes || echo no)"
check 'readiness stops saying ready while it cannot' '503' "$(code "$EDGE/readyz")"
# Sampled with a retry, not once. The first Linux rehearsal of this gate failed
# here on a single sample: /state had just reported one reload failure, and the
@@ -817,12 +872,12 @@ for i in $(seq 1 6); do code -H "$(xff 203.0.113.210)" "$EDGE/boom" >/dev/null;
OBS_FAILS=0
for _ in $(seq 1 12); do
OBS_FAILS=$(admin "$EDGE/admin-api/state" | jval observationWriteFailures)
[ "${OBS_FAILS:-0}" != "0" ] && break
count_moved "${OBS_FAILS:-0}" && break
sleep 3
done
printf ' info observation write failures counted after writes were blocked: %s\n' "${OBS_FAILS:-0}"
check 'the state counts observations this edge could not persist' 'yes' \
"$([ "${OBS_FAILS:-0}" != "0" ] && echo yes || echo no)"
"$(count_moved "${OBS_FAILS:-0}" && echo yes || echo no)"
check 'and it says how many rows were lost, not only that something failed' 'yes' \
"$(admin "$EDGE/admin-api/state" | jval observationsLost | awk '{exit ($1+0>=1)?0:1}' && echo yes || echo no)"
check 'the alerting pillar counts its lost alerts too' 'yes' \
@@ -922,7 +977,7 @@ for _ in $(seq 1 10); do
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
if count_ge "${BAN_FAILS:-}" 1 && [ "$PILLAR_READY" = "503" ]; then
PILLAR_OK=1; break
fi
PILLAR_WAIT=$((PILLAR_WAIT+2)); sleep 2
@@ -931,9 +986,9 @@ printf ' info ban pillar after %s s of waiting — failures/notWritten:%s\n' "$
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' \
"$([ "${BAN_FAILS:-0}" -ge 1 ] && echo yes || echo no)"
"$(count_ge "${BAN_FAILS:-0}" 1 && echo yes || echo no)"
check 'and says how many bans were never written' 'yes' \
"$([ "${NOT_WRITTEN:-0}" -ge 1 ] && echo yes || echo no)"
"$(count_ge "${NOT_WRITTEN:-0}" 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' \
"$(printf '%s' "$PILLAR_WHY" | grep -qi 'ban write blocked' && echo yes || echo no)"
@@ -945,7 +1000,7 @@ printf ' info lines calling a ban write a race, before/after this scene: %s/%s\
printf ' info lines saying the ban was not persisted and nothing is enforcing it: %s\n' "$BAN_LOG_LINES"
check 'the log no longer calls a storage failure a race' "$RACES_BEFORE" "$RACES_AFTER"
check 'and the log says what actually happened' 'yes' \
"$([ "${BAN_LOG_LINES:-0}" -ge 1 ] && echo yes || echo no)"
"$(count_ge "${BAN_LOG_LINES:-0}" 1 && echo yes || echo no)"
sidecar <<'PYSQL'
import sqlite3
c = sqlite3.connect("/app/data/openwaf.db", isolation_level=None)
@@ -987,12 +1042,12 @@ for i in $(seq 1 5); do code -H "$(xff "$RETRY_SRC")" "$EDGE/retry-$i" >/dev/nul
PENDING=0
for _ in $(seq 1 10); do
PENDING=$(admin "$EDGE/admin-api/state" | jval bansPendingRetry)
[ "${PENDING:-0}" != "0" ] && break
count_moved "${PENDING:-0}" && break
sleep 3
done
printf ' info bans queued for retry while storage refuses them: %s\n' "$PENDING"
check 'the failed ban is queued for retry rather than left to the next attack' 'yes' \
"$([ "${PENDING:-0}" -ge 1 ] && echo yes || echo no)"
"$(count_ge "${PENDING:-0}" 1 && echo yes || echo no)"
# Repair the storage failure. Nothing else is sent from this source: that is the
# whole point of the scene.
sidecar <<'PYSQL'
@@ -1397,14 +1452,14 @@ for _ in $(seq 1 12); do
OPEN26_SNAP_FAILS=$(admin "$EDGE/admin-api/state" | jval snapshotRefreshFailures)
OPEN26_WHY=$(admin "$EDGE/admin-api/state" | jval snapshotLastRefreshError)
OPEN26_READY=$(code "$EDGE/readyz")
[ "${OPEN26_SNAP_FAILS:-0}" != "0" ] && [ "$OPEN26_READY" = "503" ] && break
count_moved "${OPEN26_SNAP_FAILS:-0}" && [ "$OPEN26_READY" = "503" ] && break
sleep 3
done
printf ' info with the block table gone: readyz %s, snapshot refresh failures %s, reason: %s\n' \
"${OPEN26_READY:-none}" "${OPEN26_SNAP_FAILS:-?}" "${OPEN26_WHY:-(none)}"
check 'readiness stops saying ready when the block table is not there' '503' "${OPEN26_READY:-000}"
check 'and the state counts the snapshot that could not be built' 'yes' \
"$([ "${OPEN26_SNAP_FAILS:-0}" != "0" ] && echo yes || echo no)"
"$(count_moved "${OPEN26_SNAP_FAILS:-0}" && echo yes || echo no)"
check 'the reason it quotes names the table' 'yes' \
"$(printf '%s' "$OPEN26_WHY" | grep -qi 'block_entries' && echo yes || echo no)"
# Which guard answered 503 is the whole question, and the status code does not
@@ -1475,7 +1530,7 @@ OPEN55_STATE=$(admin "$EDGE/admin-api/state")
OPEN55_ADDED=$(printf '%s' "$OPEN55_STATE" | jval schemaTablesAdded)
printf ' info tables this start had to create: %s\n' "${OPEN55_ADDED:-none}"
check 'the state names the tables it had to add' 'yes' \
"$([ "${OPEN55_ADDED:-0}" -ge 3 ] && echo yes || echo no)"
"$(count_ge "${OPEN55_ADDED:-0}" 3 && echo yes || echo no)"
# The table the durable push queue (OPEN-60) lives in, added by the edge to a
# database that predates it. A restart is the only thing that ran between the
# drop and this read.
@@ -1527,7 +1582,7 @@ check 'metrics answers in the Prometheus exposition format' 'text/plain; version
OPEN58_BODY=$(admin "$EDGE/metrics")
msample() { printf '%s\n' "$OPEN58_BODY" | awk -v p="$1" 'index($0,p)==1 { print $NF; exit }'; }
check 'the verdict counter counts the rule refusal this stack just made' 'yes' \
"$([ "$(msample 'openwaf_requests_total{verdict="block_rule"} ')" -gt 0 ] 2>/dev/null && echo yes || echo no)"
"$(count_gt "$(msample 'openwaf_requests_total{verdict="block_rule"} ')" 0 && echo yes || echo no)"
check 'the schema gauge says nothing the build needs is missing' '0' \
"$(msample 'openwaf_schema_missing_tables ')"
check 'the push queue is published as gauges on the shipped image' '0 0 0 0' \
@@ -2244,7 +2299,27 @@ check 'a stopped edge answers no http code at all' '000' "$DEAD_CODE"
check 'and the gate names the container state that goes with it' 'exited' \
"$(printf '%s' "$DEAD_STATE" | cut -d/ -f1)"
check 'and the 000 was counted as an unreachable answer' 'yes' \
"$([ "$(dead_codes)" -gt "$DEAD_CODES_BEFORE" ] && echo yes || echo no)"
"$(count_gt "$(dead_codes)" "$DEAD_CODES_BEFORE" && echo yes || echo no)"
# The gate's own instruments, asked while the edge is dead. This is the state the
# NativeAOT measurement run of 2026-10-06 sat in for its whole length, and what
# it produced there was 125 Python tracebacks and 32 `integer expression
# expected` shell errors — the gate describing its own failure in the same breath
# as the product's, and in two places (`!= 0` on a counter that was never read)
# describing it as a pass. Asserted against a container that is really stopped,
# not against a canned string: the read is the same read every scene above makes.
DEAD_READS=$(mktemp "${TMPDIR:-/tmp}/openwaf-dead-reads.XXXXXX")
DEAD_JVAL=$(admin "$EDGE/admin-api/state" | jval banWriteFailures 2>"$DEAD_READS")
DEAD_JCOUNT=$(admin "$EDGE/admin-api/blocks" | jcount "True" 2>>"$DEAD_READS")
DEAD_JGET=$(admin "$EDGE/admin-api/blocks" | jget "True" "sourceKey" 2>>"$DEAD_READS")
DEAD_CMP=no
if count_ge "$DEAD_JVAL" 1 || count_gt "$DEAD_JCOUNT" 0; then DEAD_CMP=yes; fi
check 'a dead edge reads as no body, not as a traceback' 'NO_JSON_BODY' "$DEAD_JVAL"
check 'a dead edge counts as -1, the sentinel streaks_where already used' '-1' "$DEAD_JCOUNT"
check 'and the list-field read says the same thing in the other helper' 'NO_JSON_BODY' "$DEAD_JGET"
check 'a comparison on a value that was never read answers no' 'no' "$DEAD_CMP"
check 'and none of those reads or comparisons wrote a line to stderr' '0' \
"$(wc -l < "$DEAD_READS" | tr -d ' ')"
rm -f "$DEAD_READS"
docker compose start edge >/dev/null 2>&1
ALIVE_STATE='none'
for _ in $(seq 1 90); do