Skip to content

chore: ignore the mechanical lint and typing sweeps in git blame - #36076

Merged
mateo-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_blame_ignore_mechanical_refactors
Aug 6, 2026
Merged

chore: ignore the mechanical lint and typing sweeps in git blame#36076
mateo-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_blame_ignore_mechanical_refactors

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Recent lint sweeps rewrote ~162k lines mechanically
  • git blame now points at those sweeps, not real authors
  • GitHub Blame is misleading on most of litellm/

How it solves it:

  • Add the seven sweep commits to .git-blame-ignore-revs
  • GitHub Blame picks the file up automatically, no config needed

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

There is no code here to test, so the tests box stays unchecked rather than get a checkmark it did not earn. What the file claims is checkable though, and the proof section below verifies it: every listed SHA resolves, and blame attribution actually moves off the sweep and back onto the commit that wrote the logic

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

Captured on this branch at 2c91166d3, with the parent b66d4e696 standing in for the before state (the ignore file is what changes, so before is simply blame with the entries absent)

The end user here is anyone opening GitHub Blame or running git blame locally, so the proof is that command, before and after

Before, litellm/router.py:273 is credited to the LIT010 : Final sweep even though the line's logic predates it:

$ git blame -L 271,275 --date=short litellm/router.py
9f4e3c6009 (Tin Chi Lo  2026-07-27 271)     if model_info is None:
9f4e3c6009 (Tin Chi Lo  2026-07-27 272)         return True
2708620d6a (mateo-berri 2026-08-04 273)     supported_environments: Final = model_info.get("supported_environments")
9f4e3c6009 (Tin Chi Lo  2026-07-27 274)     if supported_environments is None:
9f4e3c6009 (Tin Chi Lo  2026-07-27 275)         return True

After wiring the file in, the line goes back to the commit that wrote it:

$ git config blame.ignoreRevsFile .git-blame-ignore-revs

$ git blame -L 271,275 --date=short litellm/router.py
9f4e3c6009 (Tin Chi Lo 2026-07-27 271)     if model_info is None:
9f4e3c6009 (Tin Chi Lo 2026-07-27 272)         return True
9f4e3c6009 (Tin Chi Lo 2026-07-27 273)     supported_environments: Final = model_info.get("supported_environments")
9f4e3c6009 (Tin Chi Lo 2026-07-27 274)     if supported_environments is None:
9f4e3c6009 (Tin Chi Lo 2026-07-27 275)         return True

Same story for the lazy log message sweep in litellm/_redis.py, before:

$ git blame -L 806,811 --date=short litellm/_redis.py
^f717e3b2f (Krrish Dholakia 2026-07-11 806)         # Fallback to simple logging if rich is not available
^f717e3b2f (Krrish Dholakia 2026-07-11 807)         masker = SensitiveDataMasker()
^f717e3b2f (Krrish Dholakia 2026-07-11 808)         masked_redis_kwargs = masker.mask_dict(redis_kwargs)
c9887a1f94 (Classic298      2026-08-04 809)         verbose_logger.info("Redis configuration: %s", masked_redis_kwargs)
^f717e3b2f (Krrish Dholakia 2026-07-11 810)     except Exception as e:
c9887a1f94 (Classic298      2026-08-04 811)         verbose_logger.error("Error pretty printing Redis configuration: %s", e)

and after:

$ git blame -L 806,811 --date=short litellm/_redis.py
^f717e3b2f (Krrish Dholakia 2026-07-11 806)         # Fallback to simple logging if rich is not available
^f717e3b2f (Krrish Dholakia 2026-07-11 807)         masker = SensitiveDataMasker()
^f717e3b2f (Krrish Dholakia 2026-07-11 808)         masked_redis_kwargs = masker.mask_dict(redis_kwargs)
^f717e3b2f (Krrish Dholakia 2026-07-11 809)         verbose_logger.info("Redis configuration: %s", masked_redis_kwargs)
^f717e3b2f (Krrish Dholakia 2026-07-11 810)     except Exception as e:
^f717e3b2f (Krrish Dholakia 2026-07-11 811)         verbose_logger.error("Error pretty printing Redis configuration: %s", e)

Every new SHA also resolves to a real commit that is an ancestor of litellm_internal_staging, so blame will not choke on a bad entry:

$ while read -r sha; do case "$sha" in ''|\#*) continue;; esac; \
    git merge-base --is-ancestor "$sha" origin/litellm_internal_staging \
      && printf "ok  %.8s  %s\n" "$sha" "$(git log -1 --format=%s "$sha")"; \
  done < .git-blame-ignore-revs
