39 Commits
Author SHA1 Message Date
Pavlo Ratushnyi cd5935b28e the gates gain the proof their own claims were missing, and the README has to pay for its numbers
ci / lint the workflow and the shell (push) Successful in 13s
ci / build, test, smoke (push) Successful in 1m59s
ci / the operator page in a real browser (push) Successful in 2m45s
ci / build the image and smoke it (push) Successful in 4m25s
compose-smoke.sh: the read-side redirect guard is proven on the shipped image at
last — a good target is written through the API, the stored column is rewritten
underneath a running edge through the sidecar, and the edge is asked what it
sends once the snapshot rebuilds. javascript:alert(1) answers 301 to the policy
default and never to the stored value; a CRLF-bearing row answers 301 rather than
the 500 Kestrel used to produce, and injects nothing. A curl 000 now samples the
container it was aimed at and prints what it reports, and the gate ends by making
the dead case happen on purpose: compose stop, 000 beside exited/unhealthy,
compose start, running/healthy again.

console-check.cjs: the observation table is waited for rather than read at one
instant (an act run saw X-Total-Count: 0 where the same head a minute earlier had
11 rows), and the page's own request paths are pinned — the 14 admin-api calls it
issues, their query strings, no others, none answered 404. A wrong URL on a page
never looks like a wrong URL; it looks like an empty table.

ci-gates.sh gains readme-counts: each gate records the total it actually ran into
GATE_TOTALS_DIR and the README's claimed number is compared with it. Its first
verdict was that the README claimed 229 assertions for a gate printing 368 — a
139-assertion gap nothing could see. The README now says 368 and 168, both
measured in this run, and the run-by-run table gains 2405.

Verified locally: compose smoke 368/0, console 168/0, smoke 256/0, lint green at
actionlint 1.7.12 and shellcheck 0.11.0.
2026-10-06 01:16:20 +02:00
Pavlo Ratushnyi 249e3f93b5 the gates gain the assertions they were missing, and lint gains a local caller
ci / lint the workflow and the shell (push) Successful in 9s
ci / build, test, smoke (push) Successful in 2m23s
ci / the operator page in a real browser (push) Successful in 2m47s
ci / build the image and smoke it (push) Successful in 4m0s
Four gaps named on the board, each closed by making the shipped image answer the
question instead of an in-process test:

OPEN-45 - three pagination bounds were proven only in-process. On the image now:
the block listing's ceiling at its UPPER end (limit=2001 -> 400 naming
"limit must be 1..2000; got 2001" - only the lower end was on the image), a
negative offset on the streak map (checked on observations, blocks and alerts,
never here), and that an offset on the alert listing moves to a different row -
the scene used to assert only the truncation arithmetic.

OPEN-49 - DELETE /admin-api/countries/{code} validates the code the same way the
write does, and nothing on the image had ever asked. Three checks added: "12" and
"USA" are refused with the write's own sentence, not answered as if a row existed.

OPEN-48 - jval piped the body straight into json.load, so a request that produced
no body printed a Python traceback into the middle of an assertion and the
assertion compared an empty string. "the counter is 0", "the field is missing"
and "there was no answer at all" were the same word in the log. Three states,
three answers now: NO_JSON_BODY, empty, the value.

OPEN-41 - the markup-path assertion read the observation table once. That row is
written by the coalesced observation writer, so its arrival is on a timer: two
runs of one head at 9383362, one failed with `[]` and the next passed, and the
`[]` could not tell "not persisted yet" from "never persisted". The row is waited
for with a 10 s budget, the wait is printed either way, and a failure names what
was waited for and every path cell the table did hold.

OPEN-44 - the workflow files and the smoke scripts were linted by exactly one
caller, a CI job, so `ci-gates.sh all` could be green on a tree CI would refuse.
The pinned actionlint 1.7.12 and shellcheck 0.11.0 (same checksums) move into
scripts/ci-gates.sh as a `lint` gate and the CI job calls it: one definition, two
callers. A host with neither tool and no supported platform exits 2 - "cannot
run" - rather than reporting a pass, the console gate's convention.

Measured on this tree: scripts/ci-gates.sh lint green locally (actionlint 1.7.12,
shellcheck 0.11.0); compose smoke 356 passed / 0 failed, up from 348 by exactly
the eight assertions added above; the console check passed all its assertions
locally against the built image.
2026-10-06 00:32:28 +02:00
Pavlo Ratushnyi 36d9338621 the queue is settled when it is empty, and the impact scene asks its questions one at a time
ci / build, test, smoke (push) Successful in 2m39s
ci / the operator page in a real browser (push) Failing after 2m29s
ci / lint the workflow and the shell (push) Successful in 8s
ci / build the image and smoke it (push) Successful in 4m2s
Two assertions that could not pass, each for a different reason.

AlertPushQueueTests.Attempts_run_out_and_the_surface_says_who_was_never_told
waited for the first delivery to give up and then asserted the queue was empty.
Six 502s at N=3 raise two alerts - the crossing at 3, the doubling at 6 - so two
deliveries are owed, and the second is still inside its backoff window when the
first gives up. Measured on the Gitea runner (run 2361, head 223b8d6): 404 of 405
passed and this one read pending=1. The wait now asks for both, which is what the
Settled helper two screens up already says a settled queue means.

console-check.cjs asked /admin-api/impact whether a live range already covers the
match while its own seeded exemption was still live. The endpoint reports
alreadyCoveredBy as what already ANSWERS for the match's own address, and a live
allow answers that address first, so the field is null by design and the
assertion could not pass for any build. Measured on the same run: the answer
named the exemption and nothing else. The exemption now comes off before that
question is asked.
2026-10-05 21:53:02 +02:00
Pavlo Ratushnyi ddddfc864b recovered-partial: the blast-radius preview exists on disk with nobody's record on it
Recovered-partial, UNVERIFIED. These changes were in the working tree at session
start with no checkpoint record on any item (OPEN-75 carries no execution plan,
work result or handoff note), so they are preserved rather than built on.

Attribution: they are the OPEN-75 surface — GET /admin-api/impact, the console
panel that calls it, the write-path refusal of abbreviated v4 spellings, and the
smoke / compose / console scenes for it. The README section and endpoint-list
entry the item's definition of done asks for are not here.

Gate evidence taken against this state, not claimed for it:
  build (warnings-as-errors)  clean
  unit                        378/378
  integration                 403/405 — AlertPushQueueTests.Attempts_run_out_and_
                              the_surface_says_who_was_never_told and
                              PillarFailureVisibilityTests.The_snapshot_age_is_
                              measured_against_the_ttl_it_is_supposed_to_respect
                              fail here AND fail identically at 6f92d37 with
                              these changes absent, in a separate worktree, so
                              they are not this work's failures; their failure
                              site moves between runs (assertion vs fixture
                              StartServer), which is what an environment-sensitive
                              test looks like.
2026-10-05 18:20:42 +02:00
Pavlo Ratushnyi 6f92d377e7 one search across every store the operator's decisions live in
ci / lint the workflow and the shell (push) Failing after 12s
ci / build the image and smoke it (push) Failing after 10s
ci / the operator page in a real browser (push) Failing after 1m35s
ci / build, test, smoke (push) Successful in 1m53s
GET /admin-api/find?q=<text>&limit=<n> asks where a phrase appears in one call:
blocks (key, reason, last path), ranges (match, reason), exemptions (match,
note), path rules and path budgets (pattern, note), alerts (kind, key, detail,
last path), change records (target, detail) and country rules (code, name). Each
row names the store it came from, what it is keyed by, when it was written,
whether it is in force, the text that matched and the field it matched in. The
phrase an operator remembers - a ticket number, a customer's name - is not a
field any listing filters on, so asking it used to mean opening eight listings
and reading every row.

Rulings:
- the query is data, not LIKE's grammar. The backslash, the percent and the
  underscore are escaped and the match runs LIKE ... ESCAPE '\', so "100%"
  searches the four characters "100%" and not "anything after 100". Unescaped, a
  percent inside an operator's own sentence answers about rows nobody asked
  about; the gate searches 100%, a_b and a literal backslash to hold this.
- an address query returns the rows that COVER it, not only the rows that name
  it - the part a grep cannot do. Searching .69 returns the /29 that refuses it
  although no row contains that address, and the row says so: "203.0.113.64/29
  covers 203.0.113.69". Blocks are matched on the key this edge files the
  address under, the rule the dossier and the story both had to learn: with a /29
  key, searching .90 finds the ban stored as 203.0.113.88/29.
- a row that matches by text and also covers the address is answered once, with
  the text match as its reason: the row really does name the query.
- counts is per store and is that store's whole answer, not the rows this call
  happened to return, so matched: 0 over eight zeroed stores is a different
  sentence from a surface that read nothing - and a limit truncates the merged
  answer without pretending a store had nothing else in it.
- rows come newest-first. This is a search, not a story: the row an operator
  wants is the one they wrote last. /history reads oldest-first because it
  narrates, and neither default is wrong for the other question.
- q is 2..128 characters - one character is a dump rather than an answer, and 128
  is the longest target the change log stores, so a longer query cannot match the
  thing it was aimed at. limit is 100 by default, 500 at most. An unknown query
  parameter is refused by name. Country rules are searched by name as well as by
  code: "Ukraine" is what an operator remembers, "UA" is what the row stores.
- it is a read. The read-only token can ask it, and eight asks leave every store
  holding the same rows.

The console carries the same call: a phrase in, one line per row that carries it,
and a header counting all eight stores so an empty answer reads as an answer.

Gates: build 0/0, unit 377/377, integration 394/394 (11 new), console 159
assertions 0 failed (+8), smoke 243/0 (+13), compose 339/0 (+8), image 262 MB.
2026-10-05 12:24:50 +02:00
Pavlo Ratushnyi 3079b536ba one source through time: every decision this edge made about it, in order
GET /admin-api/history?ip=<address> joins the six dated stores that can name a
source - the operator's block, the ban this edge wrote itself, the range whose
CIDR covers the address, the exemption covering it, the alerts raised about the
key, the change records whose target is the key or a range that covers it, and
the observation row that counts its refusals - and returns them oldest-first with
what each one did. The dossier (OPEN-70) answers now, the horizon (OPEN-72)
answers soon; this answers what already happened, which is the question a
complaint on Monday actually asks.

Rulings:
- the order is the answer. "The exemption, then the ban" and "the ban, then the
  exemption" are different incidents, and an operator assembling this from six
  listings gets whichever one they opened last. Oldest-first is asserted even
  when the rows were written newest-first.
- a range or an exemption is in the story because it covers the address, not
  because a row names it - the distinction the dossier had to learn - and a
  change to that range is a change to this source's conditions, so its change
  record belongs here too.
