Skip to content

ci(test-unit): drop dead misc shard paths and skip missing paths with a warning - #42603

Merged
mateo-berri merged 2 commits into
mainfrom
litellm_ci_misc_shard_dead_paths
Sep 23, 2026
Merged

mateo-berri merged 2 commits into
mainfrom
litellm_ci_misc_shard_dead_paths

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • The misc unit shard named eight test directories that moved to tests/unit on 2026-09-20
  • One missing path makes pytest-xdist collect [0 items] for the whole shard
  • The shard's exit-5 tolerance turned that into a green required check running nothing
  • 6,542 tests under the shard's other 17 directories have not run on any PR since

How it solves it:

  • Drops the eight dead paths from the misc shard
  • The shared test step now skips a path that does not exist, with a ::warning:: naming it
  • Pytest runs over the paths that do exist, so one stale entry can never empty a shard again
  • Flags like --ignore=... in a test-path pass through untouched
  • A regression test runs the real step script with a missing path and asserts the other tests ran

User Flow

Before: a contributor breaks a test under tests/test_litellm/passthrough, and the misc required check on their PR reports green after running nothing

  1. They push a branch and open a PR at https://github.com/BerriAI/litellm/pulls
  2. The PR's checks list shows misc / Run tests green after about two minutes
  3. Opening that job's log at https://github.com/BerriAI/litellm/actions/runs/35783099007/job/106933188388 shows 2 workers [0 items], no tests ran in 32.53s, then pytest collected no tests from tests/test_litellm/batches ...; passing
  4. The PR merges with the broken test never having run

After: the same PR's misc check runs the shard's 6,549 tests and goes red on the broken one

  1. They push a branch and open a PR at https://github.com/BerriAI/litellm/pulls
  2. The PR's checks list shows misc / Run tests running for about ten minutes
  3. Opening that job's log shows 2 workers [6549 items] and the broken test listed as FAILED, so the check is red
  4. If someone later deletes a directory the shard still names, the job log shows a Warning annotation naming that path and the rest of the shard still runs

Relevant issues

Affected release

Linear ticket

