Skip to content

Commit 7af0f05

Browse files
authored
Merge pull request BerriAI#27815 from BerriAI/litellm_internal_staging
[Infra] Promote internal staging to main
2 parents e182a5e + 431daa1 commit 7af0f05

591 files changed

Lines changed: 14742 additions & 3659 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: "Mutation Test (manual)"
2+
3+
# Manually-triggered mutation testing. Runs mutmut against the scope
4+
# configured in [tool.mutmut] in pyproject.toml (currently the
5+
# litellm/proxy/management_endpoints/ folder). Intended cadence is roughly
6+
# weekly — clicked from the Actions tab when someone wants a fresh report.
7+
#
8+
# Uploads a structured `mutation-report.md` (Meta ACH-style: original +
9+
# mutated function with `# MUTANT START`/`# MUTANT END` delimiters + the
10+
# existing tests + a task instruction) as a workflow artifact. Failures
11+
# do not block anything because nothing depends on this workflow.
12+
13+
on:
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: mutation-test-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
mutation:
25+
name: Run mutmut
26+
runs-on: ubuntu-latest
27+
# Whole-folder mutation against ~15 files / ~7.5k LOC can take hours.
28+
# 350 minutes is just under the GitHub-hosted job cap of 360 minutes.
29+
timeout-minutes: 350
30+
31+
steps:
32+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
33+
with:
34+
persist-credentials: false
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
38+
with:
39+
python-version: "3.12"
40+
41+
- name: Set up uv
42+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
43+
with:
44+
version: "0.10.9"
45+
46+
- name: Cache uv dependencies
47+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
48+
with:
49+
path: |
50+
~/.cache/uv
51+
.venv
52+
key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }}
53+
restore-keys: |
54+
${{ runner.os }}-uv-
55+
56+
- name: Install dependencies
57+
run: |
58+
uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router
59+
60+
- name: Generate Prisma client
61+
env:
62+
PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache
63+
run: |
64+
uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma
65+
66+
# mutmut 3.x runs tests inside a `mutants/` sandbox where it injects
67+
# mutation trampolines. uv installs the project as editable by default,
68+
# which puts the original source dir on sys.path via a .pth file and
69+
# shadows the sandbox copy — so tests would never exercise the mutated
70+
# code. Reinstalling non-editable removes the .pth shadow.
71+
- name: Reinstall litellm non-editable (so mutants/ is not shadowed)
72+
run: |
73+
uv pip uninstall litellm
74+
uv pip install . --no-deps
75+
76+
# pytest-retry's pytest_configure hook crashes with
77+
# `INTERNALERROR: no option named 'filtered_exceptions'` when invoked
78+
# via mutmut's in-process pytest.main() call. The entry-point name
79+
# doesn't normalize cleanly with `-p no:<name>`, so just remove the
80+
# package outright. Reruns are wrong for mutation testing anyway —
81+
# rerunning a "failed" mutant test would mask which mutants are killed.
82+
- name: Remove pytest plugins that conflict with mutmut
83+
run: |
84+
uv pip uninstall pytest-retry || true
85+
86+
- name: Run mutmut
87+
env:
88+
# Make the mutants/ sandbox win over site-packages on sys.path so the
89+
# trampolined files are imported instead of the installed copy.
90+
PYTHONPATH: ${{ github.workspace }}/mutants
91+
run: |
92+
set -o pipefail
93+
mkdir -p mutants
94+
uv run --no-sync --with mutmut==3.5.0 mutmut run 2>&1 | tee mutmut-run.log
95+
96+
# Generate the structured report. The script embeds the enclosing
97+
# function source for each survivor (via Python AST) and includes the
98+
# existing test files, so an LLM agent has enough context to write
99+
# killing tests without further file lookups. Modeled on Meta's ACH
100+
# prompt template (arXiv 2501.12862).
101+
- name: Generate detailed mutation report
102+
if: always()
103+
run: |
104+
set +e
105+
uv run --no-sync --with mutmut==3.5.0 mutmut export-cicd-stats > /dev/null 2>&1
106+
uv run --no-sync --with mutmut==3.5.0 mutmut results > mutmut-results.txt 2>&1
107+
uv run --no-sync python scripts/mutation_report.py
108+
# The full report can be very long for big test files; the run-page
109+
# summary cuts off at 1 MB. Append the head of the report (summary
110+
# + survivor list) and link out to the artifact for the full body.
111+
{
112+
head -c 900000 mutation-report.md
113+
echo ""
114+
echo ""
115+
echo "_Full report (with embedded function bodies and test files) is in the workflow artifact._"
116+
} >> "$GITHUB_STEP_SUMMARY"
117+
118+
- name: Upload mutmut artifacts
119+
if: always()
120+
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
121+
with:
122+
name: mutmut-${{ github.run_id }}-${{ github.run_attempt }}
123+
path: |
124+
mutation-report.md
125+
mutmut-results.txt
126+
mutmut-run.log
127+
mutants/mutmut-stats.json
128+
mutants/mutmut-cicd-stats.json
129+
mutants/litellm/proxy/management_endpoints/**/*.py
130+
if-no-files-found: warn
131+
retention-days: 14

