Skip to content

fix(ci): exclude deleted files from ruff format check - #31462

Merged
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_/stoic-euclid-c3b07c
Jul 4, 2026
Merged

fix(ci): exclude deleted files from ruff format check#31462
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_/stoic-euclid-c3b07c

Conversation

@yuneng-berri

Copy link
Copy Markdown
Contributor

Relevant issues

The "Check ruff format" step in the LiteLLM Linting workflow fails with exit code 123 on any PR that deletes a litellm/**/*.py file. Surfaced on the promote-to-main PR #31384, which removes litellm/ocr/rust_bridge.py:

error: Failed to format litellm/ocr/rust_bridge.py: No such file or directory (os error 2)
301 files already formatted

Type

🐛 Bug Fix

Changes

The step builds its file list with git diff --name-only, which includes deleted paths. The deleted file is then piped to ruff format --check, which cannot format a file that no longer exists on disk and exits 123. Every other file is already correctly formatted; the failure is purely a workflow bug, not a real formatting issue.

The fix adds --diff-filter=ACMR so only added, copied, modified, and renamed files are checked, dropping deletions. This matches the pattern already used in test-litellm-ui-build.yml

Screenshots / Proof of Fix

Local reproduction of the false positive and the fix, against the same base SHA CI used (bd2a1653bd92aeef272b29feaa750706db094975):

Before (current main behavior; lists the deleted file):

$ git diff --name-only "$BASE_SHA"...origin/litellm_internal_staging -- 'litellm/**/*.py' | grep -c '^litellm/ocr/rust_bridge.py$'
1

After (--diff-filter=ACMR; deleted file is gone):

$ git diff --name-only --diff-filter=ACMR "$BASE_SHA"...origin/litellm_internal_staging -- 'litellm/**/*.py' | grep -c '^litellm/ocr/rust_bridge.py$'
0

The CI run for this PR exercises the changed workflow directly, since pull_request runs the workflow from the merge commit

git diff --name-only includes deleted paths, so a PR that removes a
litellm/**/*.py file feeds the gone path to ruff format --check, which
exits 123 with 'No such file or directory'. Add --diff-filter=ACMR so
only added/copied/modified/renamed files are checked, matching the
pattern already used in test-litellm-ui-build.yml.
@yuneng-berri
yuneng-berri requested a review from a team June 26, 2026 16:58
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a false-positive CI failure in the "Check ruff format" step of the LiteLLM Linting workflow, which would exit with code 123 whenever a PR deleted a litellm/**/*.py file.

  • Adds --diff-filter=ACMR to the git diff --name-only call so only Added, Copied, Modified, and Renamed files are piped to ruff format --check, matching the same pattern already used in test-litellm-ui-build.yml.
  • The PR includes before/after local reproduction confirming the deleted file is correctly excluded after the fix.

Confidence Score: 5/5

Safe to merge — the change is confined to a single CI workflow line and only affects which files are piped to ruff format --check; it cannot break any production code path.

The one-line fix is clearly correct: git diff without --diff-filter returns deleted paths, which ruff format cannot open, causing an always-failing workflow step. The added filter is already used elsewhere in the repo. No other files are touched.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/test-linting.yml Adds --diff-filter=ACMR to git diff to exclude deleted files from the ruff format check, fixing a spurious exit-123 failure when a PR removes a Python file.

Reviews (1): Last reviewed commit: "fix(ci): exclude deleted files from ruff..." | Re-trigger Greptile

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yuneng-berri
yuneng-berri enabled auto-merge July 4, 2026 17:13

@mateo-berri mateo-berri left a comment

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.

LGTM; thanks!

Apologies that the new linting caused friction

@yuneng-berri
yuneng-berri merged commit 0932dde into litellm_internal_staging Jul 4, 2026
121 of 122 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_/stoic-euclid-c3b07c branch July 4, 2026 17:42
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