litellm/.github/workflows
yuneng-jiang ffab5a39d0
feat(ci): ratchet the test suite's zero-assert, mock-echo and global-state debt (#37588)
* feat(ci): ratchet the test suite's zero-assert, mock-echo and global-state debt

The suite's dominant failure mode is tests that cannot fail for the reason anyone
would want them to. The testing-strategy audit measured five shapes of it, and
nothing mechanical stops any of them from reproducing, so they keep reproducing.

`scripts/check_test_quality.py` is an AST checker for those five, emitting the
same `path:line: CODE message` contract as `scripts/check_type_discipline.py`:

  TQ001  a collectible test with no assertion of any kind
  TQ002  mock-echo, where every assertion only inspects the mock that was patched
  TQ003  sys.path.insert inside the test tree
  TQ004  raw `os.environ[...] =`, which leaks into whatever runs next
  TQ005  `litellm.<attr> =`, the process-wide leak the 491-line conftest undoes

`scripts/test_quality_gate.py` caps each rule against test-quality-budget.json,
seeded at exactly today's count, and fails only when a rule is both over its
limit and higher than the base being merged into, so a change is blamed for what
it adds and never for drift already in the base. `--update` lowers a limit by
what a branch cleared, so the ceilings only ever fall. It runs in the existing
required lint job, which means it enforces without a ruleset change.

TQ001 follows assertions into helpers defined in the same module, transitively.
Without that it flagged 111 tests in tests/e2e, the harness this program holds up
as the reference, because that suite factors its assertions into shared helpers
(`assert_auth_denied(result, ...)`). Following them leaves 25, all of which reach
their assertions across a module boundary; those are grandfathered and documented
rather than papered over.

The seeded counts land within about 10% of the audit's independent numbers for
every rule measured on the same subtree, which is the cross-check that the
definitions here match the ones the audit pinned.

* fix(ci): resolve test helpers per scope, not by bare name

The helper walk keyed every function in a module by its bare name, so two
same-named helpers in different classes collided and the last one parsed won.
A test calling `self._check()` could be cleared by a `_check` belonging to a
different class, or flagged because of one.

Resolution is now scoped: a bare name looks up the module-level functions, and
`self.<name>` looks up the enclosing class's own methods and no other class's.
Recursion is tracked by function identity rather than by name, so the cycle
guard cannot be confused by the same collision.

This surfaced one real zero-assert test that a same-named helper elsewhere had
been clearing, so TQ001 seeds at 750 rather than 749.

The test module has to register itself in sys.modules before exec_module:
`@dataclass(slots=True)` rebuilds its class through `sys.modules[__module__]`,
and Scope fails to construct without it. Recorded at the call site, since it
reads like avoidable global mutation otherwise.

* fix: register test-quality-budget.json with the ratchet alarm

The repo keeps one census over its budget files: every *-budget.json on disk
must appear in DEFAULT_BUDGETS, or its ceilings can be raised with no signal.
tests/test_litellm/test_budget_ratchet_check.py asserts that set equality and
caught the new budget on the way in.