- inForce is null for the kinds that are events rather than states. An alert, a
  change record and a sighting do not answer "is it in force"; false would say
  the alert had been switched off. Expired rows stay and say when they stopped.
- searched counts what was looked at, so an empty story is not confused with a
  surface that read nothing. Window 1..129600 min (7d default, the retention
  window of the rows that make up most of a story), limit 200 by default and it
  says how much it left out.
- the engine ban's evidence is its stored reason, not the reason plus the same
  fields again: the first run printed "last 404 /wp-login.php - last 404
  /wp-login.php - 3 refusals in a row".

The console carries the same call under the horizon: one address, the joined
timeline, each line stamped and marked in force or EXPIRED, with the header
naming the key the address is filed under and what was searched.

One gate assertion moved rather than the product: the scene asked for the story of
an address "with nothing recorded" and got 34 change records, because the
netblock scene writes and removes 192.0.2.0/24 through the run and a change to a
/24 really is part of the story of every address inside it. The surface was right;
the assertion had picked an address that was not outside anything.

gates: build 0 warnings / 0 errors, unit 377/377, integration 383/383 in 34 s,
console 151 assertions 0 failed, smoke passed 230 failed 0, compose 331 passed
0 failed against the built image at 262 MB, 0 containers left behind.

Refs OPEN-73.
2026-10-05 11:54:45 +02:00
Pavlo Ratushnyi 1ec794dc75 the horizon says what stops being enforced soon, and what answers afterwards
GET /admin-api/expiring?within=<minutes> (1..1440, 30 by default) lists the dated
entries that stop being enforced inside the window, nearest first, and each
address-shaped row carries thenAnswers: the real DecisionEngine.Decide over a
snapshot with only that entry removed. An exemption about to lapse therefore says
which ban is waiting underneath it ("block_operator by 203.0.113.16/28"), and a
block that stands alone says the source goes free. A path rule and a path budget
have no single answer: thenAnswers is null and whyNoAnswer points at
/admin-api/decide?ip=&path= instead of the surface guessing one. Entries that
never expire are not listed; alreadyExpired counts the dated rows whose moment
already passed, which is what separates "nothing expires soon" from "there are no
dated entries". The listing reads the database, the read-only token can ask it,
and six asks write nothing.

Rulings:
- the probe address for a CIDR is its network address, which is inside the group
  it describes; a pattern is not probed at all.
- the window is capped at a day because that is the longest thing an operator
  plans for; out of bounds is a 400 naming 1..1440.
- the console prints the window it asked for as the first line of the answer and
  empties the box before the call, so neither a scene nor an operator on a slow
  link can read the previous answer as the new one.

Two product defects fell out of the gates on the way:
- the alert push worker was registered as a hosted service above the schema step,
  and hosted services start in registration order: on a cold start its first
  queue sweep read alert_push_queue out of a database this process had not
  created, and "SQLite Error 1: no such table" became alertWebhookLastError -
  the state page blaming the webhook endpoint for the edge's own startup order.
  The notifier is now registered below the warmer and the order is asserted.
- a listing the edge could not answer was drawn as an empty one: with two of the
  page's fourteen calls answering an error, the observation line printed "0
  sources the edge has recorded" and the streak line "0 of 0 standing streaks
  listed" over a map holding twelve sources. A count read off a failed answer is
  0, and 0 says there is nothing to see. Every count-bearing note and its table
  now say NOT READ with the error beside them.

The gate's own traps, caught and fixed: the budget scene cleared the engine ban
its probes caused after the probe that ban was failing, and its reopen retry loop
banned itself three refusals deep; the alerts assertion read a row written off the
response before the next refresh drew it.

gates: build 0 warnings / 0 errors, unit 377/377, integration 375/375 in 35 s,
console 142 assertions 0 failed, smoke passed 217 failed 0, compose 324 passed
0 failed against the built image at 262 MB, 0 containers left behind.

Refs OPEN-72.
2026-10-05 11:22:01 +02:00
Pavlo Ratushnyi 4280ebb2ca a request budget says who it is pausing, and one source can be let out
The budget listing has carried three numbers per budget since OPEN-68 — sources
counted, windows running, over budget now — and no name. "3 over budget" is the
half an operator cannot act on, and the only lever for one of those three was
`DELETE /admin-api/rate-rules/{id}`: take the budget off every source on the site
to release one office behind one NAT. The edge-wide budget never had this hole,
because /admin-api/rate names its sources.

  * GET /admin-api/rate-rules/{id}/sources — who this budget is inside right now:
    sourceKey, count against the limit, when the window ends and how many seconds
    are left, overBudget. Busiest first, live windows only, paged with
    X-Total-Count / X-Truncated like every other listing. `total` is the same
    number the listing's `liveWindows` reports and the over-budget count matches
    `overBudgetNow`: the names come from the same state as the three counters,
    not from a second ledger.
  * DELETE /admin-api/rate-rules/{id}/sources?source=<key> — drop one source's
    window on one budget. Not an exemption, and the answer says so: the window
    restarts at zero and the budget counts this source again from there, while
    every other source stays paused. An operator who types an address gets the
    key this edge files it under, and the answer names the key it dropped,
    because the others sharing it are still paused. A second clear answers
    `cleared: false` and writes no second record; the first is in the change log
    under `rate rule / changed`.
  * Console: a `who` button per budget row, and a `let out` button per source.

Rulings kept: the entries are source keys with the prefix rule printed beside
them (a /24 in the list is the point, not a bug); the limit is passed in from the
rule row rather than copied into the counter, so one number is enforced once;
reading spends nothing, so the page that exists to show a pause cannot cause one;
an empty list says which kind of empty it is — "counting, nobody inside a window"
and "this budget has expired" are different answers; and the read-only token gets
a 403 on the clear, not a 401, because the token is known and its level is the
answer.

What the run caught, on this tree: two console scenes failed with `answered 403`
because the gate's own probes are refusals and the streak pillar had banned the
probe addresses — a correct edge, and a scene that cannot retry past a one-hour
ban. Both now clear that one ban by name, leaving the engine bans the netblock
scene reads standing. The first run of the feature also caught the clear
reporting `cleared: false` after actually dropping the window: the derived-key
branch dropped the state and never set the flag.

build 0 warnings / 0 errors, unit 377/377, integration 365/365 in 31 s,
console 129 assertions / 0 failed, smoke passed 202 / failed 0, compose 317
passed / 0 failed against the built image at 262 MB.

Refs OPEN-71.
2026-10-05 10:13:29 +02:00
Pavlo Ratushnyi bcfc83db40 one address in, and the edge answers everything it knows about it
An operator investigating one source had to open six admin calls — blocks,
allow, streaks, observations, alerts, the dry run — and hold the join in their
head. The join is where the wrong answers are: a v6 address looked up in full
when the ban is filed on the /64, a CIDR ban looked up by equality that never
finds it, an exemption that expired last week read as a live one, a streak
counted in one process read as the deployment's.

GET /admin-api/source?ip=<address>[&path=<path>] answers it in one call, by
asking the same objects the request path asks rather than a second copy of
their logic. Three rulings hold it together:

  * Containment, not equality. operatorBlock carries cameFromRange and the
    match that covered the address, through the same NetworkBanIndex the wire
    matches with (longest prefix first) and NetworkMatch for the allowlist.
    There is no second matcher in this build to drift.
  * The key, not the address. sourceKey and the prefix lengths that produced
    it travel in the answer: bans, streaks and budgets are filed under the key,
    the allowlist and the range bans are matched against the address, and the
    answer separates them.
  * `none` and "not visible here" are different words. A live engine ban under
    Observe mode reports applies: false with a verdict of none; an expired row
    reports live: false rather than null, because "this address used to be
    exempt" is a fact an operator acts on.

Nothing is written and nothing is spent — the dry run's rule applied to the
whole dossier. RateRuleTracker.WindowsFor is a new read that lists every path
budget a source is already inside without being handed a path, so the dossier
does not have to guess from a path it was not given, and N dossiers leave every
counter where they found it. ip is required and must be a full address: a typo
is a 400 naming the value, never a none. The read-only token may ask it.

What the run caught, on this tree: the console scene waited for "an answer is
in the box", which the previous answer still sitting there satisfies — three
assertions read the address asked one click earlier. The scene now empties the
box and waits for the address it asked by name, and matches a range row by the
key its delete button holds rather than by a cell that prints a `range` badge.

build 0 warnings / 0 errors, unit 374/374, integration 356/356 in 39 s,
console 126 assertions / 0 failed, smoke passed 192 / failed 0, compose 311
passed / 0 failed against the built image at 262 MB.

Refs OPEN-70.
2026-10-05 09:43:39 +02:00
Pavlo Ratushnyi 6a65cbf344 the dry run says what the volume pillar would answer for that source
`GET /admin-api/decide` answers what would happen to a named request and which
pillar said so, and it stayed silent about the one pillar whose number the
operator is choosing. The count is kept in the guard rather than read off a
snapshot, so the preview printed `rate: not_evaluated` and left "would this source
be rate-limited" as the one question the surface exists to answer could not ask.

The rulings this had to make, and the answer each one got:

* Reading, never spending, is the invariant. The section is built from peek reads
  of both trackers, so N dry runs leave `count` exactly where it was and write no
  alert. A preview that answered by counting its own question would refuse the next
  real request because somebody pressed a button — the tool for finding an
  over-tight budget would itself be the cause of it.
* Four silences stay apart: `not_counted` (the pillar is off, so there is no budget
  to cross), `no_source` (no address was asked, and a budget is a claim about a
  source), `refused_now`, `would_be_counted`. A fifth, `over_budget_not_enforced`,
  exists because "over budget" and "would be refused" are two answers separated by
  the mode, and collapsing them is how an observe budget becomes a surprise the day
  someone switches it on.
* `reached: false` says an earlier pillar answers the request, so the guard would
  never consult the counter for it. The volume section still reports the counters —
  they are true — but the note stops talking about a budget this request would
  never touch.
* A budget in force for the path with nothing counted for this source yet prints
  `counted: false`, not `count: 0`. "0 of 2" and "nothing yet" are answers an
  operator acts on differently.
* The path budgets are matched by the same `PathPattern.Matches`, in the same
  order, as the guard: a preview that matched differently would be a preview of a
  different edge.
* The counters are this process's (`scope: "this-process"`), said in the answer
  rather than left for the operator to remember.
* The `rate` pillar row keeps `not_evaluated` — the engine really did not evaluate
  it — and its note now points at the section that did, instead of ending as a
  silence.

What the runs caught, in order:

* The first version answered `refused_now` for an Observe crossing. The counters
  were right and the sentence was wrong: observe enforces nothing. The mode is now
  part of the verdict.
* An integration expectation asserted the note of the `rate` pillar row after a
  crossing, and read the engine ban the crossing itself had written instead — the
  request was no longer reaching the volume pillar. The assertion moved to the
  preview taken before the crossing, and the ban case now asserts the honest note.
