diff --git a/ci_cd/cost_map_guard.py b/ci_cd/cost_map_guard.py index c1aeaabc5d2..a23c149388c 100644 --- a/ci_cd/cost_map_guard.py +++ b/ci_cd/cost_map_guard.py @@ -3,8 +3,9 @@ Every pull request whose diff against its merge base touches one of the two cost map files gets the file checks: the files parse and the backup copy matches the root file. A pull request that leaves both untouched skips them, since merging it keeps the base branch's copies and its head tree only carries whatever state the -branch was cut from. Pull requests from the cost map sync bot (branches named litellm_cost_map_sync_*) always -get the file checks and additionally may only touch those two files and may only add or update models. +branch was cut from. Pull requests from the cost map sync bots (branches named litellm-providers/price-sync* or +litellm_cost_map_sync_*) always get the file checks and additionally may only touch those two files and may only +add or update models. """ from __future__ import annotations @@ -21,7 +22,7 @@ from typing import Final COST_MAP_PATH: Final = "model_prices_and_context_window.json" BACKUP_PATH: Final = "litellm/model_prices_and_context_window_backup.json" GUARDED_PATHS: Final = (COST_MAP_PATH, BACKUP_PATH) -BOT_BRANCH_PREFIX: Final = "litellm_cost_map_sync_" +BOT_BRANCH_PREFIXES: Final = ("litellm-providers/price-sync", "litellm_cost_map_sync_") SPECIAL_ROOT_KEYS: Final = frozenset({"sample_spec", "fallback_generalizations"}) EVALUATION_OUTPUT_PRICE_SOURCES: Final[Mapping[str, str]] = MappingProxyType({}) @@ -171,7 +172,7 @@ def main(argv: Sequence[str]) -> int: parser.add_argument("--head", required=True, help="head commit of the pull request") parser.add_argument("--head-ref", required=True, help="head branch name of the pull request") args: Final = parser.parse_args(argv) - bot: Final = args.head_ref.startswith(BOT_BRANCH_PREFIX) + bot: Final = args.head_ref.startswith(BOT_BRANCH_PREFIXES) changed: Final = changed_files(args.base, args.head) if changed is None: print(f"cost map guard failed: git diff {args.base} {args.head} failed, so the changed files are unknown") diff --git a/tests/unit/test_cost_map_guard.py b/tests/unit/test_cost_map_guard.py index 578d5482822..a3d2f4d70be 100644 --- a/tests/unit/test_cost_map_guard.py +++ b/tests/unit/test_cost_map_guard.py @@ -244,7 +244,10 @@ def _run_guard(repo: Path, base: str, head: str, head_ref: str) -> subprocess.Co ("head_ref", "expected_code", "expected_line"), [ (BOT_REF, 1, "- bot PRs may not remove models: openrouter/b"), + ("litellm-providers/price-sync-openrouter", 1, "- bot PRs may not remove models: openrouter/b"), + ("litellm-providers/price-sync", 1, "- bot PRs may not remove models: openrouter/b"), ("litellm_fix_pricing", 0, "cost map guard passed (human PR, file checks only)"), + ("fix-openrouter-price-sync", 0, "cost map guard passed (human PR, file checks only)"), ], ) def test_main_reads_both_revisions_from_git(