Registering it also turns the alarm on for TQ001-TQ005, so a later PR cannot
quietly raise a test-quality ceiling. The file already uses the {limit: N}
schema the ratchet reads, so no other change was needed.
2026-08-20 10:08:49 -07:00
..
_test-unit-base.yml perf(ci): gate the lint, MCP and dashboard jobs on the pull request's file list (#37559) 2026-08-19 18:32:21 -07:00
auto_update_price_and_context_window.yml chore(ci): close the test-census blind spots and move scripts out of workflows/ (#37586) 2026-08-20 10:07:14 -07:00
check-schema-sync.yml ci: give the remaining pull_request workflows a concurrency group 2026-08-08 03:25:38 +00:00
check-ui-api-types.yml ci: cache Prisma CLI and engine binaries, split test timeout from setup 2026-08-10 16:10:54 +00:00
check_duplicate_issues.yml [Infra] Flip remaining CI jobs to Python 3.12 2026-04-22 21:26:19 -07:00
ci-coverage.yml ci: fail the build when a test file or Dockerfile is invoked by no job (#35991) 2026-08-05 14:52:48 -07:00
close_low_quality_prs.yml feat(agent-shin): automated PR/issue triage, low-quality auto-close, and review-gate label lifecycle (#30433) 2026-06-17 20:42:27 -07:00
codeql.yml ci(zizmor): gate PRs on medium+ findings and clear existing ones (#30797) 2026-06-18 18:26:03 -07:00
codspeed.yml ci: only run CodSpeed on backend changes (#34345) 2026-07-23 16:58:55 -07:00
conventional-commits.yml ci: give the remaining pull_request workflows a concurrency group 2026-08-08 03:25:38 +00:00
create-release-branch.yml ci(release): create stable/X.Y.x line branch on X.Y.0 tags (#29457) 2026-06-01 15:56:34 -07:00
create-release.yml fix(release): make Create Release reliable for stable maintenance cuts (#31986) 2026-07-02 16:05:11 -07:00
create_daily_oss_agent_shin_branch.yml fix(ci): make every remaining CI checkout shallow (#35997) 2026-08-05 14:32:17 -07:00
create_daily_staging_branch.yml fix(ci): make every remaining CI checkout shallow (#35997) 2026-08-05 14:32:17 -07:00
guard-fork-dependencies.yml ci: give the remaining pull_request workflows a concurrency group 2026-08-08 03:25:38 +00:00
guard-main-branch.yml chore(ci): retire daily OSS branches in favor of litellm_internal_staging 2026-07-20 11:38:52 -07:00
helm_unit_test.yml ci: give the remaining pull_request workflows a concurrency group 2026-08-08 03:25:38 +00:00
image-scan.yml test(docker): gate the componentized gateway and backend images on an arbitrary-uid offline boot (#36136) 2026-08-07 09:57:37 -07:00
issue-keyword-labeler.yml chore: fixes 2026-04-05 01:30:57 -07:00
label-component.yml chore: fixes 2026-04-05 01:30:57 -07:00
mutation-test.yml ci: cache Prisma CLI and engine binaries, split test timeout from setup 2026-08-10 16:10:54 +00:00
osv-scan.yml fix(ci): point OSS contributor workflows to litellm_oss_staging (#31270) 2026-06-24 21:07:59 -07:00
publish-basedpyright-base-counts.yml ci: cache Prisma CLI and engine binaries, split test timeout from setup 2026-08-10 16:10:54 +00:00
scorecard.yml chore: fixes 2026-04-05 01:30:57 -07:00
stale.yml chore: fixes 2026-04-05 01:30:57 -07:00
sync-schema.yml chore: fixes 2026-04-05 01:30:57 -07:00
test-code-quality.yml fix(ci): drop unsupported arithmetic from the job timeout expression 2026-08-10 17:13:16 +00:00
test-linting.yml feat(ci): ratchet the test suite's zero-assert, mock-echo and global-state debt (#37588) 2026-08-20 10:08:49 -07:00
test-litellm-ui-build.yml perf(ci): gate the lint, MCP and dashboard jobs on the pull request's file list (#37559) 2026-08-19 18:32:21 -07:00
test-litellm-ui-lint.yml ci: give the remaining pull_request workflows a concurrency group 2026-08-08 03:25:38 +00:00
test-litellm-ui-unit.yml fix(ci): run the full dashboard suite when a change reaches outside src/ (#37563) 2026-08-19 23:09:03 -07:00
test-mcp.yml perf(ci): gate the lint, MCP and dashboard jobs on the pull request's file list (#37559) 2026-08-19 18:32:21 -07:00
test-model-map.yaml ci: give the remaining pull_request workflows a concurrency group 2026-08-08 03:25:38 +00:00
test-rust.yml feat(rust): port BaseAWSLLM auth (credential resolution + SigV4) to litellm-core as a base provider (#33888) 2026-07-18 19:12:00 -07:00
test-semgrep.yml fix(ci): retry setup-uv installs to survive transient manifest fetch failures 2026-07-14 14:41:36 -07:00
test-terraform-modules.yml feat(terraform/aws): make VPC, Aurora, and Redis optional (#36676) 2026-08-12 15:27:13 -07:00
test-terraform-provider.yml ci: cache Prisma CLI and engine binaries, split test timeout from setup 2026-08-10 16:10:54 +00:00
test-unit-documentation.yml perf(ci): gate the lint, MCP and dashboard jobs on the pull request's file list (#37559) 2026-08-19 18:32:21 -07:00
test-unit-proxy-db.yml ci: drop deleted files from the proxy-server-core shard 2026-08-12 11:21:39 -07:00
test-unit.yml refactor(ci): fold the nine thin unit-shard callers into one matrix (#37590) 2026-08-20 10:07:02 -07:00
triage_issue_with_llm.yml feat(agent-shin): automated PR/issue triage, low-quality auto-close, and review-gate label lifecycle (#30433) 2026-06-17 20:42:27 -07:00
triage_reconsider.yml feat(agent-shin): automated PR/issue triage, low-quality auto-close, and review-gate label lifecycle (#30433) 2026-06-17 20:42:27 -07:00
weekly_load_anomaly.yml ci: cache Prisma CLI and engine binaries, split test timeout from setup 2026-08-10 16:10:54 +00:00
zizmor.yml ci: run zizmor and proxy-db unit tests on PRs targeting litellm_ branches 2026-07-16 11:44:35 -07:00