The README carries the 404 contract, and the numbers describe the tree that has it

Run of 6e6461a:

* macOS host gates: build 0 warnings / 0 errors, unit 128/128, integration
  109/109, smoke passed 19 / failed 0, compose 43 passed / 0 failed, console
  47 assertions / 0 failed, image 261 MB.
* Linux rehearsal, each stage on its own: source in mcr.microsoft.com/dotnet/sdk:10.0
  (Ubuntu 24.04.5, SDK 10.0.401) 128/128, 109/109, 19/0; compose in docker:cli
  against the host daemon 43/0, enforcement lag 13 ms; console in
  mcr.microsoft.com/playwright:v1.63.0-noble (chromium-1243) 47/0.
* act 0.2.89 on catthehacker/ubuntu:act-latest: 5 jobs succeeded, 0 failed —
  lint, source, image, console (screenshot artifact, 590,488-byte zip),
  freshness (pin 2026-10 = newest 2026-10).

The new section states the 404 contract with both columns measured on shipped
images (08bebf43 before, 4823e9ae after), and names the console's copy of the
bug: every 404 read as "the admin API is switched off", and the destructive
"clear the automatic bans" button reading nothing back at all.
This commit is contained in:
Pavlo Ratushnyi
2026-10-02 05:26:49 +02:00
parent 6e6461a760
commit 378775ce83
+36 -14
View File
@@ -357,6 +357,28 @@ 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.
A 404 has to explain itself, because the page has nothing else to work from. On
the shipped image the same API answered two missing rows differently:
| request | before | now |
|---|---|---|
| `DELETE /admin-api/countries/ZZ` | `404 {"error":"no country rule for \"ZZ\""}` | unchanged |
| `DELETE /admin-api/allow/999999` | **`404`, `Content-Length: 0`** | `404 {"error":"no allow entry with id 999999"}` |
The silent half is what the console filled in itself: `apiRaw` read **every** 404
as "admin api disabled — set `OpenWaf__Admin__Token`" and threw, so removing a
row another tab had already removed sent the operator to configure a token that
is already configured — and since the throw landed in a catch that says nothing,
the status line ended up reading `refreshed` in the success colour. A 404 is now
an answer like any other: its body is shown, and whether the admin surface is
off at all is decided by the core read (`/admin-api/state`), which shows the
edge's own sentence rather than a guess made from a status code. The same pass
found the most destructive button on the page — "clear the automatic bans" —
firing its `DELETE` and reading nothing back, so cleared 7, cleared 0 and a
refused write looked identical after the reload; it now reports the count the
edge gave, and the note for the action just taken survives the refresh that
action itself triggered.
`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:
@@ -432,7 +454,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 45 things. The read side: it authenticated, listed the streak as
and asserts 47 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
@@ -481,22 +503,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 `a77ab53`, each stage run on its own, so
Rehearsed 2026-10-02, most recently at `6e6461a`, 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 `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
commit several fixes behind it. The same suite on the macOS host at `6e6461a`
gives the same counts: unit **128/128**, integration **109/109**, smoke **passed
19, failed 0**, compose **43 passed, 0 failed**, console **47 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
**106/106**, smoke **19/19**, first try, nothing to fix. The first
**109/109**, 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, 12 ms again at `a77ab53`. Console gate on Linux: **45 assertions, 0 failed** —
and 36 ms in three runs, 12 ms at `a77ab53`, 13 ms at `6e6461a`. Console gate on Linux: **47 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
@@ -518,7 +540,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`: **45 assertions, 0 failed**, including
aarch64, node v24.20.0, `chromium-1243`: **47 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**.
@@ -527,12 +549,12 @@ 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 `a77ab53` — 5 jobs
`catthehacker/ubuntu:act-latest`, most recently at `6e6461a` — 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),
and find nothing), `source` (unit 128/128, integration 109/109, smoke 19/19),
`image` (`openwaf:ci` 261 MB, compose smoke 43 passed / 0 failed), `console`
(45 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`,
screenshot artifact published, 552,268-byte zip) and the `freshness` job (pin
(47 assertions / 0 failed with `playwright@1.63.0` and `chromium-1243`,
screenshot artifact published, 590,488-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
@@ -575,10 +597,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/ 106 tests driving the real pipeline against a fake upstream
OpenWaf.Tests.Integration/ 109 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 45 assertions against the page, in a real Chromium
scripts/console-check.cjs 47 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