Surveyed 2026-08-07: make check on main fails with 94 lint findings
under golangci-lint 2.12.2 (the version installed for local dev). 47 of
them are noctx, all of the same shape: test code calling httptest.NewRequest instead of httptest.NewRequestWithContext.
Note: CI is currently green because the Dockerfile lint stage pins
golangci-lint v2.10.1, which does not report these. The findings are
real under the current linter and block a locally green make check;
CI parity is tracked separately (bump of the lint stage pin).
All 47 findings are in test files:
File
Findings
internal/handlers/handlers_test.go
26
internal/middleware/ratelimit_test.go
7
internal/handlers/api_test.go
6
internal/middleware/cors_test.go
3
internal/handlers/render_template_test.go
3
internal/service/auth/auth_test.go
2
Remediation: replace each httptest.NewRequest(...) with httptest.NewRequestWithContext(t.Context(), ...) (or the enclosing
test's context where a subtest closure already has one). Purely
mechanical; no production code changes.
Definition of done:
make lint (golangci-lint ≥ 2.12) reports zero noctx findings
total finding count drops from 94 to 47
make test passes unchanged; make fmt run before commit
TODO.md updated per the repo workflow (this is the current "Next
Step" there)
lands via PR from a feature branch off main
Surveyed 2026-08-07: `make check` on `main` fails with 94 lint findings
under golangci-lint 2.12.2 (the version installed for local dev). 47 of
them are `noctx`, all of the same shape: test code calling
`httptest.NewRequest` instead of `httptest.NewRequestWithContext`.
Note: CI is currently green because the `Dockerfile` lint stage pins
golangci-lint v2.10.1, which does not report these. The findings are
real under the current linter and block a locally green `make check`;
CI parity is tracked separately (bump of the lint stage pin).
All 47 findings are in test files:
| File | Findings |
| --- | --- |
| `internal/handlers/handlers_test.go` | 26 |
| `internal/middleware/ratelimit_test.go` | 7 |
| `internal/handlers/api_test.go` | 6 |
| `internal/middleware/cors_test.go` | 3 |
| `internal/handlers/render_template_test.go` | 3 |
| `internal/service/auth/auth_test.go` | 2 |
Remediation: replace each `httptest.NewRequest(...)` with
`httptest.NewRequestWithContext(t.Context(), ...)` (or the enclosing
test's context where a subtest closure already has one). Purely
mechanical; no production code changes.
Definition of done:
- `make lint` (golangci-lint ≥ 2.12) reports zero `noctx` findings
- total finding count drops from 94 to 47
- `make test` passes unchanged; `make fmt` run before commit
- `TODO.md` updated per the repo workflow (this is the current "Next
Step" there)
- lands via PR from a feature branch off `main`
clawbot
added this to the 1.1.0 milestone 2026-08-07 18:40:22 +02:00
Starting this now on a branch off current main (291f85f).
Definition of done for the PR:
all 47 noctx findings gone: every httptest.NewRequest call in
the six listed test files becomes httptest.NewRequestWithContext(t.Context(), ...) (using the
enclosing test's *testing.T)
make lint under golangci-lint 2.12.2: total findings drop from 94
to 47 (remaining: 23 gosec → #176/#177, 24 goconst → #178)
make test still green, make fmt run before commit, TODO.md
Next Step rotated per the repo workflow
before/after lint counts stated on the PR
Starting this now on a branch off current `main` (291f85f).
Definition of done for the PR:
- all 47 `noctx` findings gone: every `httptest.NewRequest` call in
the six listed test files becomes
`httptest.NewRequestWithContext(t.Context(), ...)` (using the
enclosing test's `*testing.T`)
- `make lint` under golangci-lint 2.12.2: total findings drop from 94
to 47 (remaining: 23 `gosec` → #176/#177, 24 `goconst` → #178)
- `make test` still green, `make fmt` run before commit, `TODO.md`
Next Step rotated per the repo workflow
- before/after lint counts stated on the PR
Done in PR #183 (branch fix-noctx-lint, commit 2164290): all 47 noctx findings resolved, make lint total 94 → 47, make test and make fmt-check green. Awaiting independent review (labeled
needs-review).
Done in PR #183 (branch `fix-noctx-lint`, commit 2164290): all 47
`noctx` findings resolved, `make lint` total 94 → 47, `make test` and
`make fmt-check` green. Awaiting independent review (labeled
needs-review).
Definition of done verified met on main (7a34fc9) — the fix landed
via #187 rather than PR #183, which is now closed as superseded:
make lint (pinned golangci-lint v2.12.2, canonical config): 0
findings, so zero noctx
every test-file request is httptest.NewRequestWithContext with t.Context(); grep over the main tree finds no remaining
context-less httptest.NewRequest( call sites
make check green in a clean worktree of main (tests with race
detector, lint, fmt-check)
Closing.
Definition of done verified met on `main` (7a34fc9) — the fix landed
via #187 rather than PR #183, which is now closed as superseded:
- `make lint` (pinned golangci-lint v2.12.2, canonical config): 0
findings, so zero `noctx`
- every test-file request is `httptest.NewRequestWithContext` with
`t.Context()`; grep over the `main` tree finds no remaining
context-less `httptest.NewRequest(` call sites
- `make check` green in a clean worktree of `main` (tests with race
detector, lint, `fmt-check`)
Closing.
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.
Surveyed 2026-08-07:
make checkonmainfails with 94 lint findingsunder golangci-lint 2.12.2 (the version installed for local dev). 47 of
them are
noctx, all of the same shape: test code callinghttptest.NewRequestinstead ofhttptest.NewRequestWithContext.Note: CI is currently green because the
Dockerfilelint stage pinsgolangci-lint v2.10.1, which does not report these. The findings are
real under the current linter and block a locally green
make check;CI parity is tracked separately (bump of the lint stage pin).
All 47 findings are in test files:
internal/handlers/handlers_test.gointernal/middleware/ratelimit_test.gointernal/handlers/api_test.gointernal/middleware/cors_test.gointernal/handlers/render_template_test.gointernal/service/auth/auth_test.goRemediation: replace each
httptest.NewRequest(...)withhttptest.NewRequestWithContext(t.Context(), ...)(or the enclosingtest's context where a subtest closure already has one). Purely
mechanical; no production code changes.
Definition of done:
make lint(golangci-lint ≥ 2.12) reports zeronoctxfindingsmake testpasses unchanged;make fmtrun before commitTODO.mdupdated per the repo workflow (this is the current "NextStep" there)
mainStarting this now on a branch off current
main(291f85f).Definition of done for the PR:
noctxfindings gone: everyhttptest.NewRequestcall inthe six listed test files becomes
httptest.NewRequestWithContext(t.Context(), ...)(using theenclosing test's
*testing.T)make lintunder golangci-lint 2.12.2: total findings drop from 94to 47 (remaining: 23
gosec→ #176/#177, 24goconst→ #178)make teststill green,make fmtrun before commit,TODO.mdNext Step rotated per the repo workflow
Done in PR #183 (branch
fix-noctx-lint, commit2164290): all 47noctxfindings resolved,make linttotal 94 → 47,make testandmake fmt-checkgreen. Awaiting independent review (labeledneeds-review).
Definition of done verified met on
main(7a34fc9) — the fix landedvia #187 rather than PR #183, which is now closed as superseded:
make lint(pinned golangci-lint v2.12.2, canonical config): 0findings, so zero
noctxhttptest.NewRequestWithContextwitht.Context(); grep over themaintree finds no remainingcontext-less
httptest.NewRequest(call sitesmake checkgreen in a clean worktree ofmain(tests with racedetector, lint,
fmt-check)Closing.
clawbot referenced this issue2026-09-03 18:29:27 +02:00