* Rewording that note broke an older preview test that keyed on the word "preview"
  in it; the wording keeps the word, and the older test is the one that caught the
  rewording.
* The smoke scene compared a listing's over-budget count against a request count,
  which would have passed for the wrong reason; it now asserts the pair
  (tracked, over) before and after six previews.

Gates at this commit, each stage on its own: build 0 warnings / 0 errors, unit
371/371, integration 345/345 in 43 s, console 122 assertions 0 failed, smoke
passed 182 failed 0, compose 304 passed 0 failed against the built image at
262 MB, 0 containers left behind.

Refs OPEN-69.
2026-10-05 09:14:09 +02:00
Pavlo Ratushnyi 7beaa7e463 a source's request budget can be written for one path
The edge-wide budget is one number for the whole site, and for a login path that
number is always wrong: a hundred requests a minute does not stop a
credential-stuffing run that makes twenty attempts a minute — twenty looks like
a person — while five a minute locks an honest office behind one NAT out of every
page they own. The only way to make both statements true is to price the paths
differently.

The rulings this had to make, and the answer each one got:

* A rate rule is not a path rule. A path rule refuses a request because of what
  it asked for; a budget refuses it because of how often that source asked. The
  pattern language is shared because the thing being described — this path and
  what hangs off it — is the same.
* Crossing a budget writes no engine ban. The claim is about one path, so a ban
  would refuse the rest of the site as punishment for a login-page rate. The
  answer is 429 with Retry-After for the rest of that source's window, and the
  reason names the rule, its count, its limit and the pattern it was written for.
* The counters are a separate tracker, not a scope inside RateTracker. The
  edge-wide counter reads its limit and window from the policy; a rule carries
  its own. One map whose parameters change per entry is a map whose eviction and
  idle rules stop meaning anything.
* The budgets hang off rateMode rather than getting a switch of their own:
  Enforce refuses, Observe counts and raises one rate_breach alert per source per
  window naming the pattern, Off counts nothing at all. A half-counting edge is
  the state an operator cannot reason about.
* A second live budget for one pattern is a 409 — two live numbers for one path
  mean the stricter one wins by accident rather than by the operator's choice.
* The bounds are the policy's own (1..100000 requests, 1..3600 seconds), so one
  vocabulary of numbers covers both budgets and a document cannot bring in a
  budget the API would have refused.
* The listing answers with three counters — sources counted, windows running,
  over budget now — because "nobody has blown this" and "nobody can" look
  identical on paper and are different decisions.

What the runs caught, in order:

* The smoke scene first ran on 198.51.100.0/24, which an earlier scene of the
  same gate allowlists. An allowlisted source never reaches the counter, so the
  scene would have printed a row of 200s while measuring nothing. It runs on
  TEST-NET-1 now.
* The console scene drew three 404s of its own and the streak pillar banned the
  address, so the reopen assertion read the streak's 403 instead of the absence
  of the budget. The engine list is cleared before that probe and the comment
  says which pillar the clearing belongs to.
* The compose assertion compared a JSON boolean against the word "yes".
* The change-log vocabulary test still listed six sections; there are seven now.
* A unit expectation counted requests where the tracker holds windows: one
  (rule, source) pair is one window, and the count inside it is what the budget
  is measured against.

Gates at this commit, each stage on its own: build 0 warnings / 0 errors, unit
361/361, integration 337/337 in 30 s, console 120 assertions 0 failed, smoke
passed 169 failed 0, compose 300 passed 0 failed against the built image at
262 MB, 0 containers left behind.

Refs OPEN-68.
2026-10-05 08:40:58 +02:00
Pavlo Ratushnyi dd10dd9839 the edge notices the netblock behind its bans and offers it as a range
A scanner farm inside one /24 is twenty engine bans and twenty operator
decisions: the streak rule works per source, and nothing in the edge connected
the rows. OPEN-66 made a range enforceable; this is the half that notices the
range is there.

The rulings:

- The evidence is the edge's own live engine bans. An operator's row is a
  decision already taken, and an expired ban is a row the edge stopped
  honouring; neither is evidence about a netblock. Nothing new is observed and
  nothing new is stored.
- An offer is not a ban. A candidate changes nothing on the wire: the operator's
  POST /admin-api/blocks with the CIDR is what enforces it, and the console
  button is that same call. Twenty honest visitors of one provider and one farm
  inside one rented block produce the same number, and only a human tells them
  apart.
- Grouping is one allocation up from the key: v4 to /24, v6 to /48, because the
  v6 streak key is already a /64 and grouping there would only repeat the key.
  The count and both prefixes are policy keys with bounds, because a host that
  hands out /22s should be shown the block it can act on.
- A ban keyed on a block wider than the netblock prefix is skipped: that row
  already claims more than a /24, and counting it as one ban inside a /24 would
  invent a candidate out of it.
- Reading the list is not news — the scan that answers the surface raises no
  alert, so refreshing a page cannot manufacture alert rows. The timer's scan
  raises netblock_candidate through the same durable alert table and push queue
  as every other kind, at most once per block per six hours, and never for a
  block the operator has already banned.
- A failed scan retires the offers instead of repeating the last ones, and
  /admin-api/state says which of off / failed / found-nothing this is.

What the run caught:

- The console's "ban this range" button posted a body with no content type, and
  the edge refused it: the button did nothing and the page looked idle rather
  than wrong. It uses the page's own postJson now, and the console gate asserts
  the row it writes, the wire answer for a source inside it, and the offer
  turning into "already banned".
- The grouping parsed ban keys with SourceKey.TryParse, which fails on the
  "2001:db8:1:2::/64" spelling the engine stores v6 bans under — so no v6 ban
  was ever grouped. Keys are parsed as keys, prefix included.
- An assertion claimed 203.0.113.137 sits under 203.0.113.128/24. That is a /25:
  the arithmetic was wrong in the test, not in the mask.

build 0 warnings / 0 errors, unit 353/353, integration 326/326 in 31 s, console
114 assertions 0 failed, smoke passed 149 failed 0, compose 293 passed 0 failed
against the built image at 262 MB.

Refs OPEN-67.
2026-10-05 07:55:06 +02:00
Pavlo Ratushnyi 848ec1a82a an operator can ban a range, not only an address
A scanner rotating through a rented /29 used to cost one row and one write per
address: POST /admin-api/blocks answered "not an IP address" for a CIDR while
the allowlist control beside it accepted one, and the config export could not
carry the operator's answer either. A CIDR now has its own table and is enforced
by containment.

The rulings:

- One list, two shapes. GET /admin-api/blocks merges address rows and range rows
  and says which is which with `kind`; DELETE ?key= takes the CIDR as it was
  typed; ?source=engine still cannot reach an operator's range, while
  ?source=operator clears both operator shapes.
- Containment is checked on the raw peer address, the same field the allowlist is
  matched on, after the exact operator block and before the engine's own ban. The
  verdict stays block_operator, so nothing downstream had to learn a new reason;
  the decision trace names the range that answered, and an allow entry still
  outranks a range.
- What is written is normalised before it is stored: 203.0.113.37/28 is stored as
  203.0.113.32/28, a /32 or /128 is stored as the bare address it already was,
  and the full-width prefix is refused on meaning rather than on form — "0.0.0.0/0"
  covers every address there is, including the one this was written from; that is
  a shutdown, not a ban on a source.
- A request pays for the number of distinct prefix lengths, not for the number of
  ranges: the index buckets by prefix and asks a set for the request address
  masked to it, most specific first, and an expired row does not stop the search
  for a broader live one.
- Export carries ranges in the blocks section and import lands them idempotently,
  so an edge's decisions survive the move. /state counts them apart from address
  blocks, and the console prints the shape beside the row.

What the run caught:

- BlockRow read Range?.Field ?? Entry!.Field. The two rows are mutually
  exclusive, so a range with no expiry, reason or redirect — the common case —
  dereferenced the row that is not there and GET /admin-api/blocks answered 500.
- NetworkBanIndex filed a row under "a.b.c.d/24" while the lookup compared a
  masked address with no prefix, so no range ever matched: ten unit tests red
  before the bucket key was fixed to the network address alone.
- smoke and compose both wrote their JSON bodies with escaped quotes straight
  inside a command substitution, which truncates the body and answers 400 — the
  hazard this file's own header warns about. The payloads are variables now.
- Scene ordering in smoke: the range scene clears the engine's list wholesale,
  which took the expired scanner row a later scene asserts on. It runs after
  those scenes now, and says why in the file.
- Test-side, worth keeping: 203.0.113.37/28 is not the network 203.0.113.16/28
  names, so an assertion that writes one and expects the other is testing the
  mask, not the match.

build 0 warnings / 0 errors, unit 334/334, integration 312/312 in 31 s, console
105 assertions 0 failed, smoke passed 137 failed 0, compose 285 passed 0 failed
against the built image at 262 MB.

Refs OPEN-66.
2026-10-05 07:22:40 +02:00
Pavlo Ratushnyi 4db36f86d0 the operator's console shows what changed on this edge
OPEN-64 gave the edge a record of every deliberate config change and an
endpoint that reads it; the record was invisible to the person it is for.
`/admin` now draws it: when, section, action, target, the note somebody
typed, and the surface it came through, newest 25 of the total.

Rulings this copy holds to:

  * The surface column says `operator` or `import`, never a person. The
    edge has one admin token; a column implying a per-person attribution
    it cannot provide would be a false record, not a thinner one.
  * Engine bans are absent, and the line under the table says so in the
    same breath as the counts: "engine bans are not here, they are not
    decisions". A table that mixed them in would read as "the operator
    chose to ban this address", which is a different claim.
  * The log's two bounds are printed under the table they govern -
    "pruned after 30d or 5000 rows, whichever comes first" - the way the
    retention windows sit on the observations and alerts tables. They come
    from `/state` (`changeRetentionDays`, `changeLogMaxRows`), so the
    numbers are the ones this process was actually started with.
  * A change record that did not land is named in the durable-writes pill
    with its count: "change records not written x1 (1 changes
    unrecorded)". It is the one write failure that changes nothing the
    edge enforces, which is exactly why it would otherwise go unseen - the
    config did change, only its record is missing.

What the run measured rather than assumed: the gate's seed writes a block
whose reason carries markup (`<svg onload=document.title='XSS2'> probe`),
and that reason is now the detail of a change row - so the change table
is a place where a stored operator string reaches the one browser in this
system that holds the admin token. The markup-seed assertion now covers
`#changes tbody`, and a companion assertion proves the string really
arrived as text, because without it an injection count of zero would only
prove that nothing was looked at.

