The README carries the ban-write contract, and the numbers describe that tree

Numbers re-measured at this head rather than carried forward from the commit
the last README sweep was written against:

macOS host — unit 128/128, integration 125/125, smoke 28 passed / 0 failed,
compose 74 passed / 0 failed, console 58 assertions / 0 failed, image 261 MB.
Linux rehearsal — compose 74 passed / 0 failed (enforcement lag 14 ms), console
58 assertions / 0 failed, 0 containers left behind. act (nektos/act 0.2.89,
catthehacker/ubuntu:act-latest) — 5 jobs succeeded, 0 failed: lint, source
(128/128, 125/125, 28/0), image (261 MB, compose 74/0), console (58 assertions,
480,636-byte screenshot artifact), freshness.

Prose changes, not just digits:

- The compose write scene no longer asserts `/readyz` 503 for a reporting-path
  failure, and the README said it did. The sentence is rewritten to the boundary
  that is actually asserted now, with the measurement that moved it: one lost
  alert held `/readyz` at 503 for 120 s of idle time over a healthy write path,
  because an alert pillar writes only when an alert is raised.
- Both broken-pillar scenes are now eleven assertions, not ten: each proves the
  sources it claims were seen are really in the live streak map, so the scene
  cannot pass by counting one docker bridge address three times.
- The honest log line is described as polled and counted (3 lines), because the
  grep run immediately after the burst answers 0 and the same grep two seconds
  later answers 3.
- The compose history line now says where 74 came from: 63 before the ban-write
  scene, 72 before the scenes were made non-vacuous.
