Repository navigation
perf(ci): gate the lint, MCP and dashboard jobs on the pull request's file list - #37559
Conversation
… file list PR #37550 taught the backend unit-test shards to read the pull request's own file list, but four required jobs were never wired to that gate and ran in full on every pull request regardless of what it touched. A UI-only pull request still paid roughly 17 runner-minutes of Python work it could not have affected, and a backend-only one still installed and built the dashboard. Lint and the MCP suite now take the existing backend decision. The dashboard build and unit tests take a new ui decision, which tracks ui/ rather than reusing client: client deliberately runs whenever the backend changes, because it gates CircleCI's end-to-end jobs that drive a real proxy, while the build and the unit tests cannot see the backend at all. CI config counts as ui-relevant too, so a pull request that rewrites the dashboard workflows still exercises them instead of shipping unvalidated. The gate stays inside the job rather than moving to on.paths or to a job-level condition on the shard callers. A workflow filtered out by on.paths never starts and never reports, so a required check waits forever, and a skipped caller job publishes its own name instead of the nested "<shard> / Run tests" the ruleset requires. Both were measured before settling on this shape. Three setup steps in the shard base and in the documentation job also leaked past the gate, so a skipped shard still spent about twelve seconds installing uv and restoring its cache. They now carry the same condition, and the documentation job stops cloning litellm-docs when it has nothing to validate.
Greptile SummaryThe PR generalizes the existing backend change detector into a category-aware gate and applies it to linting, MCP, reusable Python tests, and dashboard workflows.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified. The renamed action has no stale callers, category decisions fail open when uncertain, skipped setup and artifact consumers are gated consistently, and independent API-type synchronization covers backend-driven dashboard schema changes.
|
| Filename | Overview |
|---|---|
| .circleci/scripts/classify_changes.sh | Adds a UI-specific category while retaining backend/client behavior and treating CI configuration as relevant to self-testing workflows. |
| .github/actions/detect-changes/action.yml | Replaces the backend-only composite action with a category-aware action that preserves the fail-open decision contract. |
| .github/scripts/detect_changes.sh | Generalizes classification to a supplied category, defaults to backend, and retains safe fallback behavior for API or classifier failures. |
| .github/workflows/_test-unit-base.yml | Gates setup, tests, artifact creation, and coverage upload consistently on the shared change decision. |
| .github/workflows/test-linting.yml | Gates the expensive lint job steps on backend relevance while leaving independent ratchet and secret-scanning jobs unchanged. |
| .github/workflows/test-litellm-ui-build.yml | Uses the UI category to avoid installing and building the dashboard for unrelated pull requests. |
| .github/workflows/test-litellm-ui-unit.yml | Gates dashboard setup and tests for pull requests while preserving full execution for non-pull-request events through fail-open behavior. |
| .github/workflows/test-mcp.yml | Gates MCP setup and test execution on backend relevance without changing the workflow status contract. |
| .github/workflows/test-unit-documentation.yml | Moves change detection ahead of the external documentation checkout and consistently skips all dependent setup when irrelevant. |
| tests/test_litellm/test_circleci_path_filter.py | Extends classifier regression coverage for UI, CI configuration, markdown precedence, and backend/UI divergence. |
| tests/test_litellm/test_detect_changes.py | Renames and expands detector tests to cover category selection, default behavior, UI decisions, and fail-open handling. |
Reviews (1): Last reviewed commit: "perf(ci): gate the lint, MCP and dashboa..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
tin-berri
left a comment
There was a problem hiding this comment.
Reviewed the CI-gating refactor. The core mechanism holds up: classify_changes.sh now treats .github/** and .circleci/** as CI-relevant for both backend and ui categories (via has_ci=true; has_backend=true), so a PR that edits these workflows always exercises the jobs it changes — verified via test_ci_config_changes_reach_every_category. The ui category correctly diverges from client (which still must run on backend changes for CircleCI's e2e jobs against a real proxy) — good catch calling that out explicitly in both the caveats and test_ui_and_client_diverge_on_a_backend_only_change. Fail-open behavior on API failure/uncertain classification is preserved and tested. The proof-of-fix section is a nice touch — showing before/after decisions against 3 real PRs (#37553 dashboard-only, #37545 gitignore, #37528 docs) is more convincing than synthetic examples. Test coverage is thorough (skip/run/mixed/fail-open/self-referential all covered). All 70 CI checks green, including this PR's own lint, build-ui, and ui-unit-tests running in full since it touches .github/. Small, well-scoped, no auth/billing/security surface.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a contributor opens a dashboard-only pull request and waits on Python jobs that cannot see their change
ui/litellm-dashboard/**and open a PR againstlitellm_internal_staginglintstill runs for 6 to 7 minutes: it installs uv, generates a Prisma client and runs ruff and basedpyright overlitellm/teststill runs the MCP suite for about 4 minutes,code-qualityandvalidate-model-prices-jsonadd 6 moreAfter: the same pull request settles as soon as the dashboard jobs finish
lintandtestreport success in under a minute, having installed nothingbuild-ui,ui-unit-testsandfrontend-lintstill run in full, because the change is theirs to checkbuild-uiandui-unit-testsinstead of runningnpm ciand a full Next buildRelevant issues
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
Both sides run the gate against three real pull requests through the live GitHub API, with the file counts the API reports for them: #37553 touches 45 files, all under
ui/; #37545 touches 1 file,.gitignore; #37528 touches 2 markdown files.backendis the decisionlint,testand the shards consume,uiis the onebuild-uiandui-unit-testsconsumeBefore (a6163e0)
Dashboard-only pull request (#37553)
uireturns the backend answer because the category does not exist:lintandtestnever read that decision at all, so both ran in full. On this pull requestlinttook 6 minutes 6 seconds andtesttook 4 minutes 24 secondsA skipped shard still did setup work.
misc / Run testson this pull request, 23 seconds end to end:Backend-only pull request (#37545,
.gitignore)Documentation-only pull request (#37528)
After (fb2dab1)
Dashboard-only pull request (#37553)
lintandtestconsume the first one:Backend-only pull request (#37545,
.gitignore)npm ciand the Next build stop running for a one-line gitignore change:Documentation-only pull request (#37528)
This pull request's own checks
.github/and.circleci/, so both categories say run and every gated job here runs in full. That is the gate refusing to skip the change that rewrites itType
🧹 Refactoring
🚄 Infrastructure
Caveats (if any)
on.pathswould never report a required checkuideliberately runs on any.githubor.circlecichangecode-qualityandvalidate-model-prices-jsonare still ungatedFinal Attestation