diff --git a/README.md b/README.md index 92a69ae..0d37d23 100644 --- a/README.md +++ b/README.md @@ -325,6 +325,38 @@ remove. That second half matters because a rule used to be permanent: the console gate's own comment read "a country rule cannot be deleted, only overwritten", and the residue outlived `compose down` in the data volume. +A write that could not happen does not get to answer like one that did. Measured +on two images of one stand — the tree before the fix (`b46f5c20`) and after +(`08bebf43`) — with the block and policy tables dropped out from under a running +edge that held 3 blocks and 1 policy row: + +| the operator's command | before | now | +|---|---|---| +| `DELETE /admin-api/blocks?source=operator` | **`200 {"deleted":0}`** | `503 {"error":"…NOTHING was deleted"}` | +| `DELETE /admin-api/blocks?key=203.0.113.201` | **`200 {"deleted":0}`** | `503` the same | +| `POST /admin-api/blocks` | **`400 {"error":"database error"}`** | `503 {"error":"…the block is NOT in effect"}` | +| `PUT /admin-api/policy {"mode":"Enforce"}` | **`200`, body `mode:"Observe"`** | `503 {"error":"…the change is NOT in effect"}` | +| `GET /readyz` | **`200 {"status":"ready"}`** | `503` | +| `GET /healthz` | 200 | 200 — unchanged on purpose: it is the recovery hatch, and it does not touch the database | + +`{"deleted":0}` is a fact about the list, so it may only be said when the delete +ran; a 400 is a fact about the request, so it may not be used for a storage +failure; and readiness has to prove the table the commands touch is readable — +`CanConnectAsync` only proves the file opens. The same stand with a healthy +storage and six concurrent `POST`s for one address answered `204 204 400 400 400 +400` before and `204` six times now: the unique index on (source key, provenance) +made the loser of a race the API itself started look like a caller who sent a bad +request, which is what a double-click on "block" in the console is. The write +retries against the winner's row. + +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 +line with `refreshed` inside a second. An empty 5xx body threw inside `apiRaw` +and was swallowed by the caller's `catch`. A row action now asks whether the +answer carried an `error` before it says it worked, and the refresh that follows +a failed action holds the note instead of erasing it. + `redirectTo` on a block is the one field that ends up in a response header, and the shipped image used to accept any string in it — `POST /admin-api/blocks` answered 204 for all of these, and the next request from that source paid: @@ -400,7 +432,7 @@ deployment. 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 44 things. The read side: it authenticated, listed the streak as +and asserts 45 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 @@ -449,22 +481,22 @@ 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 `fc90f50`, each stage run on its own, so +Rehearsed 2026-10-02, most recently at `a77ab53`, 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 `fc90f50` -gives the same counts: unit **128/128**, integration **99/99**, smoke **passed -19, failed 0**, compose **43 passed, 0 failed**, console **44 assertions, 0 +commit several fixes behind it. The same suite on the macOS host at `a77ab53` +gives the same counts: unit **128/128**, integration **106/106**, smoke **passed +19, failed 0**, compose **43 passed, 0 failed**, console **45 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 -**99/99**, smoke **19/19**, first try, nothing to fix. The first +**106/106**, smoke **19/19**, 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: **43 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. Console gate on Linux: **44 assertions, 0 failed** — +and 36 ms in three runs, 12 ms again at `a77ab53`. Console gate on Linux: **45 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 @@ -486,7 +518,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`: **44 assertions, 0 failed**, including +aarch64, node v24.20.0, `chromium-1243`: **45 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**. @@ -495,13 +527,13 @@ on the next request from that address. All three scenes in one cold run: 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 `fc90f50` — and every job -reported success: `lint` (both pinned tools download, verify their checksums -and find nothing), `source` (unit 128/128, integration 99/99, smoke 19/19), +`catthehacker/ubuntu:act-latest`, most recently at `a77ab53` — 5 jobs +succeeded, 0 failed: `lint` (both pinned tools download, verify their checksums +and find nothing), `source` (unit 128/128, integration 106/106, smoke 19/19), `image` (`openwaf:ci` 261 MB, compose smoke 43 passed / 0 failed), `console` -(44 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`, -screenshot artifact published) and the `freshness` job (pin 2026-10 = newest -2026-10). That is a stronger claim than +(45 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`, +screenshot artifact published, 552,268-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 gap is not hypothetical — running the file that way is what turned `lint` red, @@ -543,10 +575,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/ 99 tests driving the real pipeline against a fake upstream + OpenWaf.Tests.Integration/ 106 tests driving the real pipeline against a fake upstream scripts/smoke.sh 19 assertions against a running edge + a real upstream scripts/compose-smoke.sh 43 assertions against the built image (compose + nginx) -scripts/console-check.cjs 44 assertions against the page, in a real Chromium +scripts/console-check.cjs 45 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