The shared .golangci.yml that #504 vendors states that test-support code must not be compiled into the shipped binary, and its test-supportdepguard rule enforces that for packages a repository names in its deny list. In this repository the test helpers live in ordinary non-test files inside the production packages, so the rule cannot see them and they are built into the binary:
internal/config/testing.go (ClearEnvForTest), which imports testing from a non-test file;
Found by the independent review of #505; out of that PR's scope.
Definition of done
No non-test file in a production package exists only to serve tests. Each helper moves into a _test.go file where only its own package's tests use it, or into a test-support package whose full import path is added to the test-support rule's deny list in .golangci.yml (the one list there a repository may edit).
Production code gains no exported constructor or field that only tests need; where a test-support package must build a value with unexported fields, the smallest plain change is chosen and disclosed.
Every test still exercises the same production code it did; make check and make test-browser pass.
Starts after #505 lands, since both change .golangci.yml.
Model: opus-5-5
The shared `.golangci.yml` that https://git.eeqj.de/sneak/webhooker/issues/504 vendors states that test-support code must not be compiled into the shipped binary, and its `test-support` `depguard` rule enforces that for packages a repository names in its deny list. In this repository the test helpers live in ordinary non-test files inside the production packages, so the rule cannot see them and they are built into the binary:
- `internal/config/testing.go` (`ClearEnvForTest`), which imports `testing` from a non-test file;
- `internal/database/testing.go` (`NewTestDatabase`, `NewTestWebhookDBManager`, `NewTestWebhookDBManagerWithLogger`);
- `internal/middleware/testing.go` (`NewForTest`);
- `internal/session/testing.go` (`NewStore`, `NewForTest`).
Found by the independent review of https://git.eeqj.de/sneak/webhooker/pulls/505; out of that PR's scope.
## Definition of done
- No non-test file in a production package exists only to serve tests. Each helper moves into a `_test.go` file where only its own package's tests use it, or into a test-support package whose full import path is added to the `test-support` rule's `deny` list in `.golangci.yml` (the one list there a repository may edit).
- Production code gains no exported constructor or field that only tests need; where a test-support package must build a value with unexported fields, the smallest plain change is chosen and disclosed.
- Every test still exercises the same production code it did; `make check` and `make test-browser` pass.
- Starts after https://git.eeqj.de/sneak/webhooker/pulls/505 lands, since both change `.golangci.yml`.
Model: opus-5-5
clawbot
self-assigned this 2026-10-06 03:26:35 +02:00
#512 removes the four testing.go files. ClearEnvForTest moves to internal/config/configtest; the webhook database manager helpers move to internal/database/databasetest and the middleware's NewForTest to internal/middleware/middlewaretest, both now built through the production constructors; NewTestDatabase gives way to database.Open; the session's helpers move into the session package's own export_test.go, and the middleware tests build their session through session.New. The three new packages are in the test-support deny list.
Judgement call: the session, the middleware and the webhook database manager now take the *slog.Logger they log through instead of the logger wrapper, and the application provides it from the wrapper. No exported constructor accepted a caller's logger, and tests in other packages capture these logs.
Judgement call: the middleware's idle-expiry tests move the session's two timestamps back through Get and Save instead of advancing a fake clock, and the refresh test's later step is a minute short of the idle window rather than a second.
Deviation: internal/config/testing_test.go stays in internal/config, because it uses that package's own test hooks.
Unverified: the CI run for the head commit has not started. The runner has taken no job for this repository since about 05:32 UTC, the runs for next included.
Model: opus-5-5
https://git.eeqj.de/sneak/webhooker/pulls/512 removes the four `testing.go` files. `ClearEnvForTest` moves to `internal/config/configtest`; the webhook database manager helpers move to `internal/database/databasetest` and the middleware's `NewForTest` to `internal/middleware/middlewaretest`, both now built through the production constructors; `NewTestDatabase` gives way to `database.Open`; the session's helpers move into the session package's own `export_test.go`, and the middleware tests build their session through `session.New`. The three new packages are in the `test-support` deny list.
- Judgement call: the session, the middleware and the webhook database manager now take the `*slog.Logger` they log through instead of the logger wrapper, and the application provides it from the wrapper. No exported constructor accepted a caller's logger, and tests in other packages capture these logs.
- Judgement call: the middleware's idle-expiry tests move the session's two timestamps back through `Get` and `Save` instead of advancing a fake clock, and the refresh test's later step is a minute short of the idle window rather than a second.
- Deviation: `internal/config/testing_test.go` stays in `internal/config`, because it uses that package's own test hooks.
- Unverified: the CI run for the head commit has not started. The runner has taken no job for this repository since about 05:32 UTC, the runs for `next` included.
Model: opus-5-5
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.
The shared
.golangci.ymlthat #504 vendors states that test-support code must not be compiled into the shipped binary, and itstest-supportdepguardrule enforces that for packages a repository names in its deny list. In this repository the test helpers live in ordinary non-test files inside the production packages, so the rule cannot see them and they are built into the binary:internal/config/testing.go(ClearEnvForTest), which importstestingfrom a non-test file;internal/database/testing.go(NewTestDatabase,NewTestWebhookDBManager,NewTestWebhookDBManagerWithLogger);internal/middleware/testing.go(NewForTest);internal/session/testing.go(NewStore,NewForTest).Found by the independent review of #505; out of that PR's scope.
Definition of done
_test.gofile where only its own package's tests use it, or into a test-support package whose full import path is added to thetest-supportrule'sdenylist in.golangci.yml(the one list there a repository may edit).make checkandmake test-browserpass..golangci.yml.Model: opus-5-5
#512 removes the four
testing.gofiles.ClearEnvForTestmoves tointernal/config/configtest; the webhook database manager helpers move tointernal/database/databasetestand the middleware'sNewForTesttointernal/middleware/middlewaretest, both now built through the production constructors;NewTestDatabasegives way todatabase.Open; the session's helpers move into the session package's ownexport_test.go, and the middleware tests build their session throughsession.New. The three new packages are in thetest-supportdeny list.*slog.Loggerthey log through instead of the logger wrapper, and the application provides it from the wrapper. No exported constructor accepted a caller's logger, and tests in other packages capture these logs.GetandSaveinstead of advancing a fake clock, and the refresh test's later step is a minute short of the idle window rather than a second.internal/config/testing_test.gostays ininternal/config, because it uses that package's own test hooks.nextincluded.Model: opus-5-5