153 Commits
Author SHA1 Message Date
Pavlo Ratushnyi 14d3eda07e the request-rule pillar names its board key where a reader looks for it 2026-10-04 19:57:53 +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 9d47a37ff3 compose re-run on the tree that carries the shared streak store: 209 assertions, 0 failed 2026-10-04 17:40:41 +02:00
Pavlo Ratushnyi 8ee6570458 the streak map can live in the database, so N edges mature one streak
The multi-instance research measured the gap rather than guessing it: four
refusals from one address, two per edge, at a threshold of 3, produced no ban
anywhere, because the block list was shared through the database and the streak
map was not (research/2026-10-01-multi-instance/, D1). OpenWaf:Policy:
SharedStreaks=true moves the counters onto a row in source_streaks; the default
stays the in-process map, because that is the deployment that loses nothing.

The rules were extracted into StreakRules.Apply and both stores call it — the
in-process map against a StreakState, the shared one against a row. A second
copy of the streak semantics would put the drift back where this removes it.
Version is a concurrency token, so two edges writing one source produce a retry
against the winner's row rather than a silently dropped refusal; a clean answer
on any edge ends the run on every edge, in one statement. The rows age out on
the same ObservationRetentionDays window as observations. Both surfaces say
which store answered: /admin-api/streaks scope is this-process or
shared-database, /admin-api/state answers streakScope, and the console's streak
note stops claiming "this edge process only" when it is not true.

Found by running it for real rather than in-process: two edge processes on one
SQLite file both create the schema on startup, and the loser of that race died
in StartAsync with 'table "allow_entries" already exists' — hosting failed to
start and the process never listened. The schema step now re-checks existence
and continues, because what has to be true is that the schema exists, not that
this process made it.

Measured on this tree: build 0 warnings / 0 errors, unit 132/132, integration
191/191 in 32 s (6 new, two real edge instances on one SQLite file each), smoke
28/0, console 78 assertions 0 failed. Out of process, two edge binaries on one
file at a 5 s TTL: A answered 404, 404; B answered 404 on the third refusal and
403 after it; both edges then reported consecutiveRefusals: 3 with
scope: shared-database, and A started enforcing 4 s later. Before the schema fix
the second process aborted on startup, which is how that fix was found.
2026-10-04 17:13:21 +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 317044a336 209 compose and 75 console assertions now, and each number says where it was measured
The gate grew by 27 assertions (22 compose, 5 console) and the file still said
185 and 70, including the two lines in Shape that name each gate's size.

The two container stages are deliberately not swept to this head: the Linux
rehearsal and the act run still describe dc88f36, because neither has been run
since these two scenes were added. Quoting them for this tree would be a number
the tree does not produce, so the paragraph now says which set was measured
where instead of merging them into one green line. Host, this tree: build 0/0,
unit 132/132, integration 173/173, smoke 28/0, compose 209/0, console 75/0,
image 261 MB, 0 containers left behind, enforcement lag 33 ms.

The integration count now carries its scheduling, because scheduling changed the
answer. Run as xUnit runs it — parallel test collections — the suite answered
157 passed, 16 failed, every failure the same "Timed out waiting for the entry
point to build the IHost after 00:05:00" (/tmp/c26_int3.log); with
xunit.parallelizeTestCollections=false the same tree answered 173/173 in 23 s
(/tmp/c26_int4.log). Earlier in the same cycle two overlapping runs of the suite
produced the older OPEN-47 symptom — a real Assert.False on the snapshot-age
test, which passes on its own. OPEN-47 stays open and unfixed; what is recorded
here is that the number depends on what else was running.

The assertion history gained its link: 185 before an operator command that could
not run was asked of the shipped image.
2026-10-04 12:27:04 +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 bd1b8a4e86 185 compose assertions now, and the numbers describe the tree that has them
The gate grew by 20 assertions across two commits (19 for the country rule on
the image, 1 for the ban pillar's wait budget) and the file still said 165 in
six places, including the line that names the script's own size. Same failure
as the last two sweeps: the numbers drift away from the tree that runs them.

Swept to dc88f36, each stage re-run on this head rather than quoted from the
previous one:
  host   unit 132/132, integration 173/173, smoke 28/0, image 261 MB,
         compose 185/0, console 70/0                       (/tmp/c25_host_all.log,
                                                            /tmp/c25_host_console.log)
  linux  source gates PASS, compose 185/0, console 70/0,
         enforcement lag 20 ms, 0 containers left behind    (/tmp/c25_rehearsal.log)
  act    5 jobs succeeded, 0 failed - lint, source, image
         (261 MB, compose 185/0), console (70, 685,222-byte zip), freshness
                                                            (/tmp/c25_act.log)

The assertion history gained its two links: 165 before the image refused a
country code that is not a code, 184 before the ban scene stopped reading the
pillar at one instant.

Two paragraphs say which layer proves what, because that is the question this
cycle kept asking:
 - the country rule was proven in-process while the shipped image carried four
   country assertions, all about a rule already written correctly. Both halves
   of the teeth were measured on the image: length-only validation answers
   179/6, moving the DELETE route answers 179/6, against 5 and 2 in-process.
 - OPEN-42's read side is closed (the scene polls the pillar, prints the
   trajectory, and asserts its own wait budget; breaking it answers 178/7 with
   that assertion first). The ticket stays open for the product half: the
   pillar is only updated on the request path, so a quiet edge reports a stale
   failure count for as long as it stays quiet.