.github/workflows/test-unit-proxy-db.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ jobs:
100100
test-path: >-
101101
tests/proxy_unit_tests/test_auth_checks.py
102102
tests/proxy_unit_tests/test_user_api_key_auth.py
103+
tests/proxy_unit_tests/test_deprecated_key_grace_period.py
103104
workers: 4
104105
dist: loadscope
105106
timeout: 15

litellm/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,12 @@ def set_global_gitlab_config(config: Dict[str, Any]) -> None:
14261426
)
14271427
from .llms.datarobot.chat.transformation import DataRobotConfig as DataRobotConfig
14281428
from .llms.anthropic.chat.transformation import AnthropicConfig as AnthropicConfig
1429+
from .llms.bedrock.claude_platform.transformation import (
1430+
BedrockClaudePlatformConfig as BedrockClaudePlatformConfig,
1431+
)
1432+
from .llms.bedrock.claude_platform.messages_transformation import (
1433+
BedrockClaudePlatformMessagesConfig as BedrockClaudePlatformMessagesConfig,
1434+
)
14291435
from .llms.anthropic.completion.transformation import (
14301436
AnthropicTextConfig as AnthropicTextConfig,
14311437
)

litellm/_lazy_imports_registry.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"OpenrouterConfig",
132132
"DataRobotConfig",
133133
"AnthropicConfig",
134+
"BedrockClaudePlatformConfig",
134135
"AnthropicTextConfig",
135136
"GroqSTTConfig",
136137
"TritonConfig",
@@ -170,6 +171,7 @@
170171
"SagemakerNovaConfig",
171172
"CohereChatConfig",
172173
"AnthropicMessagesConfig",
174+
"BedrockClaudePlatformMessagesConfig",
173175
"AmazonAnthropicClaudeMessagesConfig",
174176
"AmazonMantleMessagesConfig",
175177
"TogetherAIConfig",
@@ -610,6 +612,10 @@
610612
"OpenrouterConfig": (".llms.openrouter.chat.transformation", "OpenrouterConfig"),
611613
"DataRobotConfig": (".llms.datarobot.chat.transformation", "DataRobotConfig"),
612614
"AnthropicConfig": (".llms.anthropic.chat.transformation", "AnthropicConfig"),
615+
"BedrockClaudePlatformConfig": (
616+
".llms.bedrock.claude_platform.transformation",
617+
"BedrockClaudePlatformConfig",
618+
),
613619
"AnthropicTextConfig": (
614620
".llms.anthropic.completion.transformation",
615621
"AnthropicTextConfig",
@@ -712,6 +718,10 @@
712718
".llms.anthropic.experimental_pass_through.messages.transformation",
713719
"AnthropicMessagesConfig",
714720
),
721+
"BedrockClaudePlatformMessagesConfig": (
722+
".llms.bedrock.claude_platform.messages_transformation",
723+
"BedrockClaudePlatformMessagesConfig",
724+
),
715725
"AmazonAnthropicClaudeMessagesConfig": (
716726
".llms.bedrock.messages.invoke_transformations.anthropic_claude3_transformation",
717727
"AmazonAnthropicClaudeMessagesConfig",

0 commit comments

Comments
 (0)