Gates on this head: build 0 warnings / 0 errors, unit 313/313,
integration 298/298 in 34 s, console 98 assertions / 0 failed, smoke
passed 127 failed 0, image 262 MB, compose-smoke 278 passed 0 failed.

Refs OPEN-65.
2026-10-05 06:30:22 +02:00
Pavlo Ratushnyi 5cf93ef0fd a source that asks too often is stopped, even when the origin keeps answering
Every defence this edge had reads something that already happened: the status the
application answered, the country the address sits in, a list a human wrote. A
source asking for a cheap path two hundred times a minute produces no refusal, so
no streak matures, no path rule names it, and the origin serves all two hundred.
The only signal is the count, and a count has to be kept while the requests are
arriving — which is why this pillar is the one piece of live state on the request
path, and why it runs after the ordered decision instead of inside it.

`rateMode` off|observe|enforce, `rateLimitPerWindow`, `rateWindowSeconds`
(policy_settings, so no schema change). Off is the default: a limit nobody wrote
is a defence nobody asked for, and a false positive here locks out a whole office
behind one address. `observe` counts and raises one `rate_breach` alert per
source per window. `enforce` answers the request that crosses with 429 +
Retry-After — the surplus never reaches the origin — and writes an engine ban, so
the stop outlives the window, is shared with the other edges and survives a
restart; from then on the answer is the ban's own 403. One breach, one alert, one
ban write per source per window: a flood is exactly the traffic that turns a
per-request durable write into the thing that takes the database down.

Exempt by construction rather than by a second copy of the precedence rules: the
counter runs only on a plain Pass, so an always-pass prefix, an allowlisted
address, a matched rule, a block or a geo refusal never reaches it. The budget
counts exactly the requests that would have cost the origin.

Costs, stated rather than hidden: the counter is per process, so N edges allow N
times the budget (the same trade `SharedStreaks` made for the streak, at a round
trip per request instead of per observed response); the window is fixed, not
sliding, so the worst sustained rate is twice the limit across one boundary — a
sliding counter needs one entry per request, which is a map that grows at attack
rate.

Two things the run caught rather than the design assumed:

 * The guard wrote the 429 and then called next() anyway, so YARP answered
   "the request cannot be forwarded, the response has already started". The
   pillar now says whether the request may go through.
 * `StreakTracker.Configure` was called by nobody outside its own tests, so
   `maxTrackedSources` bounded nothing in a running edge — the map grew to the
   built-in 10000 whatever the operator had asked for. Both maps are configured
   at warm-up and on a policy write now.

And the smoke gate was not testing what its first line says. The edge was started
from the repository root, where there is no appsettings.json, so it loaded no
ReverseProxy section at all, logged "Request reached the end of the middleware
pipeline without being handled by application code" for every request, and
answered 404 for a path the upstream was serving with 200. Every assertion in the
file expects a 404 or a refusal, so the gate kept passing on an edge that never
proxied anything. Naming the content root fixes it; the streak scene also waits
for the ban row to exist before asking the wire whether it is enforced, because
the ban is written out of band after the response that proved it.

Gates on this tree: build 0 warnings 0 errors, unit 207/207, integration 219/219
in 20 s, smoke passed 48 failed 0, console 90 assertions 0 failed, compose 209
passed 0 failed, image 261 MB.

OPEN-56
2026-10-04 21:00:33 +02:00
Pavlo Ratushnyi 5e6a840731 a path rule refuses the request itself, before the upstream ever sees it
Every pillar this edge had until now judged the response or the source: a streak
of refusals the upstream produced, a country, an operator's list of addresses.
The request itself was never looked at. A known-bad request therefore always
reached the origin and cost it something, and became a defence only if the
origin's answer happened to fall in the refusal range three times in a row.

A request rule is a path pattern an operator writes: `GET/POST/DELETE
/admin-api/rules`, listed in the order they are enforced, with an action.
`observe` counts matches (one alert per rule per 15 minutes, the tally on the
listing) and lets the request through, which is how an operator learns what a
rule would have blocked before it blocks anything; `block` answers 403 naming the
rule id — the id, not the pattern, because a 403 body that quotes the pattern
tells the visitor which payload to change. It fires in Observe mode too: the mode
switches off what the edge decides by itself, not what a human wrote down. It
sits below the allowlist and above the two source-level lists, because "this path
is refused" is the more specific claim about this request.

The pattern language is a glob — `*` and `?`, anchored, case-insensitive, `*`
crossing `/` — and deliberately not a regex: the operator writes the pattern and
an anonymous visitor writes the path, and `(a+)+$` against 400 a's is a ReDoS
with the edge's CPU. A pattern that can only silently do nothing (no leading
`/`, `/*`, a control character, over 256 characters) is refused with the reason,
and at most 500 live rules exist because every request is checked against each.

Two things the run caught rather than the design assumed:

 * The rules read shared one statement block with the rest of the snapshot.
   `request_rules` is the newest table in the schema, and the default schema step
   is EnsureCreated, which creates a missing database and changes nothing about
   an existing one — so every database created before this feature has every
   table except that one, and the first refresh after startup would have thrown,
   frozen the operator's block list at its old contents, and looked healthy. The
   rules read is a statement of its own now: a missing table costs the rules
   pillar and says so (`requestRulesAvailable`, `requestRulesError`, a NOT READ
   line over the rules table) while every other pillar keeps enforcing. The
   migration set was stale in the same direction — it never had `source_streaks`
   either, so the `migrate` path could not create the table OPEN-52 added;
   `AddRequestRules` adds both.
 * The console gate banned its own probe address. The seed sets the streak
   threshold to 3 and the gate probes 404 paths, so the last assertion in the new
   scene read a `blocked_by_policy` as "the rule is still in force" — and the
   ban, unlike the rule, outlives `compose down` in the data volume. The scene
   probes its own address now and the cleanup clears engine bans.