2026-10-03 01:38:03 +02:00
Pavlo Ratushnyi dc88f36d53 The ban scene now waits for the ban pillar instead of sampling one instant
The scene "a ban that cannot be written is not enforced, and says so" read
/admin-api/state and /readyz once, immediately after the fifth refusal. The
ban pillar is not updated on the request path: the write attempt and the
failure to record it land a few seconds later. So the read raced the thing it
was asserting, and the same run's log already carried the sentence the
assertions denied.

Measured on 75ee822, runs of the same tree:
  /tmp/c25_compose2.log  180 passed, 4 failed  - all four are this scene
  /tmp/c25_compose3.log  179 passed, 5 failed  - four here, plus "readiness
                                                stops saying ready" at 000
  /tmp/c24_mutA_compose.log 161 passed, 4 failed - two of them are this scene
In each case the log line "could not persist a ban for" was present while
banWriteFailures read 0 and /readyz read 200. A gate that picks a moment and
calls it a contract is not a gate: it passes or fails depending on scheduling,
and the flake hides the one regression it exists to catch.

The scene now polls the pillar for up to 20 s and prints the trajectory
("failures/notWritten: 0/0 1/1 ...") plus the reason string it quoted, so
"the counter is 0" and "the field is not in the answer" are no longer the same
word in the log. One assertion was added: the pillar reached its failure state
within the wait budget, which is what fails if the wait itself is what saved
the scene.

Teeth, measured by breaking the scene on purpose (streakThreshold 3 -> 99, so
no ban is ever attempted while the writes are blocked):
  /tmp/c25_mutD_banteeth.log  178 passed, 7 failed
  FAIL the ban pillar reached its failure state within the wait budget  expected 1, got 0
  info ban pillar after 20 s of waiting - failures/notWritten: 0/0 (ten times)
  info readyz at that moment: 200; the reason quoted: (none)

Green on this tree, three runs in a row: 185 passed, 0 failed
(/tmp/c25_fix1.log, /tmp/c25_fix2.log, /tmp/c25_fix3.log).

This is AC1 and AC2 of OPEN-42, done here because OPEN-25's definition of done
requires the compose gate to be green with numbers that hold; OPEN-42 stays
open for its remaining criteria.
2026-10-03 01:05:57 +02:00
Pavlo Ratushnyi 6422021a20 The image now refuses a country code that is not a code
The country rule had been fixed in the source and proven in-process: a
two-character non-code refused with the rule quoted, lower case normalised,
DELETE removing the rule and invalidating the snapshot, and a delete of a rule
that was never written naming the code. On the shipped image the only country
assertion in the gate was still "PUT a real country, get 451" — so every one of
those sentences was a claim about a handler, not a measurement of the process
listening on 8080. The defect this ticket describes (a rule made of any two
characters, shown to the operator as a denial and enforced by nothing, with no
way back) was only ever caught by tests that never ran against the image.

The new scene measures it over a socket: four refused codes and the sentence
each one answers with, none of them leaving a row behind, a refused write not
disturbing the rule that is already there, lower case on the wire becoming the
upper-case rule rather than a second row, that rule being the one the engine
enforces (451), DELETE answering 204 and the next request being decided without
it (404), and a delete of a rule that was never written naming the code.

The scene caught its own bug on the first run: two of its reads of the refusal
message were issued without -X PUT, so they were GETs against a route that does
not exist and printed an empty body — while the status assertion on the same URL
would have passed, because it did carry the verb. A gate that checks a status in
one request and the reason in another is not checking the reason.

Gate numbers, stated as measured rather than as hoped. This scene is 19/19 in
both runs that carried it: /tmp/c25_compose2.log answered 180 passed / 4 failed
and /tmp/c25_compose3.log 179/5, and every failure in both is in the ban-write
scene, not here. So the tree as committed has not been measured with a green
compose gate, and this commit does not claim it has. The cause of those failures
is now identified (OPEN-42): the scene reads the ban pillar immediately after the
last refusal, while the ban write attempt and its failure are recorded a few
seconds later — so the counters read 0 and /readyz reads 200 while the log for the
same run says the ban was not persisted. A run that inserted an 18 s wait before
those checks answered 184/0 (/tmp/c25_diag1.log); that wait was a diagnostic and is
not in this commit. The gate goes green for this ticket only once OPEN-42 is fixed
in the scene itself.
2026-10-03 00:08:36 +02:00
Pavlo Ratushnyi 75ee8221de 165 compose assertions now, and the numbers describe the tree that has them
Every gate was re-run on this tree and the README and the ci.yml header were
rewritten from what those runs printed, not from the last time someone wrote a
number down: host all (unit 132/132, integration 173/173, smoke 28/0, image
261 MB, compose 165/0), host console (70/0), Linux rehearsal (source PASS,
compose 165/0 with 44 ms enforcement lag, console 70/0), and act (5 jobs
succeeded, 0 failed, console-evidence.zip 685,878 bytes).

Two numbers were stale in ways a reader could not see. The console paragraph
said the gate "asserts 58 things" while the gate itself printed 70; and the
paging paragraph described behaviour that had only recently become an
image-level measurement, so it now says which layer proves it and how the
scene proves it.