Pre-Submission checklist

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

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. 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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • 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)

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 runs use the misc shard's own Run tests step from .github/workflows/_test-unit-base.yml with the shard's inputs from .github/workflows/test-unit.yml (workers: 2, dist: loadscope, the base workflow's defaults for the rest), executed the way GitHub Actions runs it (bash --noprofile --norc -eo pipefail) from the repo root

Before (d31e8aa)

The shard's own pytest command at the main tip

  1. Ran the step's pytest command over the shard's 26 test-path tokens with -n 2 --dist=loadscope:

    uv run --no-sync pytest tests/test_litellm/batches tests/test_litellm/secret_managers tests/test_litellm/a2a_protocol tests/test_litellm/anthropic_interface tests/test_litellm/chat_completions tests/test_litellm/completion_extras tests/test_litellm/compression tests/test_litellm/containers tests/test_litellm/endpoints tests/test_litellm/models tests/test_litellm/repositories tests/test_litellm/images tests/test_litellm/interactions tests/test_litellm/messages tests/test_litellm/ocr tests/test_litellm/passthrough tests/test_litellm/rag tests/test_litellm/realtime_api tests/test_litellm/rerank_api tests/test_litellm/rust_bridge tests/test_litellm/sandbox tests/test_litellm/skills tests/test_litellm/test_router tests/test_litellm/vector_stores tests/test_litellm/videos tests/test_litellm/test_*.py --tb=short -vv --maxfail=10 -n 2 --dist=loadscope --reruns 2 --reruns-delay 1 --timeout=120 --rerun-except "from pytest-timeout" --durations=20 --cov=./litellm --cov=./enterprise/litellm_enterprise --cov-report=xml:coverage.xml --cov-config=pyproject.toml; echo "exit=$?"
    
  2. Observed:

    created: 2/2 workers
    2 workers [0 items]
    
    scheduling tests via LoadScopeScheduling
    
    ============================ no tests ran in 16.55s ============================
    exit=5
    

    No file or directory not found line anywhere in the output. The step maps exit 5 to exit 0, which is what the misc job on main did in https://github.com/BerriAI/litellm/actions/runs/35783099007/job/106933188388 (pytest collected no tests from tests/test_litellm/batches ...; passing)

The same shard over only the 18 tokens that exist

  1. Ran uv run --no-sync pytest <the 17 existing directories> 'tests/test_litellm/test_*.py' --co -q
  2. Observed 6542 tests collected in 26.66s, so that is what the shard should have been running

After (8c8c6e3)

This PR's own misc job

  1. Opened https://github.com/BerriAI/litellm/actions/runs/35791407344/job/106960507669 (the PR's run at its merge ref) and read the Run tests step

  2. Observed:

    2 workers [6549 items]
    ...
    =========================== short test summary info ============================
    FAILED tests/test_litellm/test_cost_calculator.py::test_completion_cost_image_generation_registered_deployment_price_keeps_map_token_rates - assert 0.1 == 0.077405 ± 7.7e-08
    FAILED tests/test_litellm/test_model_prices_schema.py::test_price_map_has_no_duplicate_keys[backup] - AssertionError: model_prices_and_context_window_backup.json defines the same key twice; ...
    FAILED tests/test_litellm/test_model_prices_schema.py::test_price_map_has_no_duplicate_keys[main] - AssertionError: model_prices_and_context_window.json defines the same key twice; ...
    FAILED tests/test_litellm/test_redact_string_in_error_paths.py::TestAzureRealtimeRedaction::test_invalid_status_code_redacts_reason - assert 1011 == 403
    FAILED tests/test_litellm/test_redact_string_in_error_paths.py::TestOpenAIRealtimeRedaction::test_invalid_status_code_redacts_reason - assert 1011 == 403
    FAILED tests/test_litellm/test_utils.py::test_aaamodel_prices_and_context_window_json_is_valid - jsonschema.exceptions.ValidationError: Additional properties are not allowed ('output_cost_per_image_1024', 'output_cost_per_image_1536', 'output_cost_per_image_512' were unexpected)
    = 6 failed, 6518 passed, 25 skipped, 515 warnings, 12 rerun in 547.53s (0:09:07) =
    
  3. The shard now runs its tests. At 8c8c6e3 the check was red on six tests that main had been failing since the shard stopped running on 2026-09-20; none of them touched a file in this diff, so each was fixed on main by its own PR (test(utils): accept the per-size image cost keys in the price-map schema check #42612, test(cost_calculator): point image-generation deployment price test at a live gemini row #42615, fix: drop duplicate cache_read_input_token_cost_batches keys from the price maps #42623, and test(realtime): drop legacy InvalidStatusCode tests and pin websockets imports #42624). After updating this branch from main with a merge commit (9637a82, the diff against main unchanged) the check is green at https://github.com/BerriAI/litellm/actions/runs/35803562002/job/106999166103: [6548 items] and 6523 passed, 25 skipped, 505 warnings in 444.33s (0:07:24)

The shard's own step script at the PR tip

  1. Ran the tip's Run tests step script from the repo root with the shard's inputs (WORKERS=2 DIST=loadscope MAX_FAILURES=10 RERUNS=2 TEST_TIMEOUT_SECONDS=120) and TEST_PATH set to the misc shard's test-path from this branch, under bash --noprofile --norc -eo pipefail

  2. Observed:

    2 workers [6545 items]
    ...
    = 8 failed, 6517 passed, 20 skipped, 520 warnings, 15 rerun in 601.17s (0:10:01) =
    exit=1
    

    The same six failures as the job above plus two that only fail on this laptop without outbound network (test_main.py::test_openai_env_base[OPENAI_API_BASE] with OpenAIException - Connection error, and test_router_per_deployment_num_retries.py::TestNoProviderRetryAmplification::test_direct_completion_still_forwards_num_retries_to_provider with assert 3 > (2 + 1)); both passed in the job above

The step script with a stale path still in TEST_PATH

  1. Ran the same script with TEST_PATH="tests/test_litellm/models tests/test_litellm/rerank_api" (tests/test_litellm/models no longer exists)

  2. Observed:

    ::warning::tests/test_litellm/models does not exist; drop it from this shard's test-path
    2 workers [10 items]
    ================== 10 passed, 3 warnings in 224.06s (0:03:44) ==================
    exit=0
    

    The missing path is dropped with a warning and the ten rerank_api tests run. At the merge base the same TEST_PATH gives 2 workers [0 items] and exit 5, mapped to a green step

Every other shard that runs through the changed step

Both callers of _test-unit-base.yml (test-unit.yml and test-unit-proxy-db.yml) ran the changed step on this PR. Item counts and results per shard, the base run being main at the merge base (https://github.com/BerriAI/litellm/actions/runs/35788783637 and https://github.com/BerriAI/litellm/actions/runs/35788783796) and the head run this PR's (https://github.com/BerriAI/litellm/actions/runs/35791407344 and https://github.com/BerriAI/litellm/actions/runs/35791407319):

Shard Base run (d31e8aa on main) This PR's run
proxy-infra 11955 items, 11954 passed, 1 skipped 11956 items, 11955 passed, 1 skipped
proxy-auth 4489 items, 4487 passed, 2 skipped 4489 items, 4487 passed, 2 skipped
responses-caching-types 1416 items, 1416 passed, 1 skipped 1420 items, 1420 passed, 1 skipped
proxy-endpoints 13436 items, 13427 passed, 8 skipped, 1 xfailed 13443 items, 13434 passed, 8 skipped, 1 xfailed
proxy-extras 78 items, 78 passed 78 items, 78 passed
All Other Providers 7353 items, 7285 passed, 68 skipped 7353 items, 7285 passed, 68 skipped
proxy-server 981 items, 981 passed 981 items, 981 passed
integrations 4387 items, 4384 passed, 3 skipped, 2 subtests passed 4387 items, 4384 passed, 3 skipped, 2 subtests passed
enterprise-routing 2996 items, 2992 passed, 4 skipped 2996 items, 2992 passed, 4 skipped
caching-local 44 items, 44 passed 44 items, 44 passed
mcp-integration 505 items, 499 passed, 6 skipped 505 items, 499 passed, 6 skipped
enterprise-package 290 items, 286 passed, 4 skipped 290 items, 286 passed, 4 skipped
Vertex AI 1145 items, 1142 passed, 3 skipped 1145 items, 1142 passed, 3 skipped
core-utils 3983 items, 3982 passed, 1 skipped 3983 items, 3982 passed, 1 skipped
budgets 85 items, 85 passed 85 items, 85 passed
auth-checks 168 items, 168 passed 168 items, 168 passed
logging-misc 12 items, 10 passed, 2 skipped 12 items, 10 passed, 2 skipped
proxy-runtime 115 items, 112 passed, 3 skipped 115 items, 112 passed, 3 skipped
custom-logging 14 items, 11 passed, 3 skipped 14 items, 11 passed, 3 skipped
db-and-spend 41 items, 29 passed, 12 skipped 41 items, 29 passed, 12 skipped
jwt-and-keys 89 items, 87 passed, 2 skipped 89 items, 87 passed, 2 skipped
proxy-server-core 86 items, 73 passed, 13 skipped 86 items, 73 passed, 13 skipped
proxy-utils 201 items, 201 passed 201 items, 201 passed
key-generation 85 items, 5 passed, 80 skipped 85 items, 5 passed, 80 skipped
guardrails-hooks 3 items, 3 passed 3 items, 3 passed
endpoints-and-responses 241 items, 241 passed 241 items, 241 passed

The few item-count differences outside misc come from the commits main gained between the two runs, not from the step: no shard collected fewer tests, none printed a ::warning::, and none hit the nothing to run exit

Type

🚄 Infrastructure

Caveats (if any)

The Medium caveat that stood at 8c8c6e3 (the required misc / Run tests check red on six tests main had been failing since 2026-09-20) no longer holds: the fixes landed on main as #42612, #42615, #42623, and #42624, this branch was updated from main with a merge commit (9637a82), and the check is green at https://github.com/BerriAI/litellm/actions/runs/35803562002/job/106999166103

Low

  • A stale test-path entry now only warns in the job log and annotations; nothing fails on it
  • .github/scripts/assert_ci_coverage.py still does not flag a shard entry that points nowhere, so the warning is the only signal

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

Note

Medium Risk
Changes required CI test execution for a large shard (~6.5k tests); behavior is improved but stale paths only warn and do not fail the check.

Overview
Fixes the misc unit-test shard silently passing while running no tests when stale test-path entries made pytest-xdist collect zero items (exit 5, treated as success).

The reusable Run tests step in _test-unit-base.yml now tokenizes TEST_PATH, passes through pytest flags (-*), drops missing directories with a ::warning:: annotation, and only skips the job when every path is gone. Pytest is invoked with the filtered argument list instead of the raw shard string.

test-unit.yml removes eight directories from the misc matrix entry that no longer exist under tests/test_litellm/ (they had moved to tests/unit).

Adds test_unit_shard_missing_paths.py, which loads the real workflow bash snippet and asserts missing paths are warned while remaining paths still execute (serial and xdist), and that --ignore=... is not mistaken for a path.

Reviewed by Cursor Bugbot for commit 8c8c6e3. Bugbot is set up for automated code reviews on this repo. Configure here.

… a warning

Eight directories the misc shard named moved to tests/unit on 2026-09-20, and one
missing path makes pytest-xdist collect [0 items] for the whole shard, which the
exit-5 tolerance turned into a green required check running nothing. The shared
Run tests step now drops a path that does not exist with a ::warning:: and runs
pytest over the rest, keeping option tokens verbatim.
@devin-ai-integration

devin-ai-integration Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable issue remains in the current changes.

Findings

  1. P2 Line Exceeds Repository Limit ▶

Summary

This PR repairs the miscellaneous unit-test shard so stale paths no longer prevent valid paths from being collected.

  • Removes eight obsolete shard paths that moved elsewhere.
  • Filters missing path tokens with a GitHub Actions warning while preserving pytest options.
  • Adds regression coverage for serial and xdist execution and --ignore=... passthrough.

Reviews (2) · Last reviewed commit: "ci(test-unit): drop dead misc shard path..."

Comment on lines +13 to +15
_SHARD_ENV: Final = MappingProxyType(
{"MAX_FAILURES": "10", "RERUNS": "0", "DIST": "loadscope", "TEST_TIMEOUT_SECONDS": "60", "COVERAGE_CORE": "sysmon"}
)

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 Line Exceeds Repository Limit

The _SHARD_ENV mapping exceeds the repository's 120-character limit for Python lines. This explicit repository requirement must be satisfied before merging.

Suggested change
_SHARD_ENV: Final = MappingProxyType(
{"MAX_FAILURES": "10", "RERUNS": "0", "DIST": "loadscope", "TEST_TIMEOUT_SECONDS": "60", "COVERAGE_CORE": "sysmon"}
)
_SHARD_ENV: Final = MappingProxyType(
{
"MAX_FAILURES": "10",
"RERUNS": "0",
"DIST": "loadscope",
"TEST_TIMEOUT_SECONDS": "60",
"COVERAGE_CORE": "sysmon",
}
)

Context Used: AGENTS.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!

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.

That line is 119 characters, under the 120-character limit in ruff.toml, and ruff's E501 check passes on this file, so nothing exceeds the repository limit

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 — that line is 119 characters, and ruff.toml sets the limit to 120. My line-length finding was incorrect; no change is needed.

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8c8c6e3. Configure here.

@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

@mateo-berri
mateo-berri enabled auto-merge (squash) September 22, 2026 22:40
@mateo-berri
mateo-berri merged commit 21a2d82 into main Sep 23, 2026
91 checks passed
@mateo-berri
mateo-berri deleted the litellm_ci_misc_shard_dead_paths branch September 23, 2026 00:56
yuneng-berri pushed a commit that referenced this pull request Sep 23, 2026
…e failure-hook regression (#42646)

* test(utils): raise the post-success hook error from a guardrail in the failure-hook regression

Since #42535 a plain logger raising inside async_post_call_success_deployment_hook
is logged and the completed request returns, so the regression added by #36657 for
"a post-success error never reaches async_post_call_failure_deployment_hook" failed
with DID NOT RAISE on every main run once #42603 revived the misc unit shard. The
raising callback is now a CustomGuardrail, the one kind of callback whose
post-success raise still propagates, which keeps the original assertions intact

* test(utils): type the guardrail's success-hook request_data as a Mapping

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
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