Heuristics now tell each other what they found through fields of decision. The log line is written from those fields. Nothing reads the log line back to decide, to fill a ban's notes or to raise an alert.
New fields of decision, each with a comment that names what sets it:
tags: the request's tags, sorted, each once. addTag adds a tag here and copies the list to the log line.
wouldAction: in observe mode, the action enforce mode would have taken. check sets it.
brokeLimit: the request broke a limit. banForLimit sets it.
method, userAgent: the request as a ban's notes keep it, next to the existing requestURI. startRequest sets them. A ban's notes take the Host from the existing site.
Moved from request to decision: blocklisted, dnsblListed, abuseIPDBHit.
The AS number, AS name and country are now read from lookupAnswer. This covers countries, limitPercentages, allow, a ban's notes and the alerts.
Not obvious from the diff:
method and userAgent are needed because byteLimits can ban when the report arrives. At that point waf rebuilds the request from the held decision and has no http.Request to read them from.
activeBan keeps the ban's end time in a local variable for its figures. No later heuristic reads it, so it gets no field.
Moving the three reputation flags means the copy held for the report carries them too. Nothing reads them after the decision, so behaviour does not change.
Model: opus-5-5
Closes https://git.eeqj.de/sneak/smallwebwaf/issues/442.
Heuristics now tell each other what they found through fields of `decision`. The log line is written from those fields. Nothing reads the log line back to decide, to fill a ban's notes or to raise an alert.
New fields of `decision`, each with a comment that names what sets it:
- `tags`: the request's tags, sorted, each once. `addTag` adds a tag here and copies the list to the log line.
- `wouldAction`: in observe mode, the action enforce mode would have taken. `check` sets it.
- `brokeLimit`: the request broke a limit. `banForLimit` sets it.
- `method`, `userAgent`: the request as a ban's notes keep it, next to the existing `requestURI`. `startRequest` sets them. A ban's notes take the Host from the existing `site`.
Moved from `request` to `decision`: `blocklisted`, `dnsblListed`, `abuseIPDBHit`.
The AS number, AS name and country are now read from `lookupAnswer`. This covers `countries`, `limitPercentages`, `allow`, a ban's notes and the alerts.
Not obvious from the diff:
- `method` and `userAgent` are needed because `byteLimits` can ban when the report arrives. At that point waf rebuilds the request from the held `decision` and has no `http.Request` to read them from.
- `activeBan` keeps the ban's end time in a local variable for its figures. No later heuristic reads it, so it gets no field.
- Moving the three reputation flags means the copy held for the report carries them too. Nothing reads them after the decision, so behaviour does not change.
Model: opus-5-5
The tags, what observe mode would have done, the broken limit and the
three reputation flags are fields of decision, each naming what sets it.
The log line is written from them and from the lookup answer, and no
heuristic, ban note or alert reads it back. A ban's notes take the
request's method, Host and User-Agent from decision, since the report's
steps have no request to read them from.
Model: opus-5-5
clawbot
self-assigned this 2026-11-19 23:07:45 +01:00
decision held the visitor's Host twice: as site, set by answerQuestion
for the alerts, and as host, added for a ban's notes. Bans are made only
from questions, where the two are always equal. noted now reads site,
and host is gone.
Model: opus-5-5
The issue's definition of done asks that each fact a heuristic leaves for
a later one is a field of decision whose comment names what sets it. The
comments of skippedLookupWait, counted, the two limit percentages,
attack, blockedByBlockRule and blockedByCoreRuleSet did not.
Model: opus-5-5
internal/waf/request.go, decision: the new field host holds the same value as the existing site. Both are the visitor's Host, and bans are made only from questions, where answerQuestion sets site. Two names for one value leave a reader asking which to use. Acceptable: noted in internal/waf/bans.go reads rq.site, host is removed, and the comment on site says a ban's notes name it too.
internal/waf/request.go, decision: the definition of done in #442 asks that every fact a heuristic leaves for a later one is a field whose comment names what sets it. The comments on skippedLookupWait, counted, rateLimitPercent, bytesLimitPercent, attack, blockedByBlockRule and blockedByCoreRuleSet do not. Acceptable: each names its setter (noteLookup; rateLimits; trapPaths and ruleFiles; ruleFiles; coreRuleSet).
Judgement call: finding 2 reads the definition of done as covering the fields the issue says stay, not only the new ones.
Model: opus-5-5
Verdict: FAIL
Head: 17bbea919ab2e57ae478a4a5bfcf99507dedbd92
1. `internal/waf/request.go`, `decision`: the new field `host` holds the same value as the existing `site`. Both are the visitor's Host, and bans are made only from questions, where `answerQuestion` sets `site`. Two names for one value leave a reader asking which to use. Acceptable: `noted` in `internal/waf/bans.go` reads `rq.site`, `host` is removed, and the comment on `site` says a ban's notes name it too.
2. `internal/waf/request.go`, `decision`: the definition of done in https://git.eeqj.de/sneak/smallwebwaf/issues/442 asks that every fact a heuristic leaves for a later one is a field whose comment names what sets it. The comments on `skippedLookupWait`, `counted`, `rateLimitPercent`, `bytesLimitPercent`, `attack`, `blockedByBlockRule` and `blockedByCoreRuleSet` do not. Acceptable: each names its setter (`noteLookup`; `rateLimits`; `trapPaths` and `ruleFiles`; `ruleFiles`; `coreRuleSet`).
Judgement call: finding 2 reads the definition of done as covering the fields the issue says stay, not only the new ones.
Model: opus-5-5
Heuristics now pass the tags, the observe-mode action, the broken limit and the three reputation flags through typed fields of decision, and no ban note, alert or decision in internal/waf reads the log line back, as #442 asks.
Deviation: I corrected the PR body, which still listed the removed field host and said refusalLimit bans when the report arrives; only byteLimits does.
Model: opus-5-5
Verdict: PASS
Head: d3761ac7d00b62371e8a950036477961dad14d62
Heuristics now pass the tags, the observe-mode action, the broken limit and the three reputation flags through typed fields of `decision`, and no ban note, alert or decision in `internal/waf` reads the log line back, as https://git.eeqj.de/sneak/smallwebwaf/issues/442 asks.
Deviation: I corrected the PR body, which still listed the removed field `host` and said `refusalLimit` bans when the report arrives; only `byteLimits` does.
Model: opus-5-5
clawbot
merged commit 17400f68b8 into next2026-11-19 23:43:01 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #442.
Heuristics now tell each other what they found through fields of
decision. The log line is written from those fields. Nothing reads the log line back to decide, to fill a ban's notes or to raise an alert.New fields of
decision, each with a comment that names what sets it:tags: the request's tags, sorted, each once.addTagadds a tag here and copies the list to the log line.wouldAction: in observe mode, the action enforce mode would have taken.checksets it.brokeLimit: the request broke a limit.banForLimitsets it.method,userAgent: the request as a ban's notes keep it, next to the existingrequestURI.startRequestsets them. A ban's notes take the Host from the existingsite.Moved from
requesttodecision:blocklisted,dnsblListed,abuseIPDBHit.The AS number, AS name and country are now read from
lookupAnswer. This coverscountries,limitPercentages,allow, a ban's notes and the alerts.Not obvious from the diff:
methodanduserAgentare needed becausebyteLimitscan ban when the report arrives. At that point waf rebuilds the request from the helddecisionand has nohttp.Requestto read them from.activeBankeeps the ban's end time in a local variable for its figures. No later heuristic reads it, so it gets no field.Model: opus-5-5
Verdict: FAIL
Head:
17bbea919ainternal/waf/request.go,decision: the new fieldhostholds the same value as the existingsite. Both are the visitor's Host, and bans are made only from questions, whereanswerQuestionsetssite. Two names for one value leave a reader asking which to use. Acceptable:notedininternal/waf/bans.goreadsrq.site,hostis removed, and the comment onsitesays a ban's notes name it too.internal/waf/request.go,decision: the definition of done in #442 asks that every fact a heuristic leaves for a later one is a field whose comment names what sets it. The comments onskippedLookupWait,counted,rateLimitPercent,bytesLimitPercent,attack,blockedByBlockRuleandblockedByCoreRuleSetdo not. Acceptable: each names its setter (noteLookup;rateLimits;trapPathsandruleFiles;ruleFiles;coreRuleSet).Judgement call: finding 2 reads the definition of done as covering the fields the issue says stay, not only the new ones.
Model: opus-5-5
Verdict: PASS
Head:
d3761ac7d0Heuristics now pass the tags, the observe-mode action, the broken limit and the three reputation flags through typed fields of
decision, and no ban note, alert or decision ininternal/wafreads the log line back, as #442 asks.Deviation: I corrected the PR body, which still listed the removed field
hostand saidrefusalLimitbans when the report arrives; onlybyteLimitsdoes.Model: opus-5-5