The failures found on the way are written down rather than dropped. Two act
runs failed before the green one: lint refused three SC2086 findings that a
local `shellcheck -S warning` had passed over — the workflow pins 0.11.0 with
no severity filter and no local gate runs lint at all, filed as OPEN-44 — and
in the run after the fix, image died on a TLS timeout to auth.docker.io while
console read an empty observation listing in a run where the same table had
shown 11 rows a minute earlier, filed as OPEN-43. A host console run at the
previous commit answered 68/2 for the same reason OPEN-41 already describes,
and one compose run read banWriteFailures as 0 while the same scene's log and
readyz said otherwise, filed as OPEN-42.
2026-10-02 23:04:24 +02:00
Pavlo Ratushnyi 0f17d32578 The image now says which part of a listing it is sending
The paging contract had been proven in-process and, on the shipped image,
only for /allow. Everything else this ticket fixed — X-Truncated on
observations, alerts and blocks, offset reaching the rows a ceiling used to
hide, the limit and offset bounds answering 400 instead of one row, and the
streak flag counted from the standing streaks rather than from the map —
existed as a sentence about the source, not as a measurement of the process
listening on 8080.

The new scene measures all of it over a socket. It seeds five sources one
second apart so the listing's own newest-first ordering is reproducible,
then reads them back one row at a time and requires the five pages to be
five different sources and to be exactly the first five rows of the whole
listing. The total has to be the same on every page. Bounds are checked at
both ends on the image, quoting the range and the value. The streak part
deliberately leaves the map holding more sources than it has streaks to
list, because with those two numbers equal, counting the map instead of the
listing answers correctly by accident.

Three of the assertions failed on the first run and are the reason the
scene is worth having: the helper that reconciles X-Truncated with
X-Total-Count and the row count compared against "1"/"0" instead of
"true"/"false", so it said no to every honest response. It is now held to
the same check as the product: a header claiming a cut that never happened,
a header hiding a cut that did, and a missing header each fail
differently.

The unique-key counts split their accumulated string with tr rather than
with an unquoted expansion: the workflow's shellcheck job pins 0.11.0 and
runs with no severity filter, and it refused SC2086 here while a local run
at -S warning said nothing.

compose smoke: 165 assertions, 0 failed.
2026-10-02 22:21:32 +02:00
Pavlo Ratushnyi bb9ac0d927 132 compose assertions now, and the numbers describe the tree that has them
Re-measured at 9383362 rather than carried forward from 5c44b7c:

  host ci-gates.sh all      unit 132/132, integration 173/173, smoke 28/0,
                            image 261 MB, compose 132/0
  host console              70 ok, 0 failed
  Linux rehearsal           source PASS, compose 132/0 at 15 ms,
                            console PASS 70/0 on the second run
  act                       5 jobs succeeded, 0 failed; compose smoke 132/0;
                            console 70; console-evidence.zip 682,072 bytes

The Linux console stage failed once at this head — the markup-path row was not in
the observation table when the driver looked, and the driver looks once. That is
filed as OPEN-41 with both logs named; the stage was re-run and passed, and the
pass is quoted together with the failure, not instead of it.
2026-10-02 20:59:48 +02:00
Pavlo Ratushnyi 9383362468 The provenance nobody means and the bounds an entry has are now refused by the image
OPEN-23's behaviour was implemented and its integration tests were green, and not
one gate had ever sent any of it to the container an operator deploys: grep over
scripts/compose-smoke.sh for enigne, expiresInMinutes and 512 returned nothing.
The item's own steps-to-reproduce are a curl against a container, and no gate ran
one.

New scene, 19 assertions, compose gate 113 -> 132, measured 132 passed / 0 failed
on the host:

  GET  ?source=enigne            400, naming the set and echoing the value
  DELETE ?source=enigne          400, with the two operator rows still there by
                                 name and by count
  GET  ?source= OPERATOR         200 and exactly the two rows it means
  expiresInMinutes 0 and -5      400 naming 1..5256000, and nothing written
  expiresInMinutes left out      expiresAt null - still the only way to say never
  reason / note of 513           400 naming the length, and neither row written
  note of 512                    204, so the bound is not off by one

The scene writes the operator list it then proves it protected, because the scenes
before it clear the tables: an assertion that the refused delete changed nothing
would otherwise have compared 0 with 0 and passed for nothing. It removes what it
wrote and prints the block counts again.

Teeth re-measured at this head rather than carried forward, against the 11 cases of
ProvenanceAndLimitsTests: unknown provenance accepted as all -> 5 failed; the
expiresInMinutes gate disabled -> 3 failed; the note/reason length gate disabled ->
1 failed. Those are exactly the three numbers AC7 states. All three reverted; the
tree carries no mutation.
2026-10-02 20:37:02 +02:00
Pavlo Ratushnyi 7faf37a246 70 console assertions now, and each number says where it was measured
Re-measured at 5c44b7c rather than carried forward from d871d57:

  host ci-gates.sh all      unit 132/132, integration 173/173, smoke 28/0,
                            image 261 MB, compose 113/0
  host console              70 ok, 0 failed
  Linux rehearsal (all)     source PASS, compose 113/0 at 18 ms, console 70/0
  act                       5 jobs succeeded, 0 failed; console 70;
                            console-evidence.zip 692,364 bytes

