The README carries the pillar-health contract, and the numbers describe the tree that has it

Re-measured at 7e081da, every stage on its own: macOS host unit 128/128,
integration 117/117, smoke 25/0, compose 53/0, console 53/0, image 261 MB;
Linux rehearsal source (Ubuntu 24.04.5, SDK 10.0.401) 128/128 + 117/117 + 25/0,
compose 53/0 with a 12 ms enforcement lag, console 53/0; act 5 jobs succeeded, 0
failed, console-evidence.zip 429,592 bytes. shellcheck 0.11.0 clean over
scripts/*.sh.
This commit is contained in:
Pavlo Ratushnyi
2026-10-02 07:46:16 +02:00
parent 7e081da6fe
commit 058e68be7e
2 changed files with 71 additions and 28 deletions
+5 -5
View File
@@ -25,18 +25,18 @@
# scripts/ci-linux-rehearsal.sh runs the gates in containers. Source gates
# (restore, build, unit, integration, smoke) in mcr.microsoft.com/dotnet/sdk:10.0
# - Ubuntu 24.04.5, SDK 10.0.401 resolving the pinned global.json: unit 128/128,
# integration 113/113, smoke 22/22, first try (at c97c7a1). Compose gate in docker:cli against
# the host daemon: 47/47 on Linux. Console gate in
# integration 117/117, smoke 25/25, first try (at 7e081da). Compose gate in docker:cli against
# the host daemon: 53/53 on Linux. Console gate in
# mcr.microsoft.com/playwright:v1.63.0-noble - the stack seeded by docker:cli,
# the same console-check.cjs driving it in a real Linux Chromium: 50/50. The
# the same console-check.cjs driving it in a real Linux Chromium: 53/53. The
# only wall clock ever measured for the source job is 1:02.81 cold (first
# rehearsal); later rehearsals were not re-timed, so that number is quoted as
# measured once, not as current. So every gate this file runs has a Linux
# number. What it does not have is a runner: the repository has no remote, so
# this file has never executed on GitHub. It has been executed by a local
# Actions-compatible runner (nektos/act 0.2.89, catthehacker/ubuntu:act-latest)
# at c97c7a1: 5 jobs succeeded, 0 failed - lint, source (128/128, 113/113, smoke
# 22/0), image (261 MB, compose smoke 47/0), console (50 assertions, screenshot
# at 7e081da: 5 jobs succeeded, 0 failed - lint, source (128/128, 117/117, smoke
# 25/0), image (261 MB, compose smoke 53/0), console (53 assertions, screenshot
# artifact) and freshness (pin 2026-10 = newest 2026-10).
name: ci
+66 -23
View File
@@ -375,6 +375,26 @@ made the loser of a race the API itself started look like a caller who sent a ba
request, which is what a double-click on "block" in the console is. The write
retries against the winner's row.
A pillar that stopped reading its table kept answering as though nothing had
changed, and nothing on the surface said otherwise. Measured on the shipped
image: `PUT /policy {"streakThreshold":2,"trustProxyHeaders":true}` answered 200,
and four 404s followed by a 403 from 203.0.113.79 proved a threshold of 2 was
live. `DROP TABLE policy_settings` at 04:44:43; 35 s later `GET /policy` still
answered `streakThreshold: 2`, `/state` still answered `snapshotAgeSeconds: 0`,
`/healthz` and `/readyz` were both 200, and the log carried **one** line. A
`docker restart` brought the table's truth back (`streakThreshold: 10`,
`trustProxyHeaders: false`) and four 404s plus a fifth wrote no ban: the rule the
operator believed was in force had silently been off for that whole window, and
the only place that was visible was a log line nobody was reading. Each pillar
now counts its own failures — `policyReloadFailures` / `policyLastReadAt` and
`snapshotRefreshFailures` / `snapshotLastRefreshError` — `/state` reports them
plus `snapshotStale`, `/policy` carries `X-Policy-Reload-Failures` and
`X-Policy-Last-Read`, and `/readyz` answers 503 naming the pillar and the age of
the snapshot while any counter is non-zero. `/healthz` deliberately stays a
liveness answer — the process is up and can serve what it holds — and readiness
is the one that stops claiming the policy on the wire is the policy in the
database.
The console had its own copy: every destructive row button wrote its green note
whatever came back — a refused delete read as `deleted ? block(s)` — and
`load()`, which runs after every action and on a 5 s interval, replaced the error
@@ -449,7 +469,11 @@ takes the rule out of the table and out of the snapshot; flipping it to
The summary line states which geo database this edge is enforcing on, when it was
built and how old it is (marked past the 90-day runtime alarm), and the snapshot
age against the TTL it is measured against — because on a single edge the TTL is
invisible, and behind a load balancer it *is* the delay a ban has.
invisible, and behind a load balancer it *is* the delay a ban has. That pill
turns `warn`, rather than staying quiet, when the snapshot is older than the TTL
or either pillar's failure counter is non-zero, and it names which:
`snapshot 412.7s / ttl 30s · older than the ttl · snapshot refresh failing ×14 ·
policy not re-read from storage ×14`.
It shows the alerts the edge raises — `server_error_streak` (your upstream is
failing, and the edge will not ban the visitor who saw it) and `candidate_ban`
(the rule would have banned, but the mode is Observe). That table is the whole
@@ -479,10 +503,20 @@ the gate starts itself and tears down on exit; the standalone scripts still
refuse to invent one, because run by hand they can be pointed at a real
deployment.
The compose gate does not only read the stack: it breaks a pillar on purpose.
Through a `python:3.12-slim` sidecar sharing the edge container's volume it runs
`DROP TABLE policy_settings`, then drives proxy requests in a loop — the
snapshot is refreshed by traffic, not by a timer, so a stack nobody is asking
anything never notices — until the failure counter appears, and asserts that
`/state` counts it, that `/readyz` has stopped saying ready, that `/policy`
carries its own provenance headers, that the *other* pillar still reports
healthy, and that `CREATE TABLE IF NOT EXISTS` returns the counters to 0 and
readiness to 200. Six assertions, and all six were red before the fix.
The console gate starts the stack, seeds a source sitting at 2 of a threshold of
3 and an operator block with a reason, four 502s from an address chosen for this
run (`/boom`, see the alerting note above), drives `/admin` in a real Chromium,
and asserts 50 things. The read side: it authenticated, listed the streak as
and asserts 53 things. The read side: it authenticated, listed the streak as
current-over-threshold rather than as a historical maximum, listed the operator
block with its reason, listed observations and countries with bars that have
real pixel widths, said how many recorded sources the observation table is only
@@ -534,24 +568,24 @@ macOS working tree make the next `--no-build` try to exec an ELF file — inside
`mcr.microsoft.com/dotnet/sdk:10.0`. The compose gate runs in `docker:cli`
against the host daemon, so the image build and the stack are Linux.
Rehearsed 2026-10-02, most recently at `c97c7a1`, each stage run on its own, so
Rehearsed 2026-10-02, most recently at `7e081da`, each stage run on its own, so
the numbers below describe the tree at the head of this file rather than a
commit several fixes behind it. The same suite on the macOS host at `c97c7a1`
gives the same counts: unit **128/128**, integration **113/113**, smoke **passed
22, failed 0**, compose **47 passed, 0 failed**, console **50 assertions, 0
commit several fixes behind it. The same suite on the macOS host at `7e081da`
gives the same counts: unit **128/128**, integration **117/117**, smoke **passed
25, failed 0**, compose **53 passed, 0 failed**, console **53 assertions, 0
failed**, image 261 MB. Source gates: Ubuntu
24.04.5, SDK **10.0.401** resolving `dotnet/global.json` (pinned `10.0.100`,
`rollForward: latestFeature` — which is also the answer to whether
`setup-dotnet` with `10.0.x` satisfies the pin), unit **128/128**, integration
**113/113**, smoke **22/22**, first try, nothing to fix. The first
**117/117**, smoke **25/25**, first try, nothing to fix. The first
rehearsal of this pipeline timed a cold container and a cold NuGet cache at
**1:02.81**; the runs after it were not re-timed, so that is the only wall clock
measured here, and the source job's 25-minute timeout is not close either way.
Compose gate on Linux: **47 passed, 0 failed** (27 before the geo-pin and
alerting assertions, 41 before the alert-edge ones), enforcement lag 0 ms, 12 ms
and 36 ms in three runs, 12 ms at `a77ab53`, 13 ms at `6e6461a`, 11 ms at
`c97c7a1`. Console gate on Linux: **50 assertions, 0 failed** —
described below. `scripts/geo-db-freshness.sh` was run
Compose gate on Linux: **53 passed, 0 failed** (27 before the geo-pin and
alerting assertions, 41 before the alert-edge ones, 47 before the pillar-health
ones), enforcement lag 0 ms, 12 ms and 36 ms in three runs, 12 ms at `a77ab53`,
13 ms at `6e6461a`, 11 ms at `c97c7a1`, 12 ms at `7e081da`. Console gate on
Linux: **53 assertions, 0 failed** — described below. `scripts/geo-db-freshness.sh` was run
in `mcr.microsoft.com/dotnet/sdk:10.0` too: current pin answers 0, and a forced
`PIN=2026-05` answers 1 with the bump command, so the gate that decides whether
the geo database is current behaves the same on the runner's OS.
@@ -572,21 +606,30 @@ and the stack is torn down afterwards. That image ships the browsers but not the
npm package, so the script installs `playwright-core` into `/tmp` and points
`PLAYWRIGHT_CORE` at it, mounting the repository read-only so the install never
lands in the working tree. Rehearsed the same day on Linux 7.0.12-linuxkit
aarch64, node v24.20.0, `chromium-1243`: **50 assertions, 0 failed**, including
aarch64, node v24.20.0, `chromium-1243`: **53 assertions, 0 failed**, including
the round-trip the page alone cannot fake — a ban drawn on the page answers 301
on the next request from that address. All three scenes in one cold run:
**2:14.33**.
**2:14.33** (measured at that earlier commit; the stage has not been re-timed
since).
Running that stage with the console job's own environment
(`COMPOSE_PROJECT_NAME=openwafci-console`, `EDGE_PORT=8090`) turned up a bug in
the stage itself: its cleanup container passed no project name, so it tore down
the stack named after the repository directory — nothing — and left the CI-named
one running, holding its port, behind a summary line that said PASS. 53
assertions green, 2 containers still up. Passing the name through is `7e081da`;
the stage re-run after it leaves 0 containers.
Honest status of the workflow itself: it has never executed on a GitHub-hosted
runner, because the repository has no remote. It *has* been executed start to
finish by a local Actions-compatible runner — `nektos/act` 0.2.89 on
`catthehacker/ubuntu:act-latest`, most recently at `c97c7a1` — 5 jobs
`catthehacker/ubuntu:act-latest`, most recently at `7e081da` — 5 jobs
succeeded, 0 failed: `lint` (both pinned tools download, verify their checksums
and find nothing), `source` (unit 128/128, integration 113/113, smoke 22/22),
`image` (`openwaf:ci` 261 MB, compose smoke 47 passed / 0 failed), `console`
(50 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`,
screenshot artifact published, 606,514-byte zip) and the `freshness` job (pin
and find nothing), `source` (unit 128/128, integration 117/117, smoke 25/25),
`image` (`openwaf:ci` 261 MB, compose smoke 53 passed / 0 failed), `console`
(53 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`,
screenshot artifact published, 429,592-byte zip) and the `freshness` job (pin
2026-10 = newest 2026-10). That is a stronger claim than
"the steps were run by hand", and a weaker one than "CI is green": it proves the
YAML executes and the pinned tools resolve, not that GitHub's image agrees. The
@@ -629,10 +672,10 @@ dotnet/
OpenWaf.Infrastructure/ EF Core (sqlite/postgres), snapshot store, writers, MMDB geo
OpenWaf.Edge/ the deployable: guard, observer, admin API, healthcheck mode
OpenWaf.Tests.Unit/ 128 tests over the decision logic
OpenWaf.Tests.Integration/ 113 tests driving the real pipeline against a fake upstream
scripts/smoke.sh 22 assertions against a running edge + a real upstream
scripts/compose-smoke.sh 47 assertions against the built image (compose + nginx)
scripts/console-check.cjs 50 assertions against the page, in a real Chromium
OpenWaf.Tests.Integration/ 117 tests driving the real pipeline against a fake upstream
scripts/smoke.sh 25 assertions against a running edge + a real upstream
scripts/compose-smoke.sh 53 assertions against the built image (compose + nginx)
scripts/console-check.cjs 53 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
.github/workflows/geo-freshness.yml the same check on a schedule