Address #126 review: one home for the middleware rationale
Build image / build-and-push (push) Successful in 20s
Build image / build-and-push (push) Successful in 20s
The why-a-controller-can't-reach-the-socket story was told in full in deadlines.go, agent.go, the test, and CLAUDE.md. It lives in deadlines.go now; the others say what they need to and point there. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -161,12 +161,11 @@ Conventions that follow from it:
|
||||
lives in `commitScope` where no caller can forget it.
|
||||
|
||||
- **Request deadlines are extended through `responseController(c)`, never
|
||||
`http.NewResponseController(c.Writer)`.** The logging middleware wraps the
|
||||
writer in a type with no `Unwrap`, so a controller built from a handler's
|
||||
writer can't reach the socket: every `SetWriteDeadline`/`SetReadDeadline`
|
||||
returns `ErrNotSupported` — in production only. `captureController` is the
|
||||
first middleware in `api.New` precisely so the controller exists before
|
||||
anything wraps the writer. Corollary for tests: a deadline test must run
|
||||
`http.NewResponseController(c.Writer)`.** A controller built in a handler
|
||||
can't reach the socket — the logging middleware wraps the writer — so every
|
||||
deadline call silently returns `ErrNotSupported`, in production only;
|
||||
`internal/api/deadlines.go` has the mechanism and why `captureController`
|
||||
must stay the first middleware. Corollary for tests: a deadline test must run
|
||||
through `New()`, not `gin.New()` — the #78 fix shipped fully tested on a bare
|
||||
engine and never worked on the live instance.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user