The console count moved 69 -> 70 by one check: the driver now fails when the
markup seed never reached it instead of stepping around four assertions and
printing "all assertions passed".

The flake sentence is attributed to the commit it happened at, not to whichever
head this file happens to describe: it was one Linux run at d871d57, and the
three Linux compose runs since — including this one — were 113/0.
2026-10-02 19:50:48 +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 5add3be06b 113 compose assertions now, and the measured numbers describe the tree that has them
Every gate was re-run at d871d57 rather than carried forward from 24e329d: the
host gives unit 132/132, integration 173/173, smoke 28/0, image 261 MB, compose
113/0 and console 69/0; the Linux rehearsal gives the same source counts, compose
113/0 and console 69/0; the local Actions runner gives 5 jobs succeeded, 0 failed
with compose smoke 113/0 and a 691,696-byte console artifact.

One Linux run of this same head answered 112 passed, 1 failed: the geo-restore
assertion got 000. The run after it was 113/0. That is recorded here instead of
quietly re-run until green, because the gate prints 000 for a stalled request, an
exited container and every other curl error as the same three characters, so a
reader cannot tell which of the three happened. Filed as OPEN-39.
2026-10-02 19:06:16 +02:00
Pavlo Ratushnyi d871d5791b The redirect target an edge cannot send is now refused by the shipped image, not only by the test host
OPEN-21's validator had never been driven from the image: the compose
gate wrote a valid redirectTo and asserted the 301, and never once sent
a CRLF, a javascript: or a relative target. Six assertions close that —
400 for each shape, the refusal naming the field, zero rows written for
either address, and both addresses still reaching the upstream
afterwards, which is what "no half-blocked visitor" means when the
block list is read by the next request rather than this one.

Two harness traps found on the way and written into the script: under
set -o pipefail, curl | grep -q reports failure because grep exits on
the first match and curl dies of SIGPIPE — the assertion went red about
a body that said exactly the right sentence; and a case pattern ending
in *) closes an enclosing command substitution, so the first rewrite
printed the rest of the line as the value under test.
2026-10-02 18:37:34 +02:00
Pavlo Ratushnyi e5f4ff041d 107 compose assertions now, and the rehearsal numbers describe the tree that has them 2026-10-02 18:09:49 +02:00
Pavlo Ratushnyi 24e329d2e1 The policy bounds and the status a ban answers with are now proven against the shipped image, not only the source tree
OPEN-20's guard had never been driven from the image: the compose gate
wrote policy values but never an out-of-range one, and no gate had ever
asked whether a VALID engineBlockStatus reaches the visitor. Seven
assertions close that: 400 for engineBlockStatus=1000 naming the range
400..599, the policy unchanged after the refusal, the same for
ipv4KeyPrefixLength=0 against 8..32, a banned visitor answering 451
while the operator asked for 451, and the original status back in force
afterwards.

Teeth measured, then reverted: with PolicyProblem's answer discarded,
PolicyValidationTests answer 16 failed / 2 passed and the compose gate
answers 104 passed / 3 failed on a rebuilt image. The 451 assertion
stays green under that mutation, which is the right split — it tests the
valid half, not the guard.
2026-10-02 17:29:39 +02:00
Pavlo Ratushnyi fe9b09f683 The numbers follow the tree: 173 integration tests, 100 compose assertions, 69 console assertions, and a contract line for the streak-map filter 2026-10-02 17:07:24 +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
openwaf-agent bce6657150 The unit count moved because a criterion gained a test, and the numbers follow the tree
cfe47d1 added DurabilityHealthTests (4), so unit is 132/132 wherever the
README and ci.yml said 128/128, and the rehearsal/act sentences name the
commit they were measured at. Re-measured at cfe47d1 rather than carried
forward:

  host      ci-gates all: unit 132/132, integration 170/170, smoke 28/0,
            image 261 MB, compose 94/0, exit 0; console 58/0
  linux     rehearsal all: source PASS (132/132, 170/170, 28/28), compose
            PASS 94/0 with enforcement lag 12 ms, console PASS
  act       5 jobs succeeded, 0 failed; console-evidence.zip 547,433 bytes
2026-10-02 13:36:42 +02:00
openwaf-agent cfe47d10b5 The cumulative-loss criterion had no test that could fail it
OPEN-31 criterion 2 — "EntriesLost is cumulative, not a gauge: a later
successful write does not erase what was already lost" — is carried by one
character in DurabilityHealth.RecordFailure. The integration suite reads
the count after one failed flush and again after a later success, and both
of those read the same under `EntriesLost = entriesLost` as under `+=`:
the difference only appears across two failed writes carrying different
row counts, which nothing in the suite was doing.

DurabilityHealthTests (4) covers the invariant directly, plus per-pillar
isolation of recovery (a happy retention prune says nothing about the
alert writer) and the root-cause rule (EF's wrapper message is not the
reason an operator can act on).

