Six test-only gorm.Open calls still pass a bare gorm.Config #462

Closed
opened 2026-10-02 18:54:20 +02:00 by clawbot · 2 comments
Collaborator

Split out of #232, which listed it as "also worth folding in" after its definition of done.

Six test-only gorm.Open calls in internal/delivery (archive_sweeper_test.go three times, engine_test.go, engine_integration_test.go, target_database_test.go) still pass a bare &gorm.Config{} instead of a logger built by gormlog.New. No secrets are involved, since they open fixture data only, and every production gorm.Open goes through gormlog.New. But the unfiltered idiom stays in the tree to be copied into production code.

Definition of done

  • No gorm.Open in the tree uses a bare &gorm.Config{}: the test sites use gormlog.New over a logger that discards, or a test helper that already does.
  • Nothing else changes.

Model: opus-5-5

Split out of https://git.eeqj.de/sneak/webhooker/issues/232, which listed it as "also worth folding in" after its definition of done. Six test-only `gorm.Open` calls in `internal/delivery` (`archive_sweeper_test.go` three times, `engine_test.go`, `engine_integration_test.go`, `target_database_test.go`) still pass a bare `&gorm.Config{}` instead of a logger built by `gormlog.New`. No secrets are involved, since they open fixture data only, and every production `gorm.Open` goes through `gormlog.New`. But the unfiltered idiom stays in the tree to be copied into production code. ## Definition of done - No `gorm.Open` in the tree uses a bare `&gorm.Config{}`: the test sites use `gormlog.New` over a logger that discards, or a test helper that already does. - Nothing else changes. Model: opus-5-5
Author
Collaborator

Also in scope, found by the review of #456: the sentence saying the tree has one test-only (*gorm.DB).Scan caller is stale in README.md (around line 2611) and in the comment in internal/gormlog/gormlog.go (lines 114 to 116); correct both.

Model: opus-5-5

Also in scope, found by the review of https://git.eeqj.de/sneak/webhooker/pulls/456: the sentence saying the tree has one test-only `(*gorm.DB).Scan` caller is stale in `README.md` (around line 2611) and in the comment in `internal/gormlog/gormlog.go` (lines 114 to 116); correct both. Model: opus-5-5
Author
Collaborator

Done in #466.

The six gorm.Open calls in the internal/delivery tests now pass gormlog.New over an slog logger that discards, so no gorm.Open in the tree uses a bare gorm.Config any more. The stale sentence about (*gorm.DB).Scan having one test-only caller is corrected in README.md and in the ParamsFilter comment in internal/gormlog/gormlog.go.

  • Judgement call: the corrected sentence says only tests call Scan and what a test binds is fixture data, rather than listing the callers by file and line, so it does not go stale again when a test adds one.
  • Judgement call: the test sites build the discarding logger inline; the package's existing test logger writes every statement to standard error at debug level, so it does not discard.

Model: opus-5-5

Done in https://git.eeqj.de/sneak/webhooker/pulls/466. The six `gorm.Open` calls in the `internal/delivery` tests now pass `gormlog.New` over an `slog` logger that discards, so no `gorm.Open` in the tree uses a bare `gorm.Config` any more. The stale sentence about `(*gorm.DB).Scan` having one test-only caller is corrected in `README.md` and in the `ParamsFilter` comment in `internal/gormlog/gormlog.go`. - Judgement call: the corrected sentence says only tests call `Scan` and what a test binds is fixture data, rather than listing the callers by file and line, so it does not go stale again when a test adds one. - Judgement call: the test sites build the discarding logger inline; the package's existing test logger writes every statement to standard error at debug level, so it does not discard. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#462