Repository navigation
chore(lint): stop ratcheting *-budget.json on PR branches - #39937
Conversation
…f PR branches Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThis PR moves lint-budget ratcheting from contributor branches to a write-capable workflow on
Confidence Score: 4/5The PR is not safe to merge until each workflow run measures a head fixed to its own push range and the new ratchet behavior has regression coverage. A realistic timing window lets an older run check out code from a later push while retaining its original base, causing the later push's reductions to be applied once by each run and potentially driving limits below current counts. Files Needing Attention: .github/workflows/ratchet-budgets.yml, tests/test_litellm/test_test_quality_gate.py
|
| Filename | Overview |
|---|---|
| .github/workflows/ratchet-budgets.yml | Adds the staging ratchet workflow, but its branch-tip checkout can make concurrent push ranges overlap and double-apply reductions. |
| scripts/test_quality_gate.py | Removes PR-side stale-ceiling enforcement and retains update-mode delta ratcheting for the staging workflow. |
| tests/test_litellm/test_test_quality_gate.py | Removes obsolete unratcheted tests without replacing them with coverage of the workflow now responsible for ratcheting. |
| CLAUDE.md | Updates contributor guidance consistently with the intended staging-only ratchet process. |
Reviews (1): Last reviewed commit: "ci(lint): ratchet *-budget.json on litel..." | Re-trigger Greptile
| steps: | ||
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | ||
| with: | ||
| ref: litellm_internal_staging |
There was a problem hiding this comment.
If a second push lands after an older ratchet run starts but before its checkout resolves, the older run checks out the newer branch tip while keeping its original event's before SHA as the base. It then ratchets fixes from both pushes, and the second push's own run ratchets its fixes again. Because each gate subtracts the measured reduction from the existing limit, this can count the same fixes twice and lower staging limits below the actual violation counts.
| @@ -73,29 +71,6 @@ def test_ratchet_lowers_a_rule_introduced_on_this_branch_like_any_other(): | |||
| assert updated["TQ001"]["limit"] == 4 | |||
|
|
|||
|
|
|||
There was a problem hiding this comment.
These changes remove the previous ratchet-enforcement tests without adding coverage for the workflow that now owns this behavior. No test models queued push ranges or verifies that each fix is applied exactly once. This violates the repository directive that modifications to existing tests must not weaken regression coverage, so replacement coverage is required before merging.
Rule Used: What: Flag any modifications to existing tests and... (source)
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!
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…cheduled automation Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
168a005
into
litellm_internal_staging
TLDR
Problem this solves:
*-budget.jsonlimits"limit"lines, so nearly every PR hits a merge conflicttest_quality_gate.pyeven fails a PR that did not ratchet, forcing the editHow it solves it:
make lint-budget-updateon a PR branchtest_quality_gate.pydrops its "you must ratchet" failure and its unusedtouches_measured_treebase scanlitellm_internal_staging(set up separately, not in this repo)User Flow
Before: a contributor with two open PRs that both fix
Finalannotations cannot merge the second onelitellm_internal_staging, each fixing a few LIT010 violations and each committingtype-discipline-budget.jsonwith a lowered LIT010 limit as CLAUDE.md requiredAfter: the same two PRs merge back to back with no conflict
Relevant issues
Slack thread in #eng, 2026-09-05, "this file is frequently causing merge conflicts on all of my PRs"
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Behavior change is in the CI gate, so the proof is the gate command the automation and CI run
After (bf38443)
BASE=$(git rev-parse origin/litellm_internal_staging~8)(86e54a0)uv run --no-sync python scripts/type_discipline_gate.py --update --base "$BASE"Ratcheted LIT-rule limits down by 3 violations this branch fixed(32s wall clock), diff lowers LIT001 22180 -> 22179 and LIT004 38 -> 36. This is the command the automation runs against the last ratchet commituv run --no-sync pytest -q tests/test_litellm/test_test_quality_gate.py tests/test_litellm/test_budget_ratchet_check.py: 37 passedType
🚄 Infrastructure
Caveats (if any)
Medium
Low
Final Attestation
Link to Devin session: https://app.devin.ai/sessions/191f37becd4f4fe38996e84753162c28
Open in Devin Desktop: https://app.devin.ai/desktop/session/191f37becd4f4fe38996e84753162c28?variant=devin
Requested by: @yassin-berriai