The mutation was run, not assumed: with `+=` changed to `=`, unit answers
Failed 1 / Passed 131 and integration answers 170/170 — i.e. before this
file the whole suite was green on a build that forgot lost rows. Reverted;
132/132 and 170/170.
2026-10-02 13:16:19 +02:00
openwaf-agent 5280e24a94 The rehearsal and act numbers describe the tree that carries the renamed tests
17b764e renamed two tests without touching an assertion, so the counts did
not move — but the README and ci.yml tie their Linux and act numbers to a
commit, and after a commit those sentences point one commit behind the
head. Re-measured rather than carried forward:

  host      ci-gates all: unit 128/128, integration 170/170, smoke 28/0,
            image 261 MB, compose 94/0, exit 0; console 58/0
  linux     rehearsal all: source PASS, compose PASS 94/0 (enforcement lag
            17 ms), console PASS
  act       5 jobs succeeded, 0 failed; console-evidence.zip 543,009 bytes
2026-10-02 13:03:57 +02:00
openwaf-agent 17b764ec29 Two test names claimed a readiness verdict their bodies no longer assert
A_flush_that_cannot_write_is_counted_and_readiness_names_the_pillar and
An_alert_that_never_reached_the_table_is_counted_and_readiness_names_it
both end with Assert.Equal(HttpStatusCode.OK, readyz). They were written
when a failed reporting write did make the edge unready, and the boundary
moved — the enforcement path gates, the reporting path is stated in
numbers — but the names stayed where the old rule was. A reader picking
one of these up to check "does a lost alert take an edge out of service?"
would have got the answer from the name and the opposite answer from the
body.

Names only; no assertion changed. Re-measured at this commit: unit
128/128, integration 170/170.
2026-10-02 12:50:16 +02:00
openwaf-agent 5430ed0b6f The README carries the write-side query contract, and the numbers describe that tree
The contract section said the unknown-parameter guard refuses on the list
endpoints. It now refuses on every endpoint under /admin-api, and the
interesting part is not the coverage: it is that the guard itself had the
bug. It assumed limit/offset were legal everywhere, so GET
/admin-api/countries?limit=2 was answered with the whole table by the
image that already carried the guard.

Numbers re-measured on ac672d9, not carried forward:
  host      unit 128/128, integration 170/170, smoke 28/0,
            compose 94/0, console 58/0, image 261 MB, 0 containers
  linux     source PASS (128/128, 170/170, 28/28), compose 94/0 with
            enforcement lag 11 ms, console 58/0
  act       5 jobs succeeded, 0 failed; console-evidence.zip 534,721 bytes
  compose assertion history: ... 81 before the retry loop, 86 before the
            write-endpoint guard, 94 now
2026-10-02 12:10:09 +02:00
openwaf-agent ac672d9908 A write endpoint dropped a parameter it never implemented and changed state anyway
OPEN-33 put a guard on the read listings. The image that carried it then
answered the same request two different ways depending on the verb:

  GET    /admin-api/blocks?zzz=1                    -> 400, names 'zzz'
  POST   /admin-api/blocks?zzz=1                    -> 204, ban written
  PUT    /admin-api/policy?zzz=1                    -> 200, policy changed
  PUT    /admin-api/countries/DE?allowed=true&zzz=1 -> 204
  DELETE /admin-api/blocks?key=...&zzz=1            -> 200 {"deleted":1}
  GET    /admin-api/countries?limit=2               -> 200, every row

The silent half was the half that changes state. A misspelled scoping
parameter on a write acts with a wider scope than the caller meant, and
answers as if the scope had applied.

The guard now covers every endpoint under /admin-api, and it runs before
any state change, so a rejected write cannot half-happen. The last line
above changed the design: the guard used to assume limit/offset were
always legal, which is the same bug one level down -- /countries has no
paging to honour, so ?limit=2 was accepted, dropped, and answered with
the whole table. Each endpoint now declares its own parameter surface
and the base set is only `token`, the one parameter real for every
endpoint because the auth layer reads it (OPEN-16).

Teeth: WriteQueryGuardTests (29) asserts the 400 per endpoint, that the
refusal names the parameter that was actually sent, that a refused write
changes nothing (block, policy, country rule), that the same request
without the unknown parameter is still served, and that ?token= still
works on a write. The compose gate grew a scene (8 assertions) that runs
the same measurements against the shipped image.

Measured on this tree: unit 128/128, integration 170/170, smoke 28/0,
compose 94/0 (enforcement lag 11 ms on Linux), console 58/0, image 261
MB. Linux rehearsal: all three stages PASS. act: 5 jobs succeeded, 0
failed, console-evidence.zip 534721 bytes.
2026-10-02 12:08:02 +02:00
Pavlo Ratushnyi b90b647474 The README carries the pending-ban contract, and the numbers describe that tree
Numbers re-measured at dcf8a73: macOS host unit 128/128, integration 141/141,
smoke 28/0, compose 86/0, console 58/0, image 261 MB, 0 containers left behind.
Linux rehearsal, all three stages in one run: PASS — source (128/128, 141/141,
28/0), compose 86/0 with enforcement lag 13 ms, console 58/0, 0 containers left
behind. act at dcf8a73: 5 jobs succeeded, 0 failed — source (128/128, 141/141,
28/0), image (261 MB, compose 86/0), console (58 assertions, 524,624-byte
screenshot artifact), lint, freshness.