This commit is contained in:
Pavlo Ratushnyi
2026-10-02 10:11:50 +02:00
parent 1bcc086195
commit 858fd0148c
2 changed files with 88 additions and 33 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 122/122, smoke 28/28, first try (at 7b57c56). Compose gate in docker:cli against
# the host daemon: 63/63 on Linux. Console gate in
# integration 125/125, smoke 28/28, first try (at 1bcc086). Compose gate in docker:cli against
# the host daemon: 74/74 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: 57/57. The
# the same console-check.cjs driving it in a real Linux Chromium: 58/58. 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 7b57c56: 5 jobs succeeded, 0 failed - lint, source (128/128, 122/122, smoke
# 28/0), image (261 MB, compose smoke 63/0), console (57 assertions, screenshot
# at 1bcc086: 5 jobs succeeded, 0 failed - lint, source (128/128, 125/125, smoke
# 28/0), image (261 MB, compose smoke 74/0), console (58 assertions, screenshot
# artifact) and freshness (pin 2026-10 = newest 2026-10).
name: ci
+83 -28
View File
@@ -395,6 +395,36 @@ liveness answer — the process is up and can serve what it holds — and readin
is the one that stops claiming the policy on the wire is the policy in the
database.
The engine's own ban write is the durable write on the enforcement path, and it
was described worst of all. Measured on the shipped image with writes to
`block_entries` aborted by triggers while reads kept working: five refusals from
one source at a threshold of 3 answered `404` five times, no ban reached storage
or `/state`, `/readyz` answered 200, and the log said "BlockStore: concurrent ban
on 203.0.113.12; keeping the winner" four times over an inner `SQLite Error 19:
'gate: ban write blocked'`. Enforcement reads the snapshot, and the snapshot is
built from storage — so a ban that cannot be written is a ban that exists
nowhere: not on this edge, not on any other edge sharing the database, not after
a restart. Nothing was in force, and the only sentence the log offered said the
opposite: that another process had won a race and its ban stood. The store now
asks storage which case it is, by re-reading the row. A live engine ban for that
source means somebody won the unique-index race and nothing is wrong; no row — or
a re-read that cannot run either — means the write never happened, and that is
counted (`banWriteFailures`, `bansNotWritten`, `banLastWriteError`) and gates
`/readyz`. The ban then lands on the next refusal from that source, which is what
clears readiness: on a write, not on a timer.
Which failures gate is now a stated boundary rather than a habit. The enforcement
path gates — the policy read, the snapshot read, the ban write. The reporting
pillars — observations, alerts, retention — are counted and shown and do not
gate. The first version of this code gated on all of them, and one measurement
moved it: with that gate in place a single lost alert left `alertWriteFailures`
at 3 and `/readyz` at **503**; the triggers were then removed and the stand left
idle for 120 s, and it answered 503 the whole time with the write path healthy.
An alert pillar writes only when an alert happens to be raised, so "not yet
proven healthy" had become "unready forever", and an orchestrator would have
pulled a working edge out of rotation over a reporting side-channel. Counters
clear on evidence — a successful write of that same pillar — never on a clock.
The write side had the same silence, and a failed write is worse than a failed
read: the row never existed, and no later request brings it back. Measured on the
shipped image with SQLite triggers aborting every `INSERT` and `UPDATE` on
@@ -502,10 +532,12 @@ 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`. A second pill carries the write side and is
present in the clean case too — `durable writes ok`, or
`durable writes observations not persisted ×3 (4 rows lost) · alerts not
persisted ×2 (2 lost) · retention not running ×1` — because a pill that only
appears when something is wrong makes "no alerts" and "alerts are not being
written" look identical from the operator's chair.
`durable writes bans not written ×2 (2 not enforced) · observations not
persisted ×3 (4 rows lost) · alerts not persisted ×2 (2 lost) · retention not
running ×1` — because a pill that only appears when something is wrong makes
"no alerts" and "alerts are not being written" look identical from the
operator's chair, and because the ban case has to read differently: those two
bans are not merely unrecorded, they are not in force anywhere.
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
@@ -551,16 +583,38 @@ The compose gate breaks the write path on purpose too, with the same care about
sidecar, so the reads stay honest and only the writes fail. It then asserts that
`/state` counts both pillars and says how many rows were lost, that the
observation listing's `X-Total-Count` is *unchanged* across the break — the lie,
asserted directly — that `/readyz` is 503 quoting the real reason rather than
EF's wrapper, and that recovery is per pillar: the observation counter clears on
the next flush while readiness stays red until an alert is written again. Ten
assertions, and the recovery half was red against the first version of the fix,
which reset readiness as soon as any pillar healed.
asserted directly — that the failure it names is the storage error rather than
EF's wrapper, that the three sources the scene says it lost were really three
distinct sources in the live streak map and not one docker bridge address
wearing a header nobody trusted, and that recovery is per pillar: the observation
counter clears on the next flush, while an alert pillar that has had nothing to
write since the break stays reported and stays unproven. Eleven assertions. The
recovery half was red against the first version of the fix, which reset readiness
as soon as any pillar healed. The readiness half was rewritten a cycle later:
this scene used to assert `/readyz` 503 for a reporting-path failure, and the
measurement described above moved that boundary — a reporting failure is counted
and shown, and only an enforcement-path failure makes the edge unready.
The same gate breaks the enforcement-path write too, and asserts the
discriminator rather than the log's mood: with `block_entries` writes aborted, a
scanner at a threshold of 3 answers `404 404 404 404 404`, no engine ban for it
reaches storage, `/readyz` is 503 quoting the storage error, the number of log
lines calling a ban write a race is measured **before and after** the scene and
must not move (0/0), the honest line is present — counted, 3 lines, and polled,
because the line reaches the daemon's log store a moment after the `/state`
counter it belongs to and a grep run immediately after the burst answers 0 — and
after the triggers go the ban lands on a later refusal with readiness returning
on that write. Eleven assertions, and the split matters: the ones that describe
the fix — the counters, the 503, the quoted reason, the log-line delta, the
honest line — were red before it, while the three that describe the consequence
(`404 404 404 404 404`, the scanner really is one source the edge is tracking,
nothing in storage) were already green. That is the whole point of the finding: the
consequence was always observable and nothing on any surface pointed at it.
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 57 things. The read side: it authenticated, listed the streak as
and asserts 58 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
@@ -612,25 +666,26 @@ 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 `7b57c56`, each stage run on its own, so
Rehearsed 2026-10-02, most recently at `1bcc086`, 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 `7b57c56`
gives the same counts: unit **128/128**, integration **122/122**, smoke **passed
28, failed 0**, compose **63 passed, 0 failed**, console **57 assertions, 0
commit several fixes behind it. The same suite on the macOS host at `1bcc086`
gives the same counts: unit **128/128**, integration **125/125**, smoke **passed
28, failed 0**, compose **74 passed, 0 failed**, console **58 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
**122/122**, smoke **28/28**, first try, nothing to fix. The first
**125/125**, smoke **28/28**, 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: **63 passed, 0 failed** (27 before the geo-pin and
Compose gate on Linux: **74 passed, 0 failed** (27 before the geo-pin and
alerting assertions, 41 before the alert-edge ones, 47 before the pillar-health
ones, 53 before the write-health ones), enforcement lag 0 ms, 12 ms and 36 ms in
ones, 53 before the write-health ones, 63 before the ban-write ones, 72 before
the scenes were made non-vacuous), 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`, 12 ms at `7b57c56`. Console gate on Linux: **57 assertions, 0
failed** — described below. `scripts/geo-db-freshness.sh` was run
`7e081da`, 12 ms at `7b57c56`, 14 ms at `1bcc086`. Console gate on Linux: **58
assertions, 0 failed** — described below, 0 containers left behind. `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.
@@ -651,7 +706,7 @@ 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`: **57 assertions, 0 failed**, including
aarch64, node v24.20.0, `chromium-1243`: **58 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** (measured at that earlier commit; the stage has not been re-timed
@@ -669,12 +724,12 @@ 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 `7b57c56` — 5 jobs
`catthehacker/ubuntu:act-latest`, most recently at `1bcc086` — 5 jobs
succeeded, 0 failed: `lint` (both pinned tools download, verify their checksums
and find nothing), `source` (unit 128/128, integration 122/122, smoke 28/28),
`image` (`openwaf:ci` 261 MB, compose smoke 63 passed / 0 failed), `console`
(57 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`,
screenshot artifact published, 452,153-byte zip) and the `freshness` job (pin
and find nothing), `source` (unit 128/128, integration 125/125, smoke 28/28),
`image` (`openwaf:ci` 261 MB, compose smoke 74 passed / 0 failed), `console`
(58 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`,
screenshot artifact published, 480,636-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
@@ -717,10 +772,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/ 122 tests driving the real pipeline against a fake upstream
OpenWaf.Tests.Integration/ 125 tests driving the real pipeline against a fake upstream
scripts/smoke.sh 28 assertions against a running edge + a real upstream
scripts/compose-smoke.sh 63 assertions against the built image (compose + nginx)
scripts/console-check.cjs 57 assertions against the page, in a real Chromium
scripts/compose-smoke.sh 74 assertions against the built image (compose + nginx)
scripts/console-check.cjs 58 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