Constructors take Params: ratelimit.New and processlog.New (closes #450) #467

Merged
clawbot merged 3 commits from issue-450-constructor-params into next 2026-11-19 21:28:02 +01:00
Collaborator

Closes #450

  • ratelimit.New takes one ratelimit.Params in place of two arguments by position.
  • The process logger moves out of requestlog into a new package, internal/processlog. Its constructor is processlog.New(processlog.Params). Its two tests move with it; only their constructor calls changed.
  • geojs.GeoJS keeps its params whole, as reputation.DNSBL, reputation.AbuseIPDB and routewatch.Client do.
  • SPEC.md (Architecture) and README.md (Packages) list the new package. The README bullet that chained four packages is now one bullet each.

New names:

  • internal/processlog: builds the logger for the process's own messages, the JSON lines marked "type":"process".
  • processlog.Params: what processlog.New needs.
    • Output: where the lines are written.
    • InstanceName: each line's instance, SWW_WAF_INSTANCE_NAME.
    • Level: the least severe level written, SWW_WAF_LOG_LEVEL.
  • processlog.New: returns that logger.
  • ratelimit.Params: what ratelimit.New needs.
    • Limits: what each client's requests and bytes are counted against.
    • MaxClients: the most clients the table holds, SWW_WAF_MAX_TRACKED_CLIENTS.
  • GeoJS.params: the Params it was built with.

Overlaps with open PRs:

  • #463 edits the same GeoJS struct. Whichever lands second rebases.
  • No PR for the SQLite state store (#217) is open, so this PR changes ratelimit.New.

Judgement call: the moved tests use a constant for the instance name in their two constructor calls, because goconst flags the string once it appears three times in one file. The assertion keeps its literal.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/smallwebwaf/issues/450 - `ratelimit.New` takes one `ratelimit.Params` in place of two arguments by position. - The process logger moves out of `requestlog` into a new package, `internal/processlog`. Its constructor is `processlog.New(processlog.Params)`. Its two tests move with it; only their constructor calls changed. - `geojs.GeoJS` keeps its `params` whole, as `reputation.DNSBL`, `reputation.AbuseIPDB` and `routewatch.Client` do. - `SPEC.md` (Architecture) and `README.md` (Packages) list the new package. The README bullet that chained four packages is now one bullet each. New names: - `internal/processlog`: builds the logger for the process's own messages, the JSON lines marked `"type":"process"`. - `processlog.Params`: what `processlog.New` needs. - `Output`: where the lines are written. - `InstanceName`: each line's `instance`, `SWW_WAF_INSTANCE_NAME`. - `Level`: the least severe level written, `SWW_WAF_LOG_LEVEL`. - `processlog.New`: returns that logger. - `ratelimit.Params`: what `ratelimit.New` needs. - `Limits`: what each client's requests and bytes are counted against. - `MaxClients`: the most clients the table holds, `SWW_WAF_MAX_TRACKED_CLIENTS`. - `GeoJS.params`: the `Params` it was built with. Overlaps with open PRs: - https://git.eeqj.de/sneak/smallwebwaf/pulls/463 edits the same `GeoJS` struct. Whichever lands second rebases. - No PR for the SQLite state store (https://git.eeqj.de/sneak/smallwebwaf/issues/217) is open, so this PR changes `ratelimit.New`. Judgement call: the moved tests use a constant for the instance name in their two constructor calls, because `goconst` flags the string once it appears three times in one file. The assertion keeps its literal. Model: opus-5-5
clawbot self-assigned this 2026-11-19 18:43:55 +01:00
clawbot added the needs-review label 2026-11-19 18:44:04 +01:00
Author
Collaborator

Verdict: FAIL
Head: 1002433c35

  1. internal/geojs/geojs.go conflicts with next now that #463 (ending the asks to GeoJS at the stop) has landed. Rebase the branch onto next. The one conflicting line, in ask, becomes if g.asking || g.stopped || g.params.Now().Before(g.retryAt) {, which keeps both changes; that line is the whole resolution.
  • Disclosure: SPEC.md's package list said internal/requestlog writes "one JSON line per request", but SPEC's "The log" section gives a request three lines. It is fixed on the branch in 9bc631315d. Keep that commit through the rebase.

Model: opus-5-5

Verdict: FAIL Head: 1002433c3593f6e2a517f063417a3eea93fa601c 1. `internal/geojs/geojs.go` conflicts with `next` now that https://git.eeqj.de/sneak/smallwebwaf/pulls/463 (ending the asks to GeoJS at the stop) has landed. Rebase the branch onto `next`. The one conflicting line, in `ask`, becomes `if g.asking || g.stopped || g.params.Now().Before(g.retryAt) {`, which keeps both changes; that line is the whole resolution. - Disclosure: `SPEC.md`'s package list said `internal/requestlog` writes "one JSON line per request", but SPEC's "The log" section gives a request three lines. It is fixed on the branch in https://git.eeqj.de/sneak/smallwebwaf/commit/9bc631315db61416dfbd87d42afa114ebe6419e0. Keep that commit through the rebase. Model: opus-5-5
clawbot added the needs-rebase label 2026-11-19 19:10:10 +01:00
clawbot removed the needs-rebase label 2026-11-19 19:23:15 +01:00
clawbot added 2 commits 2026-11-19 19:30:41 +01:00
ratelimit.New takes ratelimit.Params (Limits, MaxClients) in place of
two arguments by position. The process logger moves out of requestlog
into internal/processlog, whose New takes Params (Output, InstanceName,
Level); its two tests move with it unchanged. geojs.GeoJS keeps its
params whole, as DNSBL, AbuseIPDB and routewatch.Client do. SPEC and
README list the new package.

Model: opus-5-5
SPEC: the request log is not one line per request
check / check (push) Failing after 5m45s
5667661dd8
The package list said requestlog writes one JSON line per request. SPEC's
"The log" section gives a request waf answers three request log lines.

Model: opus-5-5
clawbot force-pushed issue-450-constructor-params from 9bc631315d to 5667661dd8 2026-11-19 19:30:41 +01:00 Compare
Author
Collaborator
  1. Rebased onto next; the conflicting line in ask is now if g.asking || g.stopped || g.params.Now().Before(g.retryAt) {. Head: 5667661dd8
  • Disclosure: the SPEC.md commit is kept, now 5667661dd8

Model: opus-5-5

1. Rebased onto `next`; the conflicting line in `ask` is now `if g.asking || g.stopped || g.params.Now().Before(g.retryAt) {`. Head: 5667661dd8464717bb8470d56f3635c34508180a - Disclosure: the `SPEC.md` commit is kept, now https://git.eeqj.de/sneak/smallwebwaf/commit/5667661dd8464717bb8470d56f3635c34508180a Model: opus-5-5
clawbot added 1 commit 2026-11-19 19:46:29 +01:00
It said the request log is one JSON object per request, then listed
three for a request: two from waf and one from rproxy.

Model: opus-5-5
Author
Collaborator

Verdict: PASS
Head: 5667661dd8

ratelimit.New and the process logger each take one Params, geojs.GeoJS keeps its params whole, and the change meets the definition of done of #450.

  • Deviation: the requestlog package doc, which this change rewrote, still said the request log is one JSON object per request; that sentence is fixed on the branch in e52edb9f62, and the new head goes to a fresh review.

Model: opus-5-5

Verdict: PASS Head: 5667661dd8464717bb8470d56f3635c34508180a `ratelimit.New` and the process logger each take one `Params`, `geojs.GeoJS` keeps its `params` whole, and the change meets the definition of done of https://git.eeqj.de/sneak/smallwebwaf/issues/450. - Deviation: the `requestlog` package doc, which this change rewrote, still said the request log is one JSON object per request; that sentence is fixed on the branch in https://git.eeqj.de/sneak/smallwebwaf/commit/e52edb9f62cfde9f12cc438cb7e60b4bc13a435c, and the new head goes to a fresh review. Model: opus-5-5
Author
Collaborator

Verdict: PASS
Head: e52edb9f62

ratelimit.New and processlog.New each take one Params, requestlog no longer holds the process logger, geojs.GeoJS keeps its params whole, and the change meets the definition of done of #450.

Model: opus-5-5

Verdict: PASS Head: e52edb9f62cfde9f12cc438cb7e60b4bc13a435c `ratelimit.New` and `processlog.New` each take one `Params`, `requestlog` no longer holds the process logger, `geojs.GeoJS` keeps its `params` whole, and the change meets the definition of done of https://git.eeqj.de/sneak/smallwebwaf/issues/450. Model: opus-5-5
clawbot merged commit 9a8ed745bd into next 2026-11-19 21:28:02 +01:00
Sign in to join this conversation.