Prose: the cost of "readiness returns on a write, not on a timer" when the only
thing that produces that write is the attacker coming back — the t+30/60/90/120
measurement, the retry loop, and the statement that the readiness gate was not
loosened to get this.
2026-10-02 11:39:31 +02:00
Pavlo Ratushnyi dcf8a733a9 A healed storage failure returned the edge to ready without waiting for traffic
OPEN-34, measured on the shipped image before this change. With writes to
block_entries aborted, five refusals produced counted write failures and
/readyz 503. The triggers were then REMOVED — write path healthy, zero triggers
left — and no further request was sent from that source:

  t+30 s  /readyz 503   /state: banWriteFailures 3, bansNotWritten 3
  t+60 s  /readyz 503   unchanged
  t+90 s  /readyz 503   unchanged
  t+120 s /readyz 503   unchanged

The ban pillar clears only on a successful ban write, and the only thing that
produced one was the source crossing the threshold again. Readiness — the
signal an orchestrator uses to keep an edge in rotation — was therefore coupled
to attack traffic: the quieter the site, the longer a repaired edge sat out of
service, enforcing everything except one ban nobody had written.

The fix is on the write side, not on the gate. A ban the engine decided and
could not write is kept as a PendingBan and re-attempted by a hosted loop on the
same 15 s cadence the other writers use; the sentence still runs from the moment
the ban was decided, so a retry that lands late cannot quietly lengthen it, and a
pending ban whose sentence expired before it could be written is counted
(bansNeverEnforced) and reported rather than rewritten as a fresh, longer ban.
/state gained bansPendingRetry and bansNeverEnforced, because without the first
a healed storage failure is indistinguishable from a quiet site.

Teeth: PendingBanRetryTests (3) — the retry landing with no further request, the
hosted loop doing it on its own (nobody calls it in that test), and an expired
pending ban reported rather than written late. Compose gate gained a 5-assertion
scene against the shipped image: the failed ban is queued, readiness returns
after the repair with no traffic from that source, the ban reaches storage, the
queue empties, and the source that was never banned during the break answers 403
afterwards.

Gates at this commit — macOS host: unit 128/128, integration 141/141, smoke
28/0, compose 86/0, console 58/0, 0 containers left behind. Linux rehearsal,
all three stages: PASS — source (128/128, 141/141, 28/0), compose 86/0 with
enforcement lag 13 ms, console 58/0, 0 containers left behind.
2026-10-02 11:34:44 +02:00
Pavlo Ratushnyi db146271c8 The README carries the query-surface contract, and the numbers describe that tree
Numbers re-measured at 336c2f7 rather than carried from the previous sweep:
macOS host unit 128/128, integration 138/138, smoke 28/0, compose 81/0, console
58/0, image 261 MB. Linux rehearsal source PASS (128/128, 138/138, 28/0),
compose 81/0 with enforcement lag 12 ms, console 58/0 with 0 containers left
behind. act at 336c2f7: 5 jobs succeeded, 0 failed — source (128/128, 138/138,
28/0), image (261 MB, compose 81/0), console (58 assertions, 498,801-byte
screenshot artifact), lint, freshness.

Prose: a paragraph on the query surface — a parameter the endpoint never
implemented used to be dropped without a trace, the answer kept its shape, and
the guard's first run broke three tests that were right to send ?token=.
2026-10-02 10:52:34 +02:00
Pavlo Ratushnyi 336c2f74a4 A query parameter the endpoint never implemented was dropped without a trace
Measured on the shipped image (openwaf:ci, 2026-10-02) with 16 recorded
sources:

  GET /admin-api/observations?source=203.0.113.11
      -> 200, 16 rows over 16 different addresses, X-Total-Count: 16
  GET /admin-api/observations?src=203.0.113.11
      -> 200, the same 16 rows

The filter was neither applied nor refused. It was absent: minimal APIs bind
the parameters a handler declares and discard the rest, so an operator
investigating one address was handed fifteen other addresses and a total that
matched those fifteen. Every list endpoint behaved this way. This is the same
shape as the bug OPEN-23 found one level up, where an unknown ?source= VALUE
meant "operator" and a typo in a DELETE wiped the manual list.

Two changes, because a refusal alone would have hidden a fair question:

- TryKnownQuery refuses any query parameter the endpoint has not heard of,
  naming the parameter and listing what that endpoint accepts. `token` is in
  the known set on purpose: the admin auth layer reads it from the query
  string and OPEN-16 ruled that curl-friendly form stays supported. Three
  existing integration tests call /admin-api/blocks?token=… and were right to
  — a guard that does not know the whole surface refuses requests that work,
  which is a worse bug than the one it prevents.
- /observations and /alerts gained ?source=, and X-Total-Count counts the
  filtered set rather than the table, so the header answers the question that
  was asked instead of putting a 16 next to a single row. An empty ?source= is
  refused rather than read as "every source".

Teeth: QueryHonestyTests (13) — integration 125 -> 138, and the three tests
the guard broke on the first run are the proof it bites. Compose gate gained a
scene with 7 assertions (74 -> 81): the filter returns one source and no
other, the total is the filtered total, ?zzz=1 and ?src= are refused by name
on two endpoints, and the parameters the endpoint really does honour still
answer 200.

