fix: resolve all 47 noctx lint findings in tests (closes #175) #183

Closed
clawbot wants to merge 1 commits from fix-noctx-lint into main
Collaborator

Fixes the largest of the three lint classes blocking a green
make check under current golangci-lint (issue #175).

What changed

  • every httptest.NewRequest(...) call in test code is now
    httptest.NewRequestWithContext(t.Context(), ...), wrapped
    multiline where the single-line form would exceed the 88-column
    lll limit
  • createSetupFormRequest and createLoginFormRequest in
    internal/handlers/handlers_test.go now take t *testing.T (and
    call t.Helper()) so they can supply the test context; all call
    sites updated
  • TODO.md Status/Next Step/Completed/Future rotated per the repo
    workflow, now pointing at the issue backlog (#175–#182)

No production code is touched.

Lint counts (golangci-lint 2.12.2)

before after
noctx 47 0
gosec 23 23 (tracked in #176, #177)
goconst 24 24 (tracked in #178)
total 94 47

make test passes (race detector on), make fmt run,
make fmt-check clean. CI (script/cibuild, pinned golangci-lint
v2.10.1) was already green and stays green; the pin bump to enforce
the stricter set in CI is #179.

Note for reviewers: make fmt on this tree wants to reformat the
vendored static/js/alpine.min.js (no .prettierignore exists) and
script/bootstrap does not install goimports which script/fmt
requires — both left untouched here and will be filed as separate
issues.

Fixes the largest of the three lint classes blocking a green `make check` under current golangci-lint (issue #175). ## What changed - every `httptest.NewRequest(...)` call in test code is now `httptest.NewRequestWithContext(t.Context(), ...)`, wrapped multiline where the single-line form would exceed the 88-column `lll` limit - `createSetupFormRequest` and `createLoginFormRequest` in `internal/handlers/handlers_test.go` now take `t *testing.T` (and call `t.Helper()`) so they can supply the test context; all call sites updated - `TODO.md` Status/Next Step/Completed/Future rotated per the repo workflow, now pointing at the issue backlog (#175–#182) No production code is touched. ## Lint counts (golangci-lint 2.12.2) | | before | after | | --- | --- | --- | | `noctx` | 47 | 0 | | `gosec` | 23 | 23 (tracked in #176, #177) | | `goconst` | 24 | 24 (tracked in #178) | | **total** | **94** | **47** | `make test` passes (race detector on), `make fmt` run, `make fmt-check` clean. CI (`script/cibuild`, pinned golangci-lint v2.10.1) was already green and stays green; the pin bump to enforce the stricter set in CI is #179. Note for reviewers: `make fmt` on this tree wants to reformat the vendored `static/js/alpine.min.js` (no `.prettierignore` exists) and `script/bootstrap` does not install `goimports` which `script/fmt` requires — both left untouched here and will be filed as separate issues.
clawbot added 1 commit 2026-08-07 18:47:29 +02:00
fix: resolve all 47 noctx lint findings in tests
All checks were successful
Check / check (pull_request) Successful in 3m10s
21642900e6
Replace every httptest.NewRequest call with
httptest.NewRequestWithContext using the test's t.Context(). Thread
t *testing.T through the createSetupFormRequest and
createLoginFormRequest helpers so they can supply a context.

make lint under golangci-lint 2.12.2 drops from 94 findings to 47
(remaining: 23 gosec, 24 goconst, tracked in #176/#177/#178). make
test and make fmt-check pass unchanged.

Closes #175
clawbot added the needs-review label 2026-08-07 18:47:32 +02:00
clawbot self-assigned this 2026-08-07 18:47:33 +02:00
clawbot added this to the 1.1.0 milestone 2026-08-07 18:47:33 +02:00
Owner

@clawbot please fix

@clawbot please fix
Author
Collaborator

Manager note (independent verification, not authored by this PR's implementer):

This PR is fully superseded by #187 (commit 7a34fc9, merged to main
2026-08-07 22:21), which contains the identical remediation for issue
#175: every test-file httptest.NewRequest call is now
httptest.NewRequestWithContext with t.Context().

Verified on current main (7a34fc9) in a clean worktree with the
pinned toolchain (golangci-lint v2.12.2, via make targets only):

  • make check green: tests pass (race detector on), lint reports
    0 issues, fmt-check clean
  • zero remaining httptest.NewRequest( call sites without a context
    anywhere under internal/ (grep over the main tree)

A rebase of fix-noctx-lint onto main therefore produces an empty
diff — there is nothing left to merge or review. Closing as
superseded rather than reworking; issue #175's definition of done is
met by main and is being closed with reference to #187.

Branch fix-noctx-lint is left on the remote untouched.

Manager note (independent verification, not authored by this PR's implementer): This PR is fully superseded by #187 (commit 7a34fc9, merged to `main` 2026-08-07 22:21), which contains the identical remediation for issue #175: every test-file `httptest.NewRequest` call is now `httptest.NewRequestWithContext` with `t.Context()`. Verified on current `main` (7a34fc9) in a clean worktree with the pinned toolchain (golangci-lint v2.12.2, via `make` targets only): - `make check` green: tests pass (race detector on), lint reports 0 issues, `fmt-check` clean - zero remaining `httptest.NewRequest(` call sites without a context anywhere under `internal/` (grep over the `main` tree) A rebase of `fix-noctx-lint` onto `main` therefore produces an empty diff — there is nothing left to merge or review. Closing as superseded rather than reworking; issue #175's definition of done is met by `main` and is being closed with reference to #187. Branch `fix-noctx-lint` is left on the remote untouched.
clawbot closed this pull request 2026-08-07 22:27:10 +02:00
All checks were successful
Check / check (pull_request) Successful in 3m10s
Required
Details

Pull request closed

Sign in to join this conversation.