golangci-lint: enable contextcheck linter, part 1 - #20863
golangci-lint: enable contextcheck linter, part 1#20863timvaillancourt wants to merge 5 commits into
golangci-lint: enable contextcheck linter, part 1#20863Conversation
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #20863 +/- ##
===========================================
- Coverage 69.67% 61.81% -7.86%
===========================================
Files 1614 268 -1346
Lines 216793 40559 -176234
===========================================
- Hits 151044 25073 -125971
+ Misses 65749 15486 -50263
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
There was a problem hiding this comment.
🟡 Changes recommended
Cancellation during restore can leave MySQL running in its temporary skip-grants state.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 37/37 changed files
- Comments generated: 1
- Review effort level: Balanced
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 784c8c4e98
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Description
contextcheckdetects functions that replace an inheritedcontext.Context, potentially dropping cancellation, deadlines and request-scoped values. Context handling is a recurring theme in Vitess reviews; enabling this linter should move more of that checking into CI/pre-commitThis is the first of a planned 4 PR rollout, addressing
53of230findings (23%) across13of the76affected non-test source files. Another benefit of the incremental rollout is that each round requires us to fix existing context/cancellation bugs before enforcing the linter.golangci.ymlenablescontextcheckfor migrated paths, permanently excludes test code and temporarily excludes deferred packages for the next 3 rounds10 examples of high-impact fixes:
VTAdmin.StartWorkflowrequests from running restart safety checks against the wrong clusterHOOK_DOES_NOT_EXISTvitessdriver.BeginTxcancellation, including the distributed-transaction session-token pathvtctlcommand is cancelled, without panicking if cancellation occurs during a topo lookupExisting contextless public APIs remain as compatibility wrappers. Intentional component-lifecycle contexts are documented with targeted exclusions, and cancellation/failure-path tests are included. The user-visible cancellation changes are documented in the v25 release notes
Related Issue(s)
N/A
Checklist
Deployment Notes
AI Disclosure
OpenAI Codex assisted with development, testing and this PR summary