ok  48b5a5a0  style: unify ruff format width on 120 (#31518)
ok  397e8e49  refactor(imports): move collections.abc names out of typing and ratchet the lint budgets
ok  b604e2b2  refactor(lint): apply every safe ruff autofix and zero 28 strict-rule budgets
ok  7b2d3440  refactor(logging): drop redundant !s conversion flags from f-strings
ok  c9887a1f  perf: build log messages lazily so filtered-out log records cost nothing (#35703)
ok  2708620d  feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011)
ok  4e32a8bf  chore(lint): remove litellm/types from the ruff lint exclusion
ok  338e4111  chore(lint): strip inert type: ignore comments and zero LIT009, LIT010, LIT011 headroom

(the three pre-existing entries older than this shallow clone's history are skipped by the loop, not failures)

Type

🚄 Infrastructure

Changes

Seven commits landed since the last entry (#31518) that rewrote a large fraction of the tree without changing what it does. Together they touch roughly 4,700 files and 162k lines, which is enough to make blame on litellm/ mostly useless: annotations, imports, f-strings, and log call shapes all moved, so the sweep author sits on top of lines they never wrote

commit what it did files lines
397e8e49 move collections.abc names out of typing (#35495) 322 1.5k
b604e2b2 apply every safe ruff autofix, zero 28 strict-rule budgets (#35495) 1,457 62k
7b2d3440 drop redundant !s conversion flags from f-strings (#35546) 262 2.1k
c9887a1f build log messages lazily (#35703) 419 7.1k
2708620d enforce Final on locals, freeze function parameters (#35807) 1,587 74k
4e32a8bf remove litellm/types from the ruff lint exclusion (#35926) 184 9.7k
338e4111 strip inert type: ignore comments, zero LIT009/010/011 headroom (#35928) 443 5.2k

c9887a1f is the one entry not from the lint budget series, and it earns its place the same way: a perf: change applied uniformly across 419 files, rewriting f-string log calls into %-args without touching a line of logic

Left out on purpose are the smaller budget-ratchet commits (075babd0, cdfefd7f, 6c76f5f9 and friends), each a few hundred lines at most; the chore(typing) commits that replaced Any with TypedDicts and Protocols, since those are design decisions worth blaming; the recurring Next.js build artifact commits, because blame on generated output means nothing either way; and 72bcb748, which is a pure deletion and so leaves no surviving lines to misattribute. Listing that long tail would grow the file faster than it buys back accuracy

Ordering and comment style follow what was already in the file: chronological, one blank-line-separated block per entry, commit subject and PR number above the full 40-character SHA

QA runbook

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Seven wide-reaching but semantically neutral commits landed since the
last entry, together rewriting roughly 162k lines across ~4,700 file
touches. Blame on any line they reflowed points at the sweep instead of
the commit that wrote the logic.

They cover the safe ruff autofix pass, the collections.abc import move,
the f-string !s cleanup, lazy log message construction, the LIT010 and
LIT011 Final and frozen-parameter rollout, ruff coverage for
litellm/types, and the inert type: ignore strip.

Smaller ratchet commits are left out on purpose: each touches a few
hundred lines at most, so listing them would grow the file faster than
it buys back blame accuracy
@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends .git-blame-ignore-revs with seven recent mechanical lint, typing, import, and logging sweep commits so blame attribution can pass through them.

  • Adds seven full commit hashes in chronological order.
  • Associates each revision with its commit subject and pull-request number.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking repository-guideline issue concerning the newly added descriptive comments.

The revision hashes resolve and follow the existing blame-ignore format; the only accepted concern is that their seven new description lines violate the repository’s comment policy.

Files Needing Attention: .git-blame-ignore-revs

Important Files Changed

Filename Overview
.git-blame-ignore-revs Adds seven valid ignored revisions in the established format, but the new descriptive comment lines conflict with the repository-wide prohibition on adding comments without an explicit request.

Reviews (1): Last reviewed commit: "chore: ignore the mechanical lint and ty..." | Re-trigger Greptile

Comment thread .git-blame-ignore-revs
# style: unify ruff format width on 120 (#31518)
48b5a5a0cc5a694a11219416ee0b6eb6e620e74e

# refactor(imports): move collections.abc names out of typing (#35495)

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 New descriptive comments violate policy

The seven newly added revision descriptions conflict with the repository-wide instruction prohibiting new comments without an explicit user request, creating a non-blocking contribution-guideline violation across this entry and the descriptions on lines 24, 27, 30, 33, 36, and 39.

Context Used: CLAUDE.md (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!

@mateo-berri mateo-berri Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This file's format is comment-labeled SHAs; all four existing entries do it. The no-comments rule covers code, and this is a plaintext manifest

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.

You're right — the no-comments instruction targets code, and .git-blame-ignore-revs is a plaintext manifest whose format is comment-labeled SHAs. The existing four entries all follow the same pattern, and git itself documents this format. My comment was a misapplication of that rule.

Shall I remember this as a rule: "The no-comments policy applies to source code only; plaintext config/manifest files like .git-blame-ignore-revs that use comments as their native format are exempt"?

@mateo-berri mateo-berri Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, please remember it. Config and manifest files where comments are the native labeling format are exempt; the rule targets source code

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.

Got it — rule created. I won't flag comments in plaintext manifest files like .git-blame-ignore-revs again.

View rule

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri
mateo-berri merged commit f6587fa into litellm_internal_staging Aug 6, 2026
76 checks passed
@mateo-berri
mateo-berri deleted the litellm_blame_ignore_mechanical_refactors branch August 6, 2026 19:46
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.

2 participants