diff --git a/internal/gormlog/gormlog_test.go b/internal/gormlog/gormlog_test.go index 65b216c..a149ead 100644 --- a/internal/gormlog/gormlog_test.go +++ b/internal/gormlog/gormlog_test.go @@ -146,7 +146,7 @@ func openDB( } // assertBounded holds every line the adapter wrote to the stated -// ceiling and proves each was cut rather than merely short. +// ceiling and proves no line carried a whole client value. func assertBounded(t *testing.T, out string) { t.Helper() diff --git a/internal/handlers/logbound_test.go b/internal/handlers/logbound_test.go index 9d35dac..2072599 100644 --- a/internal/handlers/logbound_test.go +++ b/internal/handlers/logbound_test.go @@ -191,13 +191,12 @@ func receiverRouter(h *handlers.Handlers) *chi.Mux { return router } -// postReceiver sends one POST at /h/. +// postReceiver sends one POST with an empty body at /h/ +// through router and returns the response status. // // RawPath is cleared after parsing so chi routes on the decoded path // and the handler sees the raw bytes rather than their percent-escaped -// spelling. That is the harder case for the budget: the escaped -// spelling is plain ASCII, which costs one byte per byte, while the -// decoded bytes are what the log handler has to escape. +// spelling. func postReceiver( t *testing.T, router *chi.Mux, segment string, ) int { diff --git a/internal/middleware/middleware.go b/internal/middleware/middleware.go index 9b5b842..5b4a8c2 100644 --- a/internal/middleware/middleware.go +++ b/internal/middleware/middleware.go @@ -118,13 +118,13 @@ const ( // a caller on a parameterised route would supply, which is the // only way those caps can be pinned at all. // - // One writer in that set is not a handler's own slog call. The - // GORM adapter in internal/gormlog logs the statement with the - // client-chosen parameter already interpolated into it, which on - // the receiver and login lookups is exactly the value the budgets - // above exist for. Its widest line spends two logfield.MaxBytes - // budgets — the statement and the driver error — against a fixed - // portion smaller than this one's, and + // The GORM adapter in internal/gormlog writes through slog as well, + // though not from a handler. It logs each statement with its + // placeholders rather than the values bound to them (see its + // ParamsFilter), so the key a client sends to the receiver or login + // lookup does not reach its lines. Its widest line spends two + // logfield.MaxBytes budgets — the statement and the driver error — + // against a fixed portion smaller than this one's, and // internal/gormlog/gormlog_test.go asserts every line it emits // against this constant directly rather than leaving it as // arithmetic.