Skip to content

ci: re-run the basedpyright budget gate on push to long-lived branches - #31105

Closed
mateo-berri wants to merge 1 commit into
litellm_internal_stagingfrom
claude/lint-issue-investigation-uv6zsc
Closed

mateo-berri wants to merge 1 commit into
litellm_internal_stagingfrom
claude/lint-issue-investigation-uv6zsc

Conversation

@mateo-berri

Copy link
Copy Markdown
Contributor

Relevant issues

Follow-up to the reportReturnType budget breach that turned the LiteLLM Linting check red on every PR branched off litellm_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 in basedpyright-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 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 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 push trigger on the long-lived branches (main, litellm_internal_staging, litellm_oss_branch, litellm_**) and a post-merge-budget job 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 existing pull_request jobs (lint, budget-ratchet, secret-scan) are guarded with if: 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 a post-merge-budget job 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

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mateo-berri
mateo-berri marked this pull request as ready for review June 23, 2026 15:53
@mateo-berri
mateo-berri requested a review from a team June 23, 2026 15:53
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

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.
@mateo-berri
mateo-berri force-pushed the claude/lint-issue-investigation-uv6zsc branch from 374c88e to 8f20f20 Compare June 23, 2026 15:56
@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This 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.

  • Adds a push trigger on the long-lived protected branches and a new post-merge-budget job that runs type_check_gate.py against the post-merge tree, surfacing budget breaches on the merge commit rather than on the next PR.
  • Guards the three existing jobs (lint, budget-ratchet, secret-scan) with if: github.event_name == 'pull_request' so their delta-vs-base steps (which require pull_request.base.sha) are not attempted on push events.

Confidence Score: 4/5

This 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.

Important Files Changed

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

Comment on lines +192 to +211
- 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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.

Suggested change
- 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!

@mateo-berri
mateo-berri deleted the claude/lint-issue-investigation-uv6zsc branch June 23, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants