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

Re-measured at 7b57c56, every stage on its own: macOS host unit 128/128,
integration 122/122, smoke 28/0, compose 63/0, console 57/0, image 261 MB;
Linux rehearsal source (Ubuntu 24.04.5, SDK 10.0.401) 128/128 + 122/122 + 28/0,
compose 63/0 with a 12 ms enforcement lag, console 57/0 leaving 0 containers;
act 5 jobs succeeded, 0 failed, console-evidence.zip 452,153 bytes.
shellcheck 0.11.0 clean over scripts/*.sh.
This commit is contained in:
Pavlo Ratushnyi
2026-10-02 08:49:05 +02:00
parent 7b57c56def
commit 68bec5b6be
2 changed files with 71 additions and 26 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 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
# 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
# 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: 53/53. The
# the same console-check.cjs driving it in a real Linux Chromium: 57/57. 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 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
# 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
# artifact) and freshness (pin 2026-10 = newest 2026-10).
name: ci
+66 -21
View File
@@ -395,6 +395,33 @@ 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 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
`source_observations` and `edge_alerts` while reads kept working — a trigger
rather than a dropped table, because a missing table breaks the listing too and a
broken listing is honest about being broken, while a trigger leaves the listing
answering 200. Three new sources refused and a six-request 5xx storm later:
`GET /admin-api/observations` answered 200 with the same `X-Total-Count` it had
before the break, `GET /admin-api/alerts` still showed the one row it had,
`/healthz` and `/readyz` were both 200, `/state` had no write-side field at all,
and the log carried "ObservationWriter: flush failed, 4 entries dropped." plus
two "AlertWriter: could not persist…". Each writer now counts its own failures —
`observationWriteFailures` / `observationsLost` / `observationLastWriteError`,
`alertWriteFailures` / `alertsLost`, and `retentionPruneFailures` for the prune
that ages aggregates out — and `/readyz` answers 503 naming the pillar and how
many rows were lost. A counter clears only on a successful write *of its own
pillar*: measured on the same stand, the observation pillar healed on its next
flush while readiness stayed red until an alert was actually written again, which
is the difference between a counter and a gauge. `retentionPruneFailures` is
reported and deliberately **not** a readiness failure — a prune that cannot run
keeps aggregates past the age they promise to age out at, which the operator has
to be told about, but it does not change what this edge enforces, and pulling
every edge out of rotation over a cleanup loop would trade a retention defect for
an outage. The error quoted is the innermost one, not the wrapper: "An error
occurred while saving the entity changes" is not something an operator can act
on, and "gate: durable write blocked" is.
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
@@ -473,7 +500,12 @@ 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`.
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.
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
@@ -513,10 +545,22 @@ 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 compose gate breaks the write path on purpose too, with the same care about
*how* it breaks: SQLite triggers (`BEFORE INSERT`/`BEFORE UPDATE` on
`source_observations` and `edge_alerts`, `RAISE(ABORT, …)`) installed through the
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.
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 53 things. The read side: it authenticated, listed the streak as
and asserts 57 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
@@ -568,24 +612,25 @@ 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 `7e081da`, each stage run on its own, so
Rehearsed 2026-10-02, most recently at `7b57c56`, 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 `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
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
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
**117/117**, smoke **25/25**, first try, nothing to fix. The first
**122/122**, 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: **53 passed, 0 failed** (27 before the geo-pin and
Compose gate on Linux: **63 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
ones, 53 before the write-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`, 12 ms at `7b57c56`. Console gate on Linux: **57 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.
@@ -606,7 +651,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`: **53 assertions, 0 failed**, including
aarch64, node v24.20.0, `chromium-1243`: **57 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
@@ -624,12 +669,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 `7e081da` — 5 jobs
`catthehacker/ubuntu:act-latest`, most recently at `7b57c56` — 5 jobs
succeeded, 0 failed: `lint` (both pinned tools download, verify their checksums
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
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
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
@@ -672,10 +717,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/ 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
OpenWaf.Tests.Integration/ 122 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/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