Repository navigation
ci: add make static-check-changed for fast local SCA - #33012
Merged
Merged
Conversation
Run molint and golangci-lint only on the packages affected by the working tree's changes since the merge base with STATIC_CHECK_BASE (default upstream/main, else origin/main). Selection reuses the PR CI selector; untracked inputs count as changes, and a missing base, config/build edits or a closure reaching half the graph fall back to the full graph. make static-check remains the full gate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Contributor
|
This pull request is merged. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #29249
What this PR does / why we need it:
make static-checkalways lints all of./.... From a cold cache that takes 20+ minutes (golangci-lint alone took about 21 minutes on CI). PR CI already narrows the lint to the affected packages with.github/ci/static-analysis.cjs, but that selector only runs inside GitHub Actions. This PR adds a local way to use it.make static-check-changedfinds the files changed since the merge base withSTATIC_CHECK_BASE. It counts commits, staged, unstaged and untracked files. The base defaults toupstream/main, ororigin/mainif there is noupstreamremote. It then picks packages with the sameselectPackageslogic CI uses, and runs molint and golangci-lint throughstatic-check-selected.It falls back to the full graph in the same cases CI does: build or analyzer config changes, or affected packages reaching half the graph. It also falls back when the base can't be found. It is a local fast path, not a gate;
make static-checkand the CI selection are unchanged.Selection examples (502 packages in total):
pkg/sql/colexec/grouppkg/frontendpkg/container/vectorChanges:
static-analysis.cjs: newlocalChanges(), used whenSCA_LOCAL_BASEis set. Untracked files the local diff reports as added also pass the tracked-source check. Git-ignored Go inputs still force a full scan.Makefile:static-check-changedtarget and theSTATIC_CHECK_BASEdefault.static-analysis.test.cjs: a unit test forlocalChanges(). The existing real-Make fixture now also covers a narrowed selection, an untracked file, a missing base, and analyzer failure propagation..github/ci/README.md: documents the target.Testing:
node --test .github/ci/*.test.cjs: 52 of 52 pass.make static-check-changedon this branch exits 0. It runs a full scan because the change touches.github/ci/.🤖 Generated with Claude Code