internal/waf: file names that say what each file holds #435

Open
opened 2026-11-19 17:12:54 +01:00 by clawbot · 1 comment
Collaborator

Start once these three are closed, since each moves code out of the files this issue rearranges:

  • the package for what rproxy and waf send each other: #425;
  • waf's own endpoints on a chi router: #426;
  • building the Core Rule Set in internal/sww: #434.

Pick it up while no other open PR edits internal/waf/waf.go or internal/waf/proxy.go: a PR that only moves code conflicts with every edit to what it moves.

From the architecture review, "Constructors, file layout, the order of the proposals, and what was not checked", under "internal/discriminator's files do not say what they hold": #283 (comment). Approved for building: #283 (comment). The code was read at 809d266 on next, where discriminator is now waf.

What is there

  • internal/waf/proxy.go holds the package comment, Params, Server, handler, newHandler and four of the endpoint paths. waf is not a proxy.
  • New is in waf.go, away from them, with the code that reads a question, writes the answer and takes a report.
  • Fifteen of the sixteen heuristics have a file each. The sixteenth, activeBan, is in bans.go with the code that makes bans.
  • Seven files hold code the heuristics share, or code beside them: bans.go, biased.go, client.go, lookup.go, reputation.go, besidelookup.go, abuseipdbblacklist.go. Nothing in a file's name tells those from a heuristic's file. heuristics.go is the only index.

Why it matters

A newcomer looking for where the server is built opens waf.go and does not find its type. CODE_STYLEGUIDE_GO.md asks for struct types near their constructors.

What changes

Moves only. No identifier is renamed and no line of code changes.

  • Params, Server, New, handler and newHandler sit together in waf.go, the file named for the package, under the package comment.
  • What is left of the question, answer and report code in waf.go gets a file of its own.
  • activeBan gets a file of its own, as the other fifteen heuristics have.
  • proxy.go goes away.

What stays

  • Every identifier, comment and behaviour.
  • The names of the other files. Renaming the shared files so that they read apart from the heuristics' files is not in the review's proposal.

Done when

  • the five declarations are in waf.go, each heuristic has its own file, and there is no proxy.go;
  • the diff is moves only: git diff --color-moved shows no changed line inside a moved block;
  • every existing test passes with no assertion changed;
  • make check passes;
  • the PR body lists each new file name. Each says what the file holds, the standard of the symbol names audit (#213).

Model: fable-5-2

**Start once these three are closed**, since each moves code out of the files this issue rearranges: - the package for what `rproxy` and `waf` send each other: https://git.eeqj.de/sneak/smallwebwaf/issues/425; - `waf`'s own endpoints on a `chi` router: https://git.eeqj.de/sneak/smallwebwaf/issues/426; - building the Core Rule Set in `internal/sww`: https://git.eeqj.de/sneak/smallwebwaf/issues/434. Pick it up while no other open PR edits `internal/waf/waf.go` or `internal/waf/proxy.go`: a PR that only moves code conflicts with every edit to what it moves. From the architecture review, "Constructors, file layout, the order of the proposals, and what was not checked", under "`internal/discriminator`'s files do not say what they hold": https://git.eeqj.de/sneak/smallwebwaf/issues/283#issuecomment-173850. Approved for building: https://git.eeqj.de/sneak/smallwebwaf/issues/283#issuecomment-183550. The code was read at `809d266` on `next`, where `discriminator` is now `waf`. ### What is there - `internal/waf/proxy.go` holds the package comment, `Params`, `Server`, `handler`, `newHandler` and four of the endpoint paths. `waf` is not a proxy. - `New` is in `waf.go`, away from them, with the code that reads a question, writes the answer and takes a report. - Fifteen of the sixteen heuristics have a file each. The sixteenth, `activeBan`, is in `bans.go` with the code that makes bans. - Seven files hold code the heuristics share, or code beside them: `bans.go`, `biased.go`, `client.go`, `lookup.go`, `reputation.go`, `besidelookup.go`, `abuseipdbblacklist.go`. Nothing in a file's name tells those from a heuristic's file. `heuristics.go` is the only index. ### Why it matters A newcomer looking for where the server is built opens `waf.go` and does not find its type. `CODE_STYLEGUIDE_GO.md` asks for struct types near their constructors. ### What changes Moves only. No identifier is renamed and no line of code changes. - `Params`, `Server`, `New`, `handler` and `newHandler` sit together in `waf.go`, the file named for the package, under the package comment. - What is left of the question, answer and report code in `waf.go` gets a file of its own. - `activeBan` gets a file of its own, as the other fifteen heuristics have. - `proxy.go` goes away. ### What stays - Every identifier, comment and behaviour. - The names of the other files. Renaming the shared files so that they read apart from the heuristics' files is not in the review's proposal. ### Done when - the five declarations are in `waf.go`, each heuristic has its own file, and there is no `proxy.go`; - the diff is moves only: `git diff --color-moved` shows no changed line inside a moved block; - every existing test passes with no assertion changed; - `make check` passes; - the PR body lists each new file name. Each says what the file holds, the standard of the symbol names audit (https://git.eeqj.de/sneak/smallwebwaf/issues/213). Model: fable-5-2
clawbot self-assigned this 2026-11-19 17:12:54 +01:00
Author
Collaborator

Not started: it waits on #425, #426 and #434, all still open, as the issue requires.

Model: opus-5-5

Not started: it waits on https://git.eeqj.de/sneak/smallwebwaf/issues/425, https://git.eeqj.de/sneak/smallwebwaf/issues/426 and https://git.eeqj.de/sneak/smallwebwaf/issues/434, all still open, as the issue requires. Model: opus-5-5
clawbot added the needs-decision label 2026-11-19 17:23:58 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/smallwebwaf#435