Repository navigation
chore(lint): enable contextcheck in golangci-lint - #1783
mbrandenburger merged 2 commits into
Conversation
Enabling contextcheck surfaced 43 findings, all in the root module. 2 were genuine bugs (a stray context.TODO() and an unused-ctx test double) and are threaded through with no behavior change. The other 41 are deliberate context detachment - background work, pooled connections/streams, and trace-correlation logging that must outlive or not derive from the call that happens to trigger them - and are suppressed with a reason: - 24 findings in the p2p comm layer (cached/pooled websocket sub-connections, streams, and sessions whose lifecycle is independent of any single call, regression-tested by context_detachment_test.go) share one config exclusion in .golangci.yml rather than 24 scattered nolints. - 17 findings elsewhere (nil-ctx fallbacks, trace-link/log correlation against a different originating context, shared broadcast/delivery streams, uncancellable error reporting) get individual //nolint:contextcheck comments, each naming the specific reason. No DEFERRED or AMBIGUOUS findings: every site traced back to an already-latent, often already-documented design rationale. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
|
Hey @mbrandenburger 👋 thanks for the PR! This comment updates automatically as you push changes -- think of it as your PR's live scoreboard! PR Checks✅ DCO Sign-off -- All commits have valid sign-offs. Nice work! ✅ GPG Signature -- All commits have verified GPG signatures. Locked and loaded! ✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing! ❌ Issue Link -- This PR is not linked to any issue. Please reference an issue using a closing keyword (e.g. ⏳ All checks must pass before this PR can be reviewed. You've got this! |
|
Tick the box to add this pull request to the merge queue (same as
|
|
Hi @mbrandenburger 👋 — the recent merge of PR #1782 has introduced a merge conflict in this PR. Please resolve the merge conflict so that this PR can be reviewed again. Thank you! |
Signed-off-by: Marcus Brandenburger <mbrandenburger@users.noreply.github.com>
contextcheckflags a function that receives acontext.Contextbut doesn't pass it through to a call that itself takes one — instead usingcontext.Background()/context.TODO(), a nested detached context, or (missed) propagation.Part of #1755.
Scoping
43 findings, all in the root module. 2 were genuine bugs (a stray
context.TODO()and an unused-ctxtest double) and are threaded through with no behavior change. The other 41 are deliberate context detachment — background work, pooled connections/streams, and trace-correlation logging that must outlive or not derive from the call that happens to trigger them — and are suppressed with a reason.context_detachment_test.go) share one config exclusion in.golangci.ymlrather than 24 scattered//nolints.//nolint:contextcheckcomments, each naming the specific reason.No deferred or ambiguous findings — every site traced back to an already-latent, often already-documented design rationale.
Verification
make checksexits 0 across all four modules.Note for reviewers
This branch is independent — rooted directly on current
main, not stacked on any other wave-4 PR. It should merge cleanly regardless of the order the other wave-4 PRs land in.