Start once the issue that removes the parts from waf.Server is closed: #436. Both rewrite that type and the test helpers that use it.
From the architecture review, "The HTTP surface", under "Both Server types embed *http.Server": #283 (comment). Approved for building: #283 (comment). The code was read at 809d266 on next, where discriminator is now waf. Line numbers are that commit's.
What is there
waf.Server (internal/waf/proxy.go:121) and rproxy.Server (internal/rproxy/rproxy.go:70) embed *http.Server. Every field and method of Go's server is then part of their own API: Handler, Addr, ListenAndServe, RegisterOnShutdown and the rest.
internal/sww takes the embedded server out with a provider for each daemon, func(server *waf.Server) *http.Server { return server.Server }, and its serve hook (internal/sww/lifecycle.go:102) calls three methods on it: Serve, Shutdown, Close.
The tests use more: server.Addr, server.Serve, server.Close, server.Handler.ServeHTTP, and s.Handler.(*handler) in internal/waf/export_test.go.
Why it matters
GO_HTTP_SERVER_CONVENTIONS.md holds Go's server as a private field, httpServer *http.Server, and makes Server the handler.
The review rates the gain in reading as small: nothing misuses the embedded server today.
What changes
Each Server holds Go's server as a private field.
Each Server gets ServeHTTP, and the three methods internal/sww needs to start and stop it: Serve, Shutdown, Close.
sww's serve hook takes those three methods as one small interface declared beside it in internal/sww, in place of *http.Server. The two providers that take the embedded server out go.
The tests call ServeHTTP on the Server, and the test helpers that set server.Addr keep the listener's address themselves.
The review wrote this before the fx wiring, and counted one method per Server. The shared serve hook needs the three.
What stays
Every setting of Go's server that New makes today: the timeouts, the error log, the limit on the size of the headers.
How each daemon starts and stops, and rproxy.Server.WaitForReports.
Done when
neither Server embeds *http.Server, and neither exports it;
internal/sww reaches Go's server only through the three methods;
behaviour is unchanged: every existing test passes with no assertion changed;
make check passes;
the PR body lists the new interface's name and each new method's.
If this is more than one PR can carry, say so on this issue instead of starting.
Model: fable-5-2
**Start once the issue that removes the parts from `waf.Server` is closed: https://git.eeqj.de/sneak/smallwebwaf/issues/436.** Both rewrite that type and the test helpers that use it.
From the architecture review, "The HTTP surface", under "Both `Server` types embed `*http.Server`": https://git.eeqj.de/sneak/smallwebwaf/issues/283#issuecomment-173836. 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`. Line numbers are that commit's.
### What is there
- `waf.Server` (`internal/waf/proxy.go:121`) and `rproxy.Server` (`internal/rproxy/rproxy.go:70`) embed `*http.Server`. Every field and method of Go's server is then part of their own API: `Handler`, `Addr`, `ListenAndServe`, `RegisterOnShutdown` and the rest.
- `internal/sww` takes the embedded server out with a provider for each daemon, `func(server *waf.Server) *http.Server { return server.Server }`, and its `serve` hook (`internal/sww/lifecycle.go:102`) calls three methods on it: `Serve`, `Shutdown`, `Close`.
- The tests use more: `server.Addr`, `server.Serve`, `server.Close`, `server.Handler.ServeHTTP`, and `s.Handler.(*handler)` in `internal/waf/export_test.go`.
### Why it matters
- `GO_HTTP_SERVER_CONVENTIONS.md` holds Go's server as a private field, `httpServer *http.Server`, and makes `Server` the handler.
- The review rates the gain in reading as small: nothing misuses the embedded server today.
### What changes
- Each `Server` holds Go's server as a private field.
- Each `Server` gets `ServeHTTP`, and the three methods `internal/sww` needs to start and stop it: `Serve`, `Shutdown`, `Close`.
- `sww`'s `serve` hook takes those three methods as one small interface declared beside it in `internal/sww`, in place of `*http.Server`. The two providers that take the embedded server out go.
- The tests call `ServeHTTP` on the `Server`, and the test helpers that set `server.Addr` keep the listener's address themselves.
The review wrote this before the fx wiring, and counted one method per `Server`. The shared `serve` hook needs the three.
### What stays
- Every setting of Go's server that `New` makes today: the timeouts, the error log, the limit on the size of the headers.
- How each daemon starts and stops, and `rproxy.Server.WaitForReports`.
### Done when
- neither `Server` embeds `*http.Server`, and neither exports it;
- `internal/sww` reaches Go's server only through the three methods;
- behaviour is unchanged: every existing test passes with no assertion changed;
- `make check` passes;
- the PR body lists the new interface's name and each new method's.
If this is more than one PR can carry, say so on this issue instead of starting.
Model: fable-5-2
clawbot
self-assigned this 2026-11-19 17:13:07 +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.
Start once the issue that removes the parts from
waf.Serveris closed: #436. Both rewrite that type and the test helpers that use it.From the architecture review, "The HTTP surface", under "Both
Servertypes embed*http.Server": #283 (comment). Approved for building: #283 (comment). The code was read at809d266onnext, wherediscriminatoris nowwaf. Line numbers are that commit's.What is there
waf.Server(internal/waf/proxy.go:121) andrproxy.Server(internal/rproxy/rproxy.go:70) embed*http.Server. Every field and method of Go's server is then part of their own API:Handler,Addr,ListenAndServe,RegisterOnShutdownand the rest.internal/swwtakes the embedded server out with a provider for each daemon,func(server *waf.Server) *http.Server { return server.Server }, and itsservehook (internal/sww/lifecycle.go:102) calls three methods on it:Serve,Shutdown,Close.server.Addr,server.Serve,server.Close,server.Handler.ServeHTTP, ands.Handler.(*handler)ininternal/waf/export_test.go.Why it matters
GO_HTTP_SERVER_CONVENTIONS.mdholds Go's server as a private field,httpServer *http.Server, and makesServerthe handler.What changes
Serverholds Go's server as a private field.ServergetsServeHTTP, and the three methodsinternal/swwneeds to start and stop it:Serve,Shutdown,Close.sww'sservehook takes those three methods as one small interface declared beside it ininternal/sww, in place of*http.Server. The two providers that take the embedded server out go.ServeHTTPon theServer, and the test helpers that setserver.Addrkeep the listener's address themselves.The review wrote this before the fx wiring, and counted one method per
Server. The sharedservehook needs the three.What stays
Newmakes today: the timeouts, the error log, the limit on the size of the headers.rproxy.Server.WaitForReports.Done when
Serverembeds*http.Server, and neither exports it;internal/swwreaches Go's server only through the three methods;make checkpasses;If this is more than one PR can carry, say so on this issue instead of starting.
Model: fable-5-2
Not started: this issue waits for #436 to close, which is still open with no PR.
Model: opus-5-5