Repository navigation
ci: re-run the basedpyright budget gate on push to long-lived branches - #31105
mateo-berri wants to merge 1 commit into
Conversation
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…anches The basedpyright budget gate counts codebase-wide errors per rule against a committed ceiling, but it only ran on pull_request against each PR's own head. Two PRs that each pass in isolation can together push a per-rule count over its ceiling once both merge, and nothing re-evaluated the budget on the merge commit, so the breach only surfaced on the next PR that happened to be checked out after the count crossed the line. Add a push trigger on the long-lived branches and a post-merge-budget job that re-runs the absolute gate on the merged tree, catching the accumulation on the merge commit itself. The existing pull_request jobs are guarded so their delta-vs-base gates don't misfire on push, where no PR base SHA exists.
374c88e to
8f20f20
Compare
Greptile SummaryThis PR closes a gap in the CI budget enforcement strategy: the absolute basedpyright per-rule budget was only evaluated against each PR's head in isolation, so two independently-passing PRs could together breach the ceiling once both merged, with the failure only appearing on the next unrelated PR.
Confidence Score: 4/5This is a CI-only change with no application code modifications; the new job is purely additive and cannot regress existing behavior. The logic is sound and well-documented. The only thing worth a second look is fetch-depth: 0 in the new job, which pulls full git history when only the current working tree is needed for the absolute type-check. post-merge-budget job in .github/workflows/test-linting.yml — specifically the fetch-depth: 0 in the checkout step.
|
| Filename | Overview |
|---|---|
| .github/workflows/test-linting.yml | Adds a push trigger and a new post-merge-budget job that re-runs the absolute basedpyright gate on merged commits; guards existing PR-only jobs with event filters. Minor: fetch-depth: 0 in the new job fetches unnecessary full history. |
Reviews (1): Last reviewed commit: "ci: re-run absolute basedpyright budget ..." | Re-trigger Greptile
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 | ||
| with: | ||
| version: "0.10.9" | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| uv sync --frozen | ||
|
|
||
| - name: Re-check basedpyright per-rule budget on the merged tree |
There was a problem hiding this comment.
fetch-depth: 0 fetches the entire git history (all branches and tags), but post-merge-budget only runs an absolute basedpyright check against the current working tree — no git-diffing or ancestor lookups are needed. Using the default shallow clone (fetch-depth: 1) is sufficient here and avoids pulling potentially large history on every push to long-lived branches.
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 | |
| with: | |
| version: "0.10.9" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --frozen | |
| - name: Re-check basedpyright per-rule budget on the merged tree | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| persist-credentials: false | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 | |
| with: | |
| version: "0.10.9" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --frozen | |
| - name: Re-check basedpyright per-rule budget on the merged tree |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Relevant issues
Follow-up to the
reportReturnTypebudget breach that turned the LiteLLM Linting check red on every PR branched offlitellm_internal_staging(for example #30446, fixed in #31103). That was a symptom; this PR closes the hole that let it land in the first place.Root cause
The basedpyright gate (
scripts/type_check_gate.py) counts absolute codebase-wide errors per rule against a committed ceiling inbasedpyright-code-budget.json. Unlike the ruff and type-discipline gates it is not a delta-vs-base check; it judges the whole tree. But the linting workflow only ran it onpull_request, against each PR's own head. Two PRs that each pass in isolation can together push a per-rule count over its ceiling once both merge, and nothing re-evaluated the budget on the merge commit. So the breach stayed invisible until the next PR happened to be checked out after the count had already crossed the line, at which point an unrelated PR inherited a red that it did nothing to cause. Green apart, red together.Fix
Add a
pushtrigger on the long-lived branches (main,litellm_internal_staging,litellm_oss_branch,litellm_**) and apost-merge-budgetjob that re-runs the absolute basedpyright gate on the merged tree. Accumulation now turns the branch red on the merge commit itself instead of ambushing the next PR. The existingpull_requestjobs (lint,budget-ratchet,secret-scan) are guarded withif: github.event_name == 'pull_request'so their delta-vs-base steps, which need a PR base SHA that does not exist on push, don't misfire.Complementary and out of scope for this repo change: enabling "Require branches to be up to date before merging" in branch protection for staging would force each PR to re-test against the latest base before landing, which would have caught this on the PR side too.
Type
🚄 Infrastructure
Changes
.github/workflows/test-linting.yml: add a push trigger and apost-merge-budgetjob that re-runs the absolute basedpyright gate on long-lived branches; scope the pull_request-only jobs with an event guard. No application code changes.Generated by Claude Code