Gates at this commit — macOS host: unit 128/128, integration 138/138, smoke
28/0, compose 81/0, console 58/0. Linux rehearsal: source PASS (128/128,
138/138, 28/0), compose 81/0, enforcement lag 12 ms.
2026-10-02 10:35:38 +02:00
Pavlo Ratushnyi 858fd0148c The README carries the ban-write contract, and the numbers describe that tree
Numbers re-measured at this head rather than carried forward from the commit
the last README sweep was written against:

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

Prose changes, not just digits:

- The compose write scene no longer asserts `/readyz` 503 for a reporting-path
  failure, and the README said it did. The sentence is rewritten to the boundary
  that is actually asserted now, with the measurement that moved it: one lost
  alert held `/readyz` at 503 for 120 s of idle time over a healthy write path,
  because an alert pillar writes only when an alert is raised.
- Both broken-pillar scenes are now eleven assertions, not ten: each proves the
  sources it claims were seen are really in the live streak map, so the scene
  cannot pass by counting one docker bridge address three times.
- The honest log line is described as polled and counted (3 lines), because the
  grep run immediately after the burst answers 0 and the same grep two seconds
  later answers 3.
- The compose history line now says where 74 came from: 63 before the ban-write
  scene, 72 before the scenes were made non-vacuous.
2026-10-02 10:11:50 +02:00
Pavlo Ratushnyi 1bcc086195 The log assertion sampled one instant, and the log line had not landed yet
The compose gate passed 74/0 on the macOS host and failed "and the log says
what actually happened" on the first Linux rehearsal of the same tree. The
wording was not the problem and neither was the platform: the grep over
`docker compose logs edge` was run immediately after the burst that produced
the line. Measured on the shipped image with the stack still up — the grep
right after the five refusals answered 0, the same grep two seconds later
answered 3. The /state field is updated synchronously on the request path;
the line reaches the daemon's log store a moment later, so the state
assertions passed and the log assertion failed on timing.

Both log assertions now poll, and both print the count they saw, so a passing
log assertion shows the number rather than an absence. The race-line count is
taken after the wait, so the before/after pair describes one moment: this
scene demonstrably produced 3 lines saying the ban was not persisted, and 0
lines calling it a concurrency race.

Linux rehearsal at this tree: 74 passed, 0 failed (was 73/1).
2026-10-02 09:52:47 +02:00
Pavlo Ratushnyi 12ccb55423 The compose scenes now name the policy they stand on, and prove their sources
The ban scene failed on the first Linux rehearsal and passed on the macOS
host, and the difference was not the platform: the read scene above it drops
policy_settings and recreates it empty, so once the reload succeeds against
the empty table the operator's overrides are gone and the policy is back to
the configured defaults — streakThreshold 10, trustProxyHeaders false. With
proxy headers untrusted, every "new source" in the write and ban scenes is
the same docker bridge address, the ban is never attempted, and the log line
the scene waits for never appears. Which policy is in force after that
restore is a timing question, so the scene passed on one machine and failed
on the other for a reason that had nothing to do with what it asserts.

Both scenes now PUT the policy they depend on before they generate traffic,
and both prove the sources they claim were seen are really in the live
streak map — three distinct keys in the write scene, the scanner's own key in
the ban scene — so the scene cannot pass by counting one address three times.

The streaks fetch is polled rather than sampled once: the first attempt right
after a burst answered a completely empty body while the next answered
complete, and an assertion on one instant is not a contract.

