The compose gate asserted the policy header at one instant, and one instant is not a contract

The first Linux rehearsal of this tree failed on the read-side scene: /state had
just reported a reload failure, and the very next GET /admin-api/policy answered
with X-Policy-Reload-Failures: 0. A reload succeeded in between — a pooled sqlite
connection can keep serving the schema it already prepared, which is the same
reason chmod 000 on the database file never breaks the edge. The product said
what the last read did; the gate was asserting on a sample. The header is now
polled while the table is gone and the observed value is printed either way, so
a red here names what was seen instead of naming the clock.
This commit is contained in:
Pavlo Ratushnyi
2026-10-02 08:38:55 +02:00
parent 2b0163aa80
commit 7b57c56def
+18 -1
View File
@@ -310,8 +310,25 @@ printf ' info policy reload failures counted after the table went away: %s\n' "
check 'the state counts a policy pillar that cannot read its table' 'yes' \
"$([ "${POLICY_FAILS:-0}" != "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
# very next GET /policy answered with the header at 0 — a reload that succeeded
# in between (a pooled sqlite connection can serve the schema it already
# prepared, which is the same reason chmod 000 on the file never breaks the
# edge). The product was not lying: the header said what the last read did. The
# gate was asserting on one instant. So the header is polled while the table is
# gone, and what was actually seen is printed either way.
POLICY_HDR=""
for _ in $(seq 1 6); do
POLICY_HDR=$(hdr -H "X-Admin-Token: $OPENWAF_ADMIN_TOKEN" "$EDGE/admin-api/policy" \
| grep -i '^x-policy-reload-failures:' | tr -d '\r')
printf '%s' "$POLICY_HDR" | grep -qi ': [1-9]' && break
code "$EDGE/no-such-page" >/dev/null
sleep 2
done
printf ' info policy provenance header while the table is gone: %s\n' "${POLICY_HDR:-none}"
check 'the policy answer carries its own provenance' 'yes' \
"$(hdr -H "X-Admin-Token: $OPENWAF_ADMIN_TOKEN" "$EDGE/admin-api/policy" | grep -qi '^x-policy-reload-failures: [1-9]' && echo yes || echo no)"
"$(printf '%s' "$POLICY_HDR" | grep -qi '^x-policy-reload-failures: [1-9]' && echo yes || echo no)"
# The two pillars are counted separately on purpose: here the snapshot is still
# refreshing fine and only the policy read is broken, and a single blended
# "storage is unhappy" flag would lose exactly that.