litellm/tests/integration/database
Kerry Lu d30b2b9b26
feat(proxy): enforce customer org, team and member budgets and limits on the request path (#51489)
* feat(proxy): enforce customer org, team and member budgets and limits on the request path

Resolve x-litellm-customer-member-id at auth, walk member -> team -> org, enforce max_budget,
allowed_models, tpm/rpm and per-model limits at every level in the v3 limiter, honor the hierarchy
allowlists in alternate-model steering, and settle spend to the member, team and org rows.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(auth): customer hierarchy survives virtual key auth without a legacy end user

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(auth): keys pinned to a customer organization may only act for that organization's members

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* style(proxy): keep the customer hierarchy spend maps within the line limit

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(auth): check the key's customer org scope after the key is resolved

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): declare the hierarchy cache key family and keep type counts flat

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(auth): resolve the customer hierarchy in the shared authorization gate

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): drop a member's cached hierarchy through the declared cache target

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* style(auth): keep the hierarchy reset within the line limit

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(auth): type the requested models as a sequence

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(spend): add daily customer usage and budget resets (#51493)

* feat(spend): add daily customer usage and budget resets

* chore(spend): document customer reset query bounds

* fix(spend): chart customer queue metrics and update recovery test

* fix(proxy): read stamped customer ids from either metadata bucket, alias-aware model check, broadcast member evictions

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Revert "feat(spend): add daily customer usage and budget resets (#51493)"

This reverts commit ccac47608f.

* fix(proxy): evict cached member hierarchies when team, org or template budgets change

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): declare the auth cache dependency alias as a TypeAlias

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* Reapply "feat(spend): add daily customer usage and budget resets (#51493)"

This reverts commit 7542471e17.

* fix(spend): reconcile the daily customer spend table with main

Keep main's LiteLLM_DailyCustomerMemberSpend shape, make model_group nullable and add the identity unique index the bulk upsert arbitrates on in a new migration, drop the duplicate model and migration, and feed both the member-header hierarchy and the key's customer usage attribution through the shared daily spend projection so neither path double-writes.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(pagerduty): tolerate failure metadata without customer hierarchy ids

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(accounting): key daily customer spend rows on main's hashed identity

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(pagerduty): read customer ids from failure metadata through a typed lookup

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: moe-berri <moe@berri.ai>
2026-11-12 20:43:44 -08:00
..
image test(image): point admin MCP schema push at /app/litellm/schema.prisma (#51446) 2026-11-12 16:18:01 -08:00
migrations test(integration): point database tests at the moved litellm/proxy-extras package (#51453) 2026-11-12 20:27:00 +00:00
test_alerts.py feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
test_chunked_in_lists.py ci: fail on new unbounded SQL IN lists and add a Prisma chunking helper (#42629) 2026-09-26 13:40:44 -07:00
test_cleanup_transactions.py feat(proxy): run spend log cleanup from a DB-backed scheduled job table (#50131) 2026-11-11 18:22:02 -08:00
test_global_spend_refresh_writer.py fix(spend): run the MonthlyGlobalSpend refresh on the writer when a read replica is configured (#45699) 2026-10-10 00:49:13 -07:00
test_harness_lifecycle.py ci: remove CircleCI (#50950) 2026-11-11 15:38:27 -08:00
test_managed_file_flat_ids_index.py test(integration): point database tests at the moved litellm/proxy-extras package (#51453) 2026-11-12 20:27:00 +00:00
test_migration_entrypoint.py chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
test_partition_transactions.py test: fix stale and flaky tests across CircleCI, GHA and Buildkite (#45530) 2026-10-09 11:40:14 -07:00
test_performance_alerts.py fix(alerts): stop detecting traffic drops (#51338) 2026-11-11 20:22:24 -08:00
test_prisma_engine_port.py fix(proxy): let the OS assign Prisma engine ports (#50850) 2026-11-10 07:28:55 +00:00
test_prisma_migration_lock.py test(integration): fix four flaky integration tests (#49554) 2026-11-02 09:23:17 -08:00
test_proxy_boot_without_general_settings.py test(integration): point database tests at the moved litellm/proxy-extras package (#51453) 2026-11-12 20:27:00 +00:00
test_proxy_database_lifespan.py test(integration): point database tests at the moved litellm/proxy-extras package (#51453) 2026-11-12 20:27:00 +00:00
test_reader_writer_regeneration.py test(integration): give each owned proxy a private database and Redis by default (#47213) 2026-10-18 03:37:41 +00:00
test_request_log_indexes_at_boot.py test(integration): point database tests at the moved litellm/proxy-extras package (#51453) 2026-11-12 20:27:00 +00:00
test_roi_observed.py feat(roi): measure shipping velocity, quality, and recorded spend (#44426) 2026-10-03 23:07:34 +00:00
test_roi_sync_store.py feat(proxy): add native ROI calculator for gateway spend vs merged PRs (#43669) 2026-09-30 14:16:41 -07:00
test_scheduled_job_runs.py test(integration): point database tests at the moved litellm/proxy-extras package (#51453) 2026-11-12 20:27:00 +00:00
test_skill_publication.py feat(skills)!: version published Skills Hub updates (#50152) 2026-11-05 00:19:38 -08:00
test_skill_submissions.py feat(skills): let authors edit and withdraw pending submissions (#51312) 2026-11-12 08:30:10 -08:00
test_spend_lock_order.py chore: move scripts and runtime sources under litellm (#51006) 2026-11-12 04:19:57 +00:00
test_spendlogs_delivery.py chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
test_spendlogs_ledger_parity.py feat(proxy): enforce customer org, team and member budgets and limits on the request path (#51489) 2026-11-12 20:43:44 -08:00
test_transaction_atomicity.py test(integration): add read-replica routing harness to the CircleCI integration suite (#42692) 2026-09-24 00:25:03 -07:00
test_v1_migration_error_logging.py test(integration): point database tests at the moved litellm/proxy-extras package (#51453) 2026-11-12 20:27:00 +00:00