Gate on the host at this commit: 74 passed, 0 failed (was 72 + the 2 new).
2026-10-02 09:46:05 +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 68bec5b6be The README carries the write-health contract, and the numbers describe the tree that has it
Re-measured at 7b57c56, every stage on its own: macOS host unit 128/128,
integration 122/122, smoke 28/0, compose 63/0, console 57/0, image 261 MB;
Linux rehearsal source (Ubuntu 24.04.5, SDK 10.0.401) 128/128 + 122/122 + 28/0,
compose 63/0 with a 12 ms enforcement lag, console 57/0 leaving 0 containers;
act 5 jobs succeeded, 0 failed, console-evidence.zip 452,153 bytes.
shellcheck 0.11.0 clean over scripts/*.sh.
2026-10-02 08:49:05 +02:00
Pavlo Ratushnyi 7b57c56def The compose gate asserted the policy header at one instant, and one instant is not a contract
The first Linux rehearsal of this tree failed on the read-side scene: /state had
just reported a reload failure, and the very next GET /admin-api/policy answered
with X-Policy-Reload-Failures: 0. A reload succeeded in between — a pooled sqlite
connection can keep serving the schema it already prepared, which is the same
reason chmod 000 on the database file never breaks the edge. The product said
what the last read did; the gate was asserting on a sample. The header is now
polled while the table is gone and the observed value is printed either way, so
a red here names what was seen instead of naming the clock.
2026-10-02 08:38:55 +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 058e68be7e The README carries the pillar-health contract, and the numbers describe the tree that has it
Re-measured at 7e081da, every stage on its own: macOS host unit 128/128,
integration 117/117, smoke 25/0, compose 53/0, console 53/0, image 261 MB;
Linux rehearsal source (Ubuntu 24.04.5, SDK 10.0.401) 128/128 + 117/117 + 25/0,
compose 53/0 with a 12 ms enforcement lag, console 53/0; act 5 jobs succeeded, 0
failed, console-evidence.zip 429,592 bytes. shellcheck 0.11.0 clean over
scripts/*.sh.
2026-10-02 07:46:16 +02:00
Pavlo Ratushnyi 7e081da6fe The rehearsal tore down a stack it did not start and left the one it did running
The console stage starts the stack through the host daemon with whatever
COMPOSE_PROJECT_NAME the caller passed, so the CI-named project is what is
running. Its cleanup container passed no such name, so it removed the stack
named after this directory - nothing - and printed PASS while two containers
held the CI port. Re-running the stage with the CI console job's own
environment is what showed it: 53 assertions, 0 failed, and 2 containers still
up. With the name passed through, the same stage leaves 0.
2026-10-02 07:35:26 +02:00
Pavlo Ratushnyi ea68b550e2 Two CI jobs sharing one compose project: one job's teardown was the other's connection refused
The full local runner pass (act 0.2.89, catthehacker/ubuntu:act-latest) on this
tree went 4 jobs succeeded, 1 failed: the console job died 33 s in, at the
seeding curl of scripts/console-smoke.sh, with curl exit 7 — nothing listening on
127.0.0.1:8080 any more.

Not a product failure and not flakiness. The image job and the console job each
run `docker compose up -d` and each tear the stack down on exit, and both take the
project name from the repository directory and the host port from a literal 8080
in docker-compose.yml. On any machine where two jobs share one docker daemon — a
self-hosted runner, or act — they are the same stack, so the image job's
`compose down` removes the containers the console job is seeding into. Run alone,
the same console job passes (act -j console: 1 job succeeded, 53 assertions). On
GitHub's hosted runners each job gets its own machine, which is exactly why this
has never been seen there and why "the workflow has never run on GitHub" is still
a gap this repository carries rather than a solved problem.

Fix: the published port is ${EDGE_PORT:-8080}, and each job names its own compose
project (openwafci-image on 8080, openwafci-console on 8090). Separate projects
means separate containers, separate volumes and separate ports, so neither job can
see the other's stack. scripts/ci-linux-rehearsal.sh passes COMPOSE_PROJECT_NAME
and EDGE_PORT through to the seeding container so an operator can isolate a
rehearsal the same way.

Measured after: the same full act pass is 5 jobs succeeded, 0 failed — lint,
source (128/128, 117/117, smoke 25/0), image (261 MB, compose smoke 53/0),
console (53 assertions / 0 failed, screenshot artifact), freshness. Locally:
compose gate 53/0 with the default project and port unchanged, and the console
gate 53/0 driven through the CI configuration (COMPOSE_PROJECT_NAME=openwafci-console,
EDGE_PORT=8090).
2026-10-02 07:21:13 +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 73872ceda1 The README carries the exemption contract, and the numbers describe the tree that has it
The Admin API section now says what GET /admin-api/allow answers — live by
default, live=false meaning "do not filter", limit 1..2000 and offset,
X-Total-Count and X-Truncated, and a live flag on each row computed from the same
AllowEntry.IsLive the engine applies — and records the measurement that made it
so: the entry written at 03:58:16 for one minute, the address through at 03:58:20
(502) and blocked again at 03:59:38 (301), the row still listed unmarked at
03:59:39 with /state still saying allowEntries:1, and 1,101 rows in 130,386 bytes
with every paging parameter ignored.

Numbers moved to the tree that has the fix (c97c7a1), host and Linux: unit
128/128, integration 113/113 (was 109), smoke 22/0 (was 19), compose 47/0 (was
43), console 50/0 (was 47), image 261 MB; Linux enforcement lag 11 ms. act 0.2.89
on catthehacker/ubuntu:act-latest at c97c7a1: 5 jobs succeeded, 0 failed, console
screenshot artifact 606,514 bytes. The workflow's own header comment carries the
same numbers, since it is the file a reader trusts when the README is one commit
ahead of the run it describes.
2026-10-02 06:24:51 +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 378775ce83 The README carries the 404 contract, and the numbers describe the tree that has it
Run of 6e6461a:

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

The new section states the 404 contract with both columns measured on shipped
images (08bebf43 before, 4823e9ae after), and names the console's copy of the
bug: every 404 read as "the admin API is switched off", and the destructive
"clear the automatic bans" button reading nothing back at all.
2026-10-02 05:26:49 +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 73906cc9de The README describes the tree with the storage-failure fix, with both images side by side
Numbers from a run of a77ab53, not of a commit several fixes behind it:

* macOS host gates: build 0 warnings / 0 errors, unit 128/128, integration
  106/106, smoke passed 19 / failed 0, compose 43 passed / 0 failed, console
  45 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 from the pinned global.json) 128/128, 106/106,
  19/0; compose in docker:cli against the host daemon 43/0, enforcement lag
  12 ms; console in mcr.microsoft.com/playwright:v1.63.0-noble (chromium-1243)
  45/0.
* act 0.2.89 on catthehacker/ubuntu:act-latest: 5 jobs succeeded, 0 failed —
  lint, source, image, console (screenshot artifact, 552,268-byte zip),
  freshness (pin 2026-10 = newest 2026-10).

The new section states the contract the fix establishes, with the before column
measured on the image built from 72d37ad and the after column on the image built
from a77ab53, and keeps the boundary in the same breath as the numbers: no
remote exists, so no GitHub-hosted runner has ever executed this workflow.
2026-10-02 04:37:42 +02:00