Say the query logger drops bound values #551

Merged
clawbot merged 1 commits from issue-535-query-log-comment into next 2026-10-15 18:57:59 +02:00
3 changed files with 13 additions and 15 deletions
Showing only changes of commit 9bc6c597b6 - Show all commits
+1 -1
View File
@@ -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()
+3 -4
View File
@@ -191,13 +191,12 @@ func receiverRouter(h *handlers.Handlers) *chi.Mux {
return router
}
// postReceiver sends one POST at /h/<segment>.
// postReceiver sends one POST with an empty body at /h/<segment>
// 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 {
+9 -10
View File
@@ -115,16 +115,15 @@ 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
// internal/gormlog/gormlog_test.go asserts every line it emits
// against this constant directly rather than leaving it as
// arithmetic.
// The GORM adapter in internal/gormlog writes through slog as well.
// 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.
//
// What it does NOT cover, so that the figure above is not read as
// more than it is: