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
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