Measured on this tree: build 0 warnings / 0 errors, unit 195/195 (44 new: the
glob's semantics and rejections, and where the new pillar sits in the order),
integration 208/208 in 25 s (14 new, including a fixture that drops the rules
table and asserts the operator block is still enforced), smoke 36/0 (7 new
against a running edge), console 85 assertions 0 failed (6 new, driving the rule
form in a real browser), compose 209/0 against the built image at 261 MB.
2026-10-04 19:48:52 +02:00
Pavlo Ratushnyi 5c7b0bef3b an alert can be pushed to an endpoint, so a 03:00 outage reaches something that acts
The alerting pillar ended at a table. The rows are right — the server-error
streak fires, the dry-run candidate is recorded — and then they wait for an
operator to open a page. That is the posture this project already removed for
blocking ("blocking is usually manual: a human notices abuse and adds an IP.
That never fires at 3am"), applied one level up: an alert nobody is told about
never fires at 3am either.

OpenWaf:Alerts:WebhookUrl (env fallback OPENWAF_ALERT_WEBHOOK_URL) POSTs each
raised alert as JSON — kind, sourceKey, count, lastStatusCode, lastPath,
createdAt, detail — off the request path, from a bounded queue of 1000, and only
after the row is durably written. Three attempts with a short backoff;
OpenWaf:Alerts:WebhookTimeoutSeconds (1-60, default 5) refuses startup outside
that range rather than falling back, as the other startup-parsed bounds do. The
default is empty, which is no push at all: the shipped stack behaves exactly as
it did before.

The endpoint is counted like every other write side pillar, because a webhook
that has been down for a week is otherwise indistinguishable from a quiet night:
alertWebhookFailures, alertWebhookLost, alertWebhookDelivered,
alertWebhookLastError, alertWebhookLastSuccessAt, plus alertWebhookConfigured and
alertWebhookHost — host, never the URL, since a webhook URL carries its secret
in the path and this is rendered on the operator page. The console's alert line
now ends in "pushed to <host>, N delivered" or "not pushed anywhere: each row
waits for someone to open this page", so "no alerts" and "alerts go nowhere" stay
two different sentences.

Two things the tests caught instead of the design assuming:
 * the queue was BoundedChannelFullMode.DropWrite, where TryWrite returns true
   and the overflow vanishes with no trace — the counter it was written to feed
   stayed at zero. The mode is Wait now, chosen for what TryWrite reports when
   the queue is full; nothing here awaits a write, so the response path still
   cannot block.
 * a refused push counted as an entry lost, which conflated a lost delivery with
   a lost record. The alert row is in the table either way, so EntriesLost on
   this pillar is reserved for the one case where the push is gone for good.

Measured on this tree: build 0 warnings / 0 errors, unit 151/151 (19 new),
integration 194/194 in 28 s (3 new: the push arrives with the alert in it, an
unconfigured edge sends nothing and keeps every row, an endpoint answering 500 is
counted and does not undo the alert), smoke 29/0, console 79 assertions 0 failed,
compose 209/0 against the built image at 261 MB.
2026-10-04 18:18:25 +02:00
Pavlo Ratushnyi dbf3c725e6 an operator block can now be time-boxed, on the wire and on the page
The model always had it: BlockEntry.ExpiresAt, DecisionEngine asking IsLive
before honouring a row, and the listing printing the column since OPEN-28.
What did not exist was a way to set it — AddOperatorAsync wrote ExpiresAt =
null for every operator block, and NewBlockRequest had no field for it. So
"block this for the night" meant "block this, and remember to delete it in
the morning", while the exemption form beside it already had a minutes box.

POST /admin-api/blocks now takes expiresInMinutes with the same 1..5,256,000
bound and the same rule as the exemption's field: present sets the expiry,
absent means the block stands until someone takes it off. Re-blocking an
address that already carries an expiry moves it, because the second call
means its own duration from now. 0 and 5,256,001 are a 400 naming the field
rather than a permanent block bought by a zero in a box. The console gets the
minutes input and refuses a zero before the round trip.

Measured on this tree: build 0 warnings / 0 errors, unit 132/132, integration
185/185 in 19 s (4 new: the expiry lands and the listing says so; 0, -10 and
5,256,001 refused by name with nothing written and the address still itself;
a block past its expiry stops being enforced while a second blocked address
stays blocked and the dead row shows as expired rather than vanishing; a
second POST moves the expiry), smoke 28/0, console 78 assertions 0 failed.
The console gate run also printed the row it wrote: expiry cell
"2026-10-04 15:05:37" against a permanent block's empty one.
2026-10-04 16:08:37 +02:00
Pavlo Ratushnyi 39dece60e4 the retention window is a config key now, and both tables say what it is
Retention was a constant on the policy record: 7 days for observations, 7 for
bans and alerts, read from nothing and shown nowhere (OPEN-19). Two keys now,
OpenWaf:Policy:ObservationRetentionDays and OpenWaf:Policy:BanRetentionDays,
1..365 whole days, and an out-of-range value aborts startup naming the key
rather than falling back to 7 — the same shape OPEN-13 chose for the refresh
TTL, because a silently widened window keeps rows longer than the deployment
asked for and nothing on any surface would say so. Split into two keys: the
two windows answer different questions and their sharing 7 days was
coincidence.

The window is printed where the rows it governs are printed: /admin-api/state
and /admin-api/policy answer observationRetentionDays and banRetentionDays,
the observation table appends "rows are pruned after Nd" and the alert table
"alerts are pruned after Nd".

Measured on this tree: build 0 warnings / 0 errors, unit 132/132, integration
181/181 in 20 s (8 new: 5 startup-refusal and bound cases, a 1-day window
pruning a 3-day-old observation, a 30-day window keeping a ban ten days past
expiry, both surfaces reporting 30 and 2, and the two defaults), smoke 28/0,
console 76 assertions 0 failed. The console gate needed two of its own
assertions rewritten, not relaxed: they compared the note text for equality
and the sentence grew.

Run against the real binary: ObservationRetentionDays=30 BanRetentionDays=2
reports 30 and 2 on both surfaces; ObservationRetentionDays=0 exits with
"OpenWaf:Policy:ObservationRetentionDays must be a whole number of days
between 1 and 365; got 0".
2026-10-04 15:37:27 +02:00
Pavlo Ratushnyi 3db8fdb76f An operator command that could not run is now asked of the shipped image
The storage-failure honesty fix (a77ab53) was proven in TestServer and never
asked of the ship shape — the same gap OPEN-25 closed for country rules.
scripts/compose-smoke.sh gains a 22-assertion scene. The trigger is SQLite
BEFORE INSERT/UPDATE/DELETE triggers on block_entries and policy_settings, not a
dropped table: a dropped table breaks the listing too, and a listing that
answers 500 is honest about being broken. The lie this scene is after is the 2xx
that still looks complete, so the trigger has to leave the reads working.

The first run of the scene caught its own bug: an INSERT/UPDATE pair left the
delete path untouched, so the two blocks really were deleted, the answer really
was 200, and the scene was asserting a failure that had not been produced
(195 passed, 6 failed, /tmp/c26_compose1.log).

The teeth were measured on this tree, not quoted from the ticket. A failed
DELETE answering {"deleted":0} again answers 204 passed, 3 failed on the image
(/tmp/c26_mutM1_compose.log) against 2 of 7 in-process. The console swallowing an
empty 5xx again answers 72 ok, 3 failed (/tmp/c26_mutM3_console2.log), with the
recorded status line reading "ok: deleted ? block(s)".

One assertion was written wrong and the mutation is what said so. "readiness
stops saying ready when the block table is not there" still answered 503 with
/readyz put back to CanConnectAsync — 207 passed, 0 failed
(/tmp/c26_mutM2_compose.log) — because renaming the table breaks the snapshot
build as well, and the snapshot guard refused for its own reason under the same
status code. A code two guards can produce proves nothing about either of them.
The scene now reads the body: the block-table read answers with the storage error
alone, the pillar answers with "the guard's snapshot has not refreshed". With
that in place the same mutation answers 208 passed, 1 failed
(/tmp/c26_mutM2b_compose.log).

scripts/console-check.cjs gains the page half of AC6, which it had never asked:
an empty 503 on a destructive row action has to be said out loud, must not
become the success note the button would write, has to survive the refresh that
action triggers itself, and has to clear on the refresh after that. The scene
records every sentence the status line wears during the click, because the
regression writes its green note and loses it under "refreshed" before a single
after-the-fact read could see it.

209 compose assertions, 75 console assertions, both gates green on this tree.
2026-10-04 12:26:14 +02:00
Pavlo Ratushnyi 5c44b7c742 A console gate that skipped its own escaping invariant used to report success
The markup-seed assertions are guarded by the seed values, and the seed values
default to empty. Measured on this head, same seeded stack, driver only:

  with the seeds:               69 ok, 0 failed, exit 0
  with SEED_MARKUP_* unset:     65 ok, 0 failed, exit 0
                                and the line "console check: all assertions passed"

Four assertions were not there and the summary line is identical either way. The
seeding script sets both today, so nothing is broken right now — what is broken is
that nothing required them to be present, in the driver or in the Linux rehearsal,
which already refuses a missing SEED_ERROR or SEED_EXPIRED_CIDR and says nothing
about these two.

The driver now names an absent seed instead of stepping around it, and the
rehearsal refuses one the same way it refuses the other two. Teeth of the new
guard, measured: the same unset run now gives 65 ok, 1 failed, exit 1, and the
failure line carries the two empty values by name.

Teeth of the invariant itself, re-measured rather than carried forward: reducing
esc() to identity in the shipped page gives 7 failures, not the 6 this item
originally counted — the filter-echo case was added after that number was taken —
and the page title becomes XSS. Reverted; the tree carries no mutation.
2026-10-02 19:32:38 +02:00
Pavlo Ratushnyi b75888fa83 Every source key the console prints is now a question the operator can ask back, and the counts answer it filtered
/streaks learned the ?source= filter the observation and alert listings
learned in OPEN-33, and standingStreaks narrows with the rows while
trackedSources stays the map size. The console narrows observations and
streaks to one key from a box or from a click on any key in any table,
prints the filtered total under each, and says the words 'no recorded
observations for <key>' instead of drawing an empty box.

The first version appended '&source=' to a bare path, which is a
different route: the edge answered 404 and the streak line printed
'unknown scope'. The console gate caught it; the API tests did not,
because they call the API. Hence withSrc, which decides the separator
per path.
2026-10-02 16:21:35 +02:00
Pavlo Ratushnyi 3f24c5d31c A ban that could not be written was logged as a concurrency race, and nothing was in force
Measured on the shipped image with writes to block_entries aborted by SQLite
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 - and the only sentence the
log offered said the opposite.

BlockStore now asks storage which case it is: re-read the row. A live engine ban
for that source means somebody won the unique-index race and nothing is wrong;
no row, or a read that cannot run either, means the write never happened. The
second case is counted (DurabilityHealth.Bans), logged with its real reason and
its consequence, and gates /readyz - the enforcement path is the path that
gates.

That also moved the boundary drawn last cycle. Observations, alerts and retention
are reporting pillars: counted, shown on /state and on the console, and no longer
gating readiness. The measurement that forced it: with the gate in place, one
lost alert left alertWriteFailures at 3 and /readyz at 503; the triggers were
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".

ObservationWriter now retries every tracked source while it has an outstanding
failure: the write-amplification bound protects against load, not against
retries, and without this the lost rows waited for each source to be due again a
full interval later.

Teeth: BanWriteFailureTests (3) - 3 failed / 0 passed before the fix; two
WriteFailureVisibilityTests assertions re-drawn for the new boundary. Gates:
compose-smoke 63 -> 72 (the ban scene asserts 404x5, no row in storage, 503
naming bans, race lines 0/0 and the honest line present, then the ban landing on
a later refusal), smoke.sh counters now include bans, console-check 57 -> 58.
2026-10-02 09:24:43 +02:00
Pavlo Ratushnyi 2b0163aa80 A pillar that could not write kept answering with the count it had before the break
The read side got its counters last cycle; the write side was still catching
everything, logging one line and keeping the process alive. A failed write is
worse than a failed read - the row never existed and no later request brings it
back - and the surface hid it better. Measured on the shipped image with SQLite
triggers aborting every INSERT/UPDATE on source_observations and edge_alerts
while reads kept working: 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 (46), GET /admin-api/alerts still showed its one row,
/healthz and /readyz were 200, /admin-api/state had no write-side field at all,
and the log carried "flush failed, 4 entries dropped" plus two "could not
persist".

DurabilityHealth counts each writer separately; /state reports
observationWriteFailures/observationsLost/observationLastWriteError,
alertWriteFailures/alertsLost and retentionPruneFailures; /readyz answers 503
naming the pillar, the rows lost and the innermost error rather than EF's
wrapper. A counter clears only on a successful write of its own pillar, and
retention is reported without being a readiness failure - stated in code, with
the reason.

Teeth: WriteFailureVisibilityTests (5) - 5 failed / 0 passed before the fix.
Gates: compose-smoke 53 -> 63 (blocks writes with triggers, asserts the
unchanged X-Total-Count as the lie, and heals per pillar), smoke.sh 25 -> 28,
console-check 53 -> 57.
2026-10-02 08:26:45 +02:00
Pavlo Ratushnyi 39d08eca51 A pillar that stopped reading its table kept answering, and nothing on the surface said so
Measured on the shipped image (openwaf:ci, the head tree), one stand with a real
upstream:

  PUT /admin-api/policy {"streakThreshold":2,"trustProxyHeaders":true} -> 200
  404 404 from 203.0.113.79, third request -> 403   (the threshold is in force)
  04:44:43  DROP TABLE policy_settings, from outside the process
  04:45:2x  GET /admin-api/policy -> still "streakThreshold": 2, answered plainly
            GET /admin-api/state  -> "snapshotAgeSeconds":0 — the refresh "succeeded",
                                     because the tables it also reads were still there
            /healthz 200, /readyz 200, and exactly 1 line in the log
  docker restart -> GET /admin-api/policy -> "streakThreshold": 10,
                                          "trustProxyHeaders": false
  four 404s from 203.0.113.81, fifth -> 404: nothing banned

Both pillars — the policy provider and the guard's snapshot store — catch
everything their read throws, keep the last value they had, and log one line.
Keeping the last good value is the right failure posture: a database restart must
not open the gate. Keeping it unmentioned is not: for a minute the operator's page
showed a threshold that no longer existed anywhere in storage, readiness said
ready, and after a restart the defence silently came back at the default N=10.

Now: EdgePolicyProvider and EdgeStateStore count consecutive failed reads and keep
the last error; /admin-api/state answers snapshotStale (age against the TTL the
process refuses to start without), snapshotRefreshFailures,
snapshotLastRefreshError, policyReloadFailures and policyLastReadAt;
/admin-api/policy carries X-Policy-Reload-Failures and X-Policy-Last-Read
alongside the policy it is enforcing, the same way a capped listing carries its
completeness in headers; /readyz answers 503 while either counter is non-zero,
naming the pillar and the age of the snapshot it is running on; and the console's
summary line goes warn and says "older than the ttl", "snapshot refresh failing
xN", "policy not re-read from storage xN".

Teeth first: PillarFailureVisibilityTests (4) run against the unfixed tree — 4
failed, 0 passed, all four on a missing field (KeyNotFoundException), which is the
point: the numbers did not exist. The refresh test drops country_rules rather than
block_entries on purpose — only one of them is what /readyz probes, so before the
fix that test saw the refresh failing and readiness still answering 200.

Gates: compose-smoke now drops policy_settings from the running stand through a
--volumes-from sidecar, waits for the failure to be counted, asserts the counters,
the 503 and the header, puts the table back and asserts the recovery (+6
assertions; the counters are consecutive, not cumulative, so recovery is part of
the claim). smoke.sh asserts the healthy case with numbers rather than silence
(+3). console-check drives the page against that state answer and requires the
summary line to be marked and to name both pillars (+3); the state body is served
through a route because the guard refreshes the snapshot on every request — a live
stand cannot be left to age — while the contract being rendered is the one
compose-smoke measures end to end against the shipped image.

Numbers on this tree. Host: build 0 warnings, unit 128/128, integration 117/117,
smoke 25 passed / 0 failed, compose 53 passed / 0 failed, console 53 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,
117/117, 25/0; compose in docker:cli: 53/0, enforcement lag 12 ms; console in
mcr.microsoft.com/playwright:v1.63.0-noble: 53/0.
2026-10-02 07:07:25 +02:00
Pavlo Ratushnyi c97c7a1866 An exemption the edge had stopped honouring was still listed as an exemption, and the listing had no ceiling at all
Measured on the shipped image (openwaf:c28, the head tree), one allow entry
written for one minute against an operator block on the same address:

  03:58:16  POST /admin-api/allow {"match":"192.168.65.1","expiresInMinutes":1} -> 204
  03:58:20  GET /whatever -> 502   (passed to the upstream: the exemption is in force)
  03:59:38  GET /whatever -> 301   (the minute has passed; the block is back)
  03:59:39  GET /admin-api/allow -> 200, the row still listed, no liveness field
            GET /admin-api/state -> "allowEntries":1

The engine was right and the surface was wrong: the operator's table said
"exempted" a minute after the edge stopped honouring it, and the pill's number
was a count of rows rather than a count of exemptions in force. Nothing prunes
those rows either — retention ages out observations, engine bans and alerts, and
an operator's own writes are not the machine's to delete — so the dead ones
accumulate exactly where they cannot be told apart from the live ones.

The same endpoint was also the last listing with no ceiling: 1,101 rows came back
in 130,386 bytes with no X-Total-Count and no X-Truncated, and every paging
parameter was ignored — ?limit=10, ?offset=1000, ?limit=0 and ?limit=100000 each
answered all 1,101.

Now: GET /admin-api/allow takes live (default true, live=false means "do not
filter", the same shape as /blocks), limit 1..2000 and offset, refuses a limit
nobody meant by name, and carries X-Total-Count and X-Truncated computed from the
same predicate as the rows. Each row carries live, computed from the same rule
the engine applies (AllowEntry.IsLive), and /state answers allowEntries as the
live count with allowEntriesExpired beside it. The page fetches live=false, marks
a dead row "EXPIRED, the edge no longer honours it", counts them under the table,
and its pill says "0 live - 1 expired".

Teeth, in this order: AllowListingHonestyTests (4) written first and run against
the unfixed tree — 4 failed, 0 passed, including "allowEntries expected 1, got 2"
and "X-Total-Count expected 5, got null". The wire assertions in the second test
passed before the fix and after it: the engine already knew. The console gate
seeds an allow entry with a one-minute TTL ahead of the waits it already pays, so
the expired state arrives for free, and asserts the dead row is listed and marked,
the live one is not, and the line under the table counts them; the two existing
row deletes are now aimed at a match instead of clicking the first remove button,
which with a second row in the table would have deleted whatever sorted first.

Numbers on this tree: host — build 0 warnings, unit 128/128, integration 113/113,
smoke 22 passed / 0 failed, compose 47 passed / 0 failed, console 50 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): unit 128/128,
integration 113/113, smoke 22/0; compose in docker:cli: 47/0, enforcement lag
11 ms; console in mcr.microsoft.com/playwright:v1.63.0-noble: 50/0.
2026-10-02 06:16:59 +02:00
Pavlo Ratushnyi 6e6461a760 A 404 explained one missing row and said nothing about another, and the page answered the silent one with "the admin API is off"
Measured on the shipped image (openwaf:ci 08bebf43, the tree with the
storage-failure fix):

  DELETE /admin-api/countries/ZZ   -> 404 {"error":"no country rule for \"ZZ\""}
  DELETE /admin-api/allow/999999   -> 404, Content-Length: 0

Same status, two qualities of answer. The silent half is what the console then
had to invent an explanation for: apiRaw read EVERY 404 as
"admin api disabled — set OpenWaf__Admin__Token" and threw, so removing a row
that another tab had already removed told the operator to go configure a token
that is already configured. And because the throw landed in a catch that says
nothing, the status line ended up reading "refreshed" in the success colour —
measured in the console gate before the fix:

  FAIL a missing row is reported as a missing row… — ok: refreshed 4:50:18 AM

After the fix, on the image built from this tree (4823e9ae):

  DELETE /admin-api/allow/999999   -> 404 {"error":"no allow entry with id 999999"}

The page now shows that sentence instead of guessing:

  ok  a missing row is reported as a missing row, not as the admin API being switched off
      — warn: no allow entry with id 999999

Whether the admin surface is switched off at all is no longer inferred from a
status code: the core read (/admin-api/state) is checked for a non-200 and the
edge's own body is shown — "admin api disabled: set OpenWaf__Admin__Token",
which the API already says and which a new test pins.

While in this handler, the most destructive button on the page was found doing
worse than lying: "clear the automatic bans" fired the DELETE and read nothing
back, so cleared 7, cleared 0 and a refused write looked identical after the
reload. It now reports the count the edge gave ("engine bans cleared: 0"), and
the note for the action just taken survives the refresh that action itself
triggered — load() used to overwrite it with "refreshed" inside a second, which
is shorter than the time it takes to read.

Gates on this tree (macOS): build 0 warnings / 0 errors, unit 128/128,
integration 109/109 (3 new in NotFoundExplanationTests), smoke 19/0,
compose 43/0, image 261 MB, console 47/47 (2 new assertions).
Dents: allow 404 silent again -> 2 tests fail; apiRaw reading every 404 as
"disabled" -> 2 console assertions fail; clearEngine reading nothing back -> 1;
the action note not held across its own refresh -> 1.
2026-10-02 05:21:44 +02:00
Pavlo Ratushnyi a77ab53ea8 A storage failure was reported to the operator as success, as their own bad request, and as ready
Measured on two shipped images of the same stand — openwaf:prefix built from
72d37ad and openwaf:ci built from this tree — with the block table and the
policy table dropped out from under a running edge that held 3 blocks and 1
policy row:

  DELETE /admin-api/blocks?source=operator   200 {"deleted":0}      -> 503 "NOTHING was deleted"
  DELETE /admin-api/blocks?key=203.0.113.201 200 {"deleted":0}      -> 503 "NOTHING was deleted"
  POST   /admin-api/blocks                   400 database error     -> 503 "the block is NOT in effect"
  PUT    /admin-api/policy {"mode":"Enforce"} 200, body mode=Observe -> 503 "the change is NOT in effect"
  GET    /admin-api/blocks                   500                    -> 500 (unchanged)
  GET    /readyz                             200 ready              -> 503
  GET    /healthz                            200                    -> 200 (unchanged: the recovery hatch)

Four separate lies, one class:

* BlockStore.DeleteAsync caught everything, logged a warning and returned 0, so
  the endpoint answered {"deleted":0} — the same bytes an empty list produces.
  A destructive command that could not run told the operator there was nothing
  to remove.
* BlockStore.AddOperatorAsync returned the string "database error" and the
  endpoint mapped it to 400, next to the real validation errors. A storage
  failure arrived as "your request is wrong", which invites a retry of the
  request while no block is in effect.
* PUT /admin-api/policy threw away SaveAsync's false and answered 200 with the
  policy body — showing the mode that had NOT been saved.
* /readyz used CanConnectAsync, which only proves the file opens. It kept
  answering 200 through all of the above.

The same stand, six concurrent POSTs for one address (no broken storage):
4x 204 and 2x 400 {"error":"database error"} before; 6x 204 after. 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 now retries against the winner's row.

The console had its own copy of the bug: every destructive row button wrote its
green note whatever came back, so 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. The note now waits for an answer
that did not carry an error, and the refresh that follows a failed action holds
it. An empty 5xx body is now reported as an empty 5xx body instead of throwing
inside apiRaw and being swallowed.

Gates on this tree (macOS): build 0 warnings / 0 errors, unit 128/128,
integration 106/106 (7 new in StorageFailureHonestyTests), smoke 19/0,
compose 43/0, image 261 MB, console 45/45 (1 new assertion).
Dents: delete answers deleted:0 -> 2 fail; POST answers 400 -> 1; readyz trusts
CanConnectAsync -> 1; no retry after the unique-index loser -> 1; delete
swallows into a bare 0 -> 2; PUT /policy discards the save answer -> 1; console
writes the note whatever came back -> the console gate fails that assertion.
2026-10-02 04:22:07 +02:00
Pavlo Ratushnyi fc90f50de8 A country rule made of any two characters was stored, shown to the operator, and obeyed by nobody
PUT /admin-api/countries/{code} checked one thing about the code: that it was
two characters long. Measured on the shipped image (openwaf:ci):

  PUT /admin-api/countries/12?allowed=false -> 204
  PUT /admin-api/countries/U.?allowed=false -> 204
  GET /admin-api/countries -> "12: denied", "U.: denied", "US: allowed"
  probe from a source the geo database puts in a real country -> 404

A country rule is matched against the two-letter code the geo database returns,
so "12" and "U." can never match anything: the operator's table said two
countries were denied and the edge enforced nothing. With US denied for real the
same probe answers 451, which is the difference the table was hiding. And there
was no DELETE, so the row was permanent — the console gate's own comment used to
read "a country rule cannot be deleted, only overwritten", and the residue out
lived `compose down` because it lives in the data volume.

Now the code must be two ASCII letters or the write is refused by name:
"code must be a two-letter ISO country code; got \"12\"". DELETE
/admin-api/countries/{code} removes a rule and invalidates the snapshot, and
says `no country rule for "ZZ"` when there is nothing to remove. The page offers
"remove rule" on a row that has a rule, and the gate's cleanup deletes the US
rule it sets instead of leaving it behind.

The country part of the console gate was also fixed, and it was a gate bug worth
naming: it assumed a US rule already existed. With residue in the volume the
first click denied the country; on a fresh volume it allowed it, so the
assertion only ever passed on leftover state. It now starts from no rule and
asserts — → allowed → denied → removed.

Teeth, each reverted and counted, then restored: length-only code check -> 5
integration failures; DELETE endpoint removed -> 2; both out -> 9.

Gates on this tree: unit 128/128, integration 99/99, smoke passed 19 failed 0,
compose 43 passed 0 failed, console 44 assertions 0 failed, image 261 MB.
2026-10-02 03:11:57 +02:00
Pavlo Ratushnyi 0e2aee6beb A capped listing answered like it was the whole answer, and one said it was capped when it was not
?source= is refused by name now; a limit nobody meant still silently became a
different limit. Measured on the shipped image (openwaf:ci), 1103 sources
recorded:

  GET /admin-api/observations?limit=100000 -> 200, 1000 rows, no total, no
      truncation flag. 103 recorded sources were unreachable and the response
      read like a complete answer.
  GET /admin-api/observations?limit=0 and ?limit=-1 -> 200, one row each.
  GET /admin-api/streaks?limit=1000 -> 200, 2 streaks, trackedSources 3,
      X-Truncated: true. Nothing had been cut: the header compared the page
      against the size of the streak map, and the map keeps a source whose
      streak a clean answer ended while the listing leaves those out on purpose.

The block listing already carried X-Total-Count and X-Truncated, with a comment
saying that is what stops a page reading like a complete answer. The two
listings the console reads most had neither. Now every capped listing carries
both, takes an offset that reaches the rest, and refuses a limit outside its
range by name: "limit must be 1..1000; got 0". /streaks measures truncation
against standing streaks, reports standingStreaks next to trackedSources, and
pages.

The page says what it is showing. The console gate run printed "newest 25 of 42
recorded sources" and "Newest 25 of 274 alerts" — before this change both tables
rendered as if the page were the window, and the volume that survives compose
down is exactly where that matters.

Teeth, each reverted and counted, then restored: headers removed -> 2
integration failures; limit/offset clamped instead of refused -> 13; streak
header counted against the map again -> 1; standingTotal counted as the map size
-> 1 unit + 1 integration.

Gates on this tree: unit 128/128, integration 89/89, smoke passed 19 failed 0,
compose 43 passed 0 failed, console 42 assertions 0 failed.
2026-10-02 02:19:27 +02:00
Pavlo Ratushnyi 8fba8447e9 A misspelled provenance filter deleted the operator's own block list
ParseSource mapped any unrecognised string to BlockSource.Operator. Measured on
the shipped image (openwaf:ci), with two operator blocks and three engine bans
live:

  GET    /admin-api/blocks?source=enigne -> 200, the operator list, engine bans hidden
  DELETE /admin-api/blocks?source=enigne -> 200 {"deleted":1}, then operator=0 engine=3

The caller who mistyped "engine" while clearing automatic bans erased the
operator's hand-maintained list instead — the exact failure the comment above
that endpoint says the provenance parameter exists to prevent. A missing source
was already refused with 400; a misspelled one was not.

After the fix, same image, same script:

  GET    ?source=enigne   -> 400 source must be operator|engine|all; got "enigne"
  DELETE ?source=enigne   -> 400, counts unchanged (operator=2 engine=3)
  DELETE ?source=engine   -> 200 {"deleted":3}, then operator=2 engine=0

Two more of the same family, both measured on the image:

  expiresInMinutes: 0 and -5 -> 204 with expiresAt: null. Not "no expiry given",
    but a permanent allow entry — the one control that outranks every ban — from
    a field left at zero. Absent is now the only way to say never; present must
    be 1..5256000 or it is a 400. The console page refuses 0 in the field before
    the round trip, and the gate asserts both halves: 0 is refused, empty still
    means never.
  a 1 MB reason and a 1 MB note -> 204, and the listings then returned
    ~1,000,287 and ~1,000,722 bytes for a handful of rows. Operator notes are
    bounded at 512 characters, the budget the attacker-written path field
    already gets, so the two columns in the same table are the same size.

  unit 126/126 (unchanged), integration 62 -> 73 (+11), console 37 -> 39

Teeth, each measured by putting the old line back: old ParseSource -> exactly 5
integration tests fail; expiry guard off -> exactly 3; length guards off ->
exactly 1.
2026-10-02 01:21:20 +02:00
Pavlo Ratushnyi 00f6dd9513 A block's redirect target went into a header unchecked, and one of them turned the block into a 500
Measured on the shipped image (openwaf:ci). POST /admin-api/blocks answered 204
for every one of these, and the next request from that source paid for it:

  "https://example.com/ok"               301 Location: https://example.com/ok
  "http://bad target"                    301 Location: http://bad target
  "http://x.invalid/<CRLF>X-Injected: 1" 500 Internal Server Error, Content-Length: 0
  "javascript:alert(1)"                  301 Location: javascript:alert(1)
  "not-a-url"                            301 Location: not-a-url

The CRLF row is the defect rather than the wart: Kestrel refuses to write the
header, so the operator's own block — written with a 204 — became a server error
for that visitor. Nothing was injected; the server validated the header, which
is the only part of the old behaviour that was safe. javascript: and data: are
absolute URIs too, and a redirect is a navigation, so those are an execution
request made on the operator's behalf by a string somebody typed into a form.

RedirectTarget.IsSendable is now the one judge: absolute, http(s), no control
characters or surrounding whitespace. The API answers 400 naming the field, and
DecisionEngine ignores a target it cannot send and answers the block's own
default instead — for a row that arrived by a restored backup or a hand edit,
where the API guard never ran.

The console gate also asserts the other half of the same boundary: every value
that came from the API is rendered through esc(), and two of those values are
not authored by the person reading the page — the path in an observation row is
whatever an anonymous visitor asked for, and a block reason is a form field. The
seed now sends a percent-encoded path carrying <img onerror=...> and an operator
block whose reason carries <svg onload=...>, and the page must show both as text
and create no elements from them.

  unit 105 -> 126 (+21: the target table, and the decision point's fallback)
  integration 55 -> 62 (+7: 400 by name for five targets, a valid target
    reaching the wire as 301, and a hand-written row with CRLF answering 301 to
    the default target instead of the 500 it used to answer)
  console 33 -> 37 assertions

Teeth, each measured by removing the thing: esc() reduced to identity in the
shipped page makes the console gate go red with 6 failures, and the page title
becomes "XSS" — the anonymous visitor's path executed script in the operator's
browser. Dropping the API guard fails exactly 5 integration tests; dropping the
decision-point guard fails exactly 6 unit tests and the 1 hand-written-row test.
2026-10-02 00:34:35 +02:00
Pavlo Ratushnyi 208b04290b Two endpoints the console read and no gate had ever called
An audit of the admin surface by gate coverage turned up two endpoints with zero
appearances in any gate: `/admin-api/state` and `/admin-api/geo`. The first is
the one the console's entire summary line is built from — the page could have
been reporting a mode the edge is not in, or a ban count that is not the count,
and every assertion in every script would have stayed green.

`/admin-api/state` also lacked one field the summary needs. It reported the age
of the in-memory snapshot and not the TTL that age is measured against, so
"snapshot 0.4s" was half a number. On a single edge the TTL is invisible; behind
a load balancer it *is* the delay a ban has, which is the whole subject of the
multi-instance question. `/healthz` already reported it — the endpoint the page
actually reads did not.

The summary line now says, in one place an operator looks at:

    mode Enforce · snapshot 0.1s / ttl 30s · tracked 3 · engine bans 0
    operator blocks 0 · allow entries 0 · geo DBIP-Country-Lite · built 2026-10-01 · 0.6d

The geo pill is marked past 90 days, the same rule `/healthz` reports as
`geoStale`, and the assertion checks it is *not* marked while the database is
inside the alarm — an always-green warning is a warning nobody reads.

Gates: `compose-smoke.sh` asserts `/state` at the moment a ban exists, so the
numbers have known values rather than "some number" — mode `Enforce`, TTL `30`,
`engineBans` 1 — 35 → **38 assertions**. `console-check.cjs` asserts the TTL in
the summary, the geo database with its build date and age, and the marking: 30 →
**33** assertions. `SnapshotStalenessTests` got the
fast half for the new field.

That test caught the test, not the product: the first version read `/state` with
a bare client and got a 401, because the admin surface is token-gated while
`/healthz` deliberately is not. The endpoint was right and the test was wrong.

Numbers on this tree. Host: build 0 warnings, unit 54/54, integration **30/30**,
compose-smoke **38/38**. Linux rehearsal, one invocation, EXIT=0: source gates
54/54 + 30/30 + smoke 19/19, compose **38/38**, console **33/33** in a real
Chromium. actionlint 1.7.12 over both workflow files: 0 problems; shellcheck,
`bash -n`, `node --check` clean.

Still the same boundary as every other commit here: none of it has executed on a
runner, because the repository has no remote (OPEN-15).
2026-10-01 17:01:54 +02:00
Pavlo Ratushnyi 8082e6a598 The alerting pillar had an endpoint and nobody reading it
`GET /admin-api/alerts` appeared in **zero** gate scripts. Both alert kinds were
proven in-process, against `FakeUpstream`, at the database level — and the half
that matters for an alert, the half where a human sees it, had nothing on the
other end. The console read six endpoints and this was not one of them.

The page now renders them: kind, source, count, last status and path, when. The
kind an operator has to act on is marked rather than only printed, and the note
above the table says what each kind means in words, because `server_error_streak`
and `candidate_ban` are different sentences: your upstream is failing (and the
edge will not ban the visitor who saw it) versus the rule would have banned and
the mode is Observe.

`scripts/console-smoke.sh` seeds four 502s from an address chosen for this run
(`/boom`, added last commit), and `scripts/console-check.cjs` asserts the row by
**source and count**, the note text, the marking, and that the table survives the
phone pass: 26 → **30 assertions**.

The wiring was the interesting part. The seeding runs in one container and the
browser in another, so the address chosen at seed time cannot be inherited — an
empty `SEED_ERROR` on the driver side would have quietly turned "the alert this
run wrote" into "some alert exists somewhere". The seed now writes its values to
`console-seed.env` (gitignored) and the rehearsal passes them to the browser
container.

`AdminConsoleTests` got the fast half: the markup contains the alerts table and
fetches the endpoint. A static check cannot assert the row is there — that is
what the browser gate is for — but it can notice the table disappearing without
waiting for Chromium. 28 → **29 integration tests**.

Numbers. Host: build 0 warnings, unit 54/54, integration 29/29. Linux rehearsal,
one invocation on this tree, EXIT=0: source gates 54/54 + 29/29 + smoke 19/19,
compose **35/35**, console **30/30** in a real Chromium. actionlint 1.7.12 over
both workflow files: 0 problems; shellcheck, `bash -n` and `node --check` clean.

Two things said plainly. The console number above is the Linux one: this laptop's
browser cache has chromium-1223/1228/1234 and the pinned Playwright wants 1243,
so the darwin console gate was not re-run for this change. And during the run the
table's own note read "Newest 25" — the endpoint is capped and residue from
earlier runs fills the page. That is OPEN-18's amplification showing up where an
operator would see it, and the note states the cap instead of pretending the
table is everything.
2026-10-01 16:40:37 +02:00
Pavlo Ratushnyi bf1129a8d8 The failure mode on a write form is the one nobody demos
The console now writes, so the question stopped being "does the table show the
ban" and became "what happens when the operator types the wrong thing". A form
that accepts `not-an-ip`, says nothing, and adds no row leaves an operator
believing an address is blocked when it is not — which is worse than giving them
no console at all.

Two assertions added to the browser gate. The API already rejected the value
(`BlockStore.AddOperatorAsync` returns `not an IP address: not-an-ip`, the
endpoint answers 400, the page already surfaces `body.error` in its status line);
what is new is that a gate now proves that chain instead of assuming it. The run
prints the actual string: `not an IP address: not-an-ip`, and no phantom row in
the bans table. Console gate: **26/26**.

Also measured, because a timeout written at a desk is a guess: the Linux
rehearsal (`scripts/ci-linux-rehearsal.sh`, added in `42d4af9`) was re-run with
`time`. Cold container, cold NuGet cache, Ubuntu 24.04.5, SDK 10.0.401:
**1:02.81** wall for restore + build + unit + integration + smoke. The source
job's `timeout-minutes: 25` is not close, even allowing for a runner's slower
CPU. Before this, the number in the workflow was folklore from a build that once
stalled ~12 minutes on a single apt-get step.

No source-tree change in this commit: gate assertions and the numbers written
down where the next reader will look for them. Unchanged and still said plainly:
no job of this workflow has executed on a runner — the repository has no remote.
2026-10-01 15:16:19 +02:00
Pavlo Ratushnyi 31d8633975 A console that can only read is a dashboard, not a console
The page could clear engine bans and switch the mode. During an incident the two
things an operator actually reaches for are: put one address behind a block with
a reason, and pull one customer range back out from under the bans. Both
endpoints already existed (`POST /admin-api/blocks`, `POST /admin-api/allow`,
`DELETE /admin-api/blocks?key=`, `DELETE /admin-api/allow/{id}`,
`PUT /admin-api/countries/{code}?allowed=`); the page just did not expose them.
Now it does: a block form, an allow form with an optional expiry, a delete on
every ban row, a remove on every allow row, and a rule toggle on every country
row. Row buttons carry their key in a data attribute and one delegated handler
reads it, so nothing is spliced into an inline onclick string. Still no decision
logic on the page — every control is exactly one call.

The gate now checks the write on the wire, not just in the table, and that is
where the two findings were:

- An operator block answers **301 with the policy's redirect Location**
  (`OperatorBlockStatus=301`, `DefaultRedirectTargets=[iana example]`), not 403.
  A `fetch` that follows redirects walks out to the public internet and comes
  back **200** — which is how the new assertion first reported "the ban drawn on
  the page is not enforced" while the edge had been refusing that client with a
  301 from the start. The probe uses `redirect: 'manual'` now. The same trap
  would catch anyone writing a smoke check against this edge, so it is a comment
  in the gate and a sentence in the README.
- The baseline probe in my own gate ran *after* the block was written, so it
  asserted "reaches the upstream" about an address that was already blocked.
  Caught because the numbers disagreed with each other, not because I re-read
  the code.

Sequence the gate now proves end to end: address answers 404 → page writes a ban
→ same address answers 301 with a Location → per-row delete removes that one row
→ address answers 404 again; an allow entry appears with an expiry and can be
removed; a country rule is set to denied and put back. There is no DELETE for a
country rule, so "put back" is `PUT ?allowed=true` and the row stays behind
meaning "not denied" — documented rather than papered over. `console-smoke.sh`
now also clears allow entries on teardown, so a run that dies halfway cannot
leave an allowlist behind in the data volume and quietly change the next run.

The fast suite notices the controls too: one integration test asserts the write
controls are in the served page, so their removal fails in seconds rather than
waiting for the browser gate.

Gates on this commit: build 0 warnings / 0 errors, unit 54/54, integration
**28/28**, smoke 19/19, image 261 MB, compose-smoke 27/27, console **24/24**
(wire sequence above, phone pass at 375 px dark: scrollWidth 375, contrast
11.85:1, bars 67 px), actionlint 0, shellcheck 0. Unchanged and said plainly:
no job has ever run on a runner — the repository has no remote.
2026-10-01 14:56:16 +02:00
Pavlo Ratushnyi 66df999cdf The country table got a shape, and the page caught me colliding with itself
The console's country view was a column of numbers. "Where is this traffic
coming from" is a comparison, so each row now carries a bar sized against the
busiest country, and the table says what it counted. No tiles, no CDN, no asset
file: the runtime image is distroless and the page has to work at the moment the
site in front of it is being attacked. A geographic map is still not here and
the README now says why plainly — the admin API exposes counts per ISO code, not
coordinates, and an outline drawn from memory would be decoration that misleads.

The first run after the change failed, for a real reason: the class I added was
`.bar`, and the page already had a `.bar` — the toolbar. The toolbar collapsed
to 0.55em tall, `div#summary` started intercepting pointer events, and every
assertion after the token click died on a click timeout. Renamed to
`.sharebar`.

The gate itself got the same treatment as the page. It used to leave a reviewer
with nothing but a stack trace; now it writes a screenshot both when the page
cannot be driven at all and when it is driven and wrong. That path was checked
by making it red on purpose: with seeds that do not match the stack it exits 1
naming 3 failed assertions and writes a 105078-byte picture.

Measured, not assumed, in the same pass:

- `ci-gates.sh` gained a `console` gate and the workflow calls it by that name
  instead of retyping the script: one definition, two callers. It is
  deliberately NOT in `all` — without a Chromium the gate exits 2 ("cannot
  run"), which is a different answer from 1 ("the page is wrong"), and folding
  it in would make the one-command entry point unrunnable off a CI runner.
- `ci-gates.sh all` no longer stops at the last gate for want of an admin
  token: it was dying at compose-smoke with `OPENWAF_ADMIN_TOKEN: set …` before
  it could print a verdict. The throwaway for the stack the gate starts and
  tears down itself is defaulted there; the standalone scripts still refuse to
  invent one, because run by hand they can be pointed at a real deployment.
- The console job publishes the desktop and phone screenshots as artifacts,
  with `if: always()` so the failure case is the one you can look at. The
  relative SCREENSHOT path and the `console-evidence*.png` glob were verified
  locally: 107935 and 86179 bytes written.
- DBIP_VERSION 2026-09 -> 2026-10. Not a cache hit: 8348509 bytes fetched,
  image 261 MB, compose smoke 27/27 afterwards.
- The trap that bump exposes, measured rather than reasoned about: the same
  rebuilt image reported `geoBuiltAt: 2026-09-01T01:32:45Z` against the
  existing `openwaf_openwaf-geoip` volume and `2026-10-01T01:36:12Z` after
  removing it. Docker seeds a named volume from the image only when the volume
  is first created, so a rebuild alone never replaces the geo database.

Gates on this commit: build 0 warnings / 0 errors, unit 54/54, integration
27/27, smoke 19/19, image 261 MB, compose-smoke 27/27, console 16/16 (desktop
bar 513 px inside a 529 px cell; phone pass at 375 px in dark mode: scrollWidth
375, status contrast 11.85:1, bars 67 px), actionlint 0, shellcheck 0. Still
true, and unchanged by any of the above: not one of these jobs has run on a
runner, because the repository has no remote.
2026-10-01 14:26:33 +02:00
Pavlo Ratushnyi 1014712c99 The console was unreadable on a phone in dark mode — measured, then fixed
The console gate had never looked at anything but a 1280 px desktop in light
mode, and I had recorded that as a gap twice. Probing it properly found two
real defects, both with numbers before and after.

Contrast. The page declares color-scheme: light dark, so Chromium paints a dark
canvas — but .ok and .warn were fixed colours chosen for white paper. The
status line, which is the only feedback the page gives ("token rejected" vs
"refreshed"), measured 2.82:1 against rgb(18,18,18). Below WCAG AA. The two
colours now have dark-scheme values; the same measurement reads 11.85:1.

Width. At a 375 px viewport the seven-column tables measured 501 px and pushed
the whole document to 520 px of sideways scroll — the token field and the
summary pills slid off screen, on the one device an operator reaches for when
they have blocked themselves. Each table now scrolls inside its own box; the
document measures 375 against a 375 viewport.

The gate covers both, so the gap cannot silently reopen: console-check.cjs runs
a second pass at 375x720 in dark mode and asserts the document does not
overflow, the status line clears 4.5:1 against the Canvas the browser actually
paints (computed, not eyeballed), the standing streak is still listed, the
token is still absent from the markup, and no javascript threw. Twelve
assertions pass on this commit.

Also fixed while here: SCREENSHOT without an extension made Chromium throw
"unsupported mime type", which reads like a page failure and is not one.

Gates on this commit: scripts/ci-gates.sh all — build 0 errors, unit 54/54,
integration 27/27, smoke 19/19, image built, compose-smoke 27/27; console gate
12/12 against the running image.
2026-10-01 13:55:45 +02:00
Pavlo Ratushnyi b9a6c7e532 One definition of a gate, and a gate for the page itself
OPEN-10's honest caveat has always been the same sentence: the workflow has
never executed on a runner, so it proves what CI will run rather than being
green. That gap cannot be closed from this machine — the repository has no
remote — but the gap behind it can. Until now ci.yml retyped every command, so
"an agent ran these commands on a laptop" and "CI runs these commands" were two
claims that could drift apart without anyone noticing.

scripts/ci-gates.sh is now the single definition: restore, build, unit,
integration, smoke, image, compose-smoke, or all. The workflow calls one gate
per step, so the job log still names the gate that failed, and an operator
running scripts/ci-gates.sh all before pushing is running the same file.

The console had no gate at all. Its evidence was an agent driving Chromium from
a script in /tmp. scripts/console-smoke.sh starts the stack, seeds a source
sitting at 2 of a threshold of 3 and an operator block with a reason, drives
/admin in a real Chromium and asserts seven things: the page authenticated, the
standing streak is shown as current/threshold rather than as a historical
maximum, the block shows its reason, observations and the country summary
rendered, the token is nowhere in the markup, and the page threw no javascript.
It needs playwright-core and exits non-zero when that is missing — a gate that
reports success having asserted nothing is worse than no gate. The negative
control was run: with a wrong token it exits 1.

Verified on this commit: scripts/ci-gates.sh all end to end — build 0 errors,
unit 54/54, integration 27/27, smoke 19/19, image built, compose-smoke 27/27;
console-smoke 7/7 assertions against the running stack (playwright-core 1.61.1);
actionlint 0; shellcheck over scripts/*.sh 0. The new console job pins
playwright@1.63.0, a version checked against the registry rather than guessed,
and it has never run on a runner — the README says so in the same breath as the
rest of the workflow.

README gains a Gates section and the per-process cost bullet now quotes the
measurement instead of the worry.
2026-10-01 13:43:17 +02:00