improvement(ci): scan CodeQL PRs at the promotion boundary, refresh main daily - #7213
Merged
waleedlatif1 merged 1 commit intoAug 28, 2026
Merged
Conversation
…ain daily Feature PRs land on staging and are ~90% of PR scan volume (90 of the last 100 PRs target staging, 4 target main). Every one of them is scanned again — against the exact tree being promoted — when the staging->main PR opens, so restricting PR scans to main defers the signal to the promotion boundary rather than dropping it. No ruleset or branch protection requires a CodeQL check, and the alert view is fed by the push-to-main and scheduled analyses, not by PR runs. Deliberately a branch cut rather than an activity-type cut. Dropping `synchronize` would have cut a similar share of runs, but it scans a PR's first commit and never its final state — backwards, since review fixups land in later pushes. The scheduled scan moves from weekly to daily. Pushes to main are rare, so with PR scans limited to main the default-branch alert view leans on the cron more than it used to, and a week is too long to leave it stale. It also reseeds the overlay-base database that PR runs restore from: that cache key embeds the CodeQL bundle version, so a bundle bump invalidates it, and an unused Actions cache is evicted after 7 days. Also records, in codeql-config.yml, why the obvious speed-up is a trap: adding `queries:`/`packs:`/`query-filters:` trips OverlayDisabledReason.NonDefaultQueries and permanently disables overlay analysis, trading a documented up-to-10x win on the extraction phase (~53% of a run) for a few percent off the query phase.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryThis PR moves pull-request CodeQL analysis from the staging merge boundary to main promotion and increases default-branch scans from weekly to daily.
Confidence Score: 4/5The PR appears safe to merge, though the daily schedule should avoid canceling overlapping main analyses. The trigger changes are coherent, but scheduled and push-to-main runs share a cancellation-enabled concurrency group, so an overlap can prevent one intended analysis from completing. Files Needing Attention: .github/workflows/codeql.yml
|
| Filename | Overview |
|---|---|
| .github/workflows/codeql.yml | Narrows PR scanning to main and makes scheduled scans daily; overlapping scheduled and main-push runs can cancel one another through their shared concurrency group. |
| .github/codeql/codeql-config.yml | Adds documentation warning against query configuration that would disable overlay analysis, without changing scan behavior. |
Reviews (1): Last reviewed commit: "improvement(ci): scan CodeQL PRs at the ..." | Re-trigger Greptile
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.
Summary
CodeQL runs ~3,090 times a month and costs ~$382/mo across both languages. 90 of the last 100 PRs target
staging, and every one of those is scanned again — against the exact tree being promoted — when thestaging→mainPR opens.main. This defers the signal to the promotion boundary rather than dropping it. Verified safe: no ruleset or branch protection requires a CodeQL status check (all four rulesets carry onlypull_request/deletion/non_fast_forward), and the code-scanning alert view is fed by the push-to-mainand scheduled analyses — PR analyses upload againstrefs/pull/N/mergeand only ever surface as PR annotations.synchronizewould have cut a similar share, but it scans a PR's first commit and never its final state — backwards, since review fixups land in later pushes.mainare rare, so with PR scans limited tomainthe alert view leans on the cron more than before. It also reseeds the overlay-base database (see below). Costs a few dollars a month.codeql-config.yml: addingqueries:/packs:/query-filters:tripsOverlayDisabledReason.NonDefaultQueriesand permanently disables overlay analysis — trading a documented up-to-10x win for a few percent.Follow-up, not fixed here
The scan is slow for a reason unrelated to scope: the overlay-base database uploads on every push to
mainand never restores on a PR run. Observed 4/4 misses against a byte-identical cache key:...49 minutes after a run logged
Successfully uploaded overlay-base databasewith a key matching that prefix exactly. Phase timings show extraction is 118s of a 221s run (53%) — precisely what overlay skips. GitHub's cache API holds zero overlay entries, so the multi-GB base is going into the runner provider's transparent cache rather than GitHub's. Fixing that restore is worth roughly half of every PR scan and is tracked separately.Type of Change
Testing
actionlintclean. Verified the parsed triggers (pull_request.branches: [main], unchangedtypes,push: [main], daily cron) and that both matrix languages still expand.bun run lintand all 38check:auditspass.Checklist