The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ci): bound setup steps so pytest always gets its full budget
mateo-berriefd98bb1b40b
diff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.ymlindex 1de1faefd49..e91eb2240d3 100644--- a/.github/workflows/_test-unit-base.yml+++ b/.github/workflows/_test-unit-base.yml@@ -26,10 +26,14 @@ on:type: numberdefault: 20setup-timeout-minutes:- description: "Timeout allowance for everything before the test step"+ description: >-+ Timeout allowance for everything before the test step. Must stay >= the+ sum of the per-step timeouts on the setup steps below, which is what+ makes the test budget above a floor rather than a hope: setup cannot+ overrun into it without failing its own step first.required: falsetype: number- default: 12+ default: 30max-failures:description: "Stop after this many failures"required: false@@ -58,24 +62,29 @@ jobs:steps:- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0+ timeout-minutes: 3with:persist-credentials: false- name: Detect backend-relevant changesid: changes+ timeout-minutes: 2uses: ./.github/actions/detect-backend-changes- name: Set up Python+ timeout-minutes: 3uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0with:python-version: "3.12"- name: Set up uv+ timeout-minutes: 3uses: ./.github/actions/setup-uv-with-retrieswith:version: "0.10.9"- name: Cache uv dependencies+ timeout-minutes: 5uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0with:path: |@@ -87,15 +96,18 @@ jobs:- name: Install dependenciesif: steps.changes.outputs.decision != 'skip'+ timeout-minutes: 8run: |.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml- name: Cache Prisma binariesif: steps.changes.outputs.decision != 'skip'+ timeout-minutes: 3uses: ./.github/actions/cache-prisma-binaries- name: Generate Prisma clientif: steps.changes.outputs.decision != 'skip'+ timeout-minutes: 3run: |uv run --no-sync prisma generate --schema litellm/proxy/schema.prismadiff --git a/tests/code_coverage_tests/check_prisma_binary_cache.py b/tests/code_coverage_tests/check_prisma_binary_cache.pyindex 2544ec9708f..501688385ff 100644--- a/tests/code_coverage_tests/check_prisma_binary_cache.py+++ b/tests/code_coverage_tests/check_prisma_binary_cache.py@@ -20,11 +20,12 @@ Three invariants keep that download off the critical path:import reimport sys-from collections.abc import Iterator+from collections.abc import Iterator, Mappingfrom pathlib import Pathfrom typing import Finalimport yaml+from pydantic import BaseModel, Field, ValidationErrorREPO_ROOT: Final = Path(__file__).resolve().parent.parent.parentWORKFLOWS_DIR: Final = REPO_ROOT / ".github" / "workflows"@@ -50,25 +51,38 @@ def resolve_prisma_version(lock_text: str) -> str | None:return match.group("version") if match else None-def iter_jobs(workflow: object) -> Iterator[tuple[str, dict]]:- jobs: Final = workflow.get("jobs") if isinstance(workflow, dict) else None- if not isinstance(jobs, dict):- return- yield from ((name, job) for name, job in jobs.items() if isinstance(job, dict))+class WorkflowStep(BaseModel):+ """The two step fields this guard reads; every other key is ignored."""++ run: str | None = None+ uses: str | None = None++ def generates_prisma_client(self) -> bool:+ return self.run is not None and any(m in self.run for m in PRISMA_GENERATE_MARKERS)++ def restores_cache(self) -> bool:+ return self.uses == CACHE_ACTION-def job_steps(job: dict) -> tuple[dict, ...]:- steps: Final = job.get("steps")- return tuple(s for s in steps if isinstance(s, dict)) if isinstance(steps, list) else ()+class WorkflowJob(BaseModel):+ # Absent for jobs that delegate to a reusable workflow via a job-level `uses`.+ steps: tuple[WorkflowStep, ...] = ()-def step_generates_prisma_client(step: dict) -> bool:- run: Final = step.get("run")- return isinstance(run, str) and any(m in run for m in PRISMA_GENERATE_MARKERS)+class Workflow(BaseModel):+ jobs: Mapping[str, WorkflowJob] = Field(default_factory=dict)-def step_restores_cache(step: dict) -> bool:- return step.get("uses") == CACHE_ACTION+def parse_workflow(text: str) -> Workflow | str:+ """Validate untyped YAML at the boundary so the checks below stay typed.++ Returns the parsed workflow, or a description of why it could not be read.+ """+ parsed: Final = yaml.safe_load(text)+ try:+ return Workflow.model_validate(parsed if isinstance(parsed, dict) else {})+ except ValidationError as exc:+ return f"does not parse as a workflow: {exc.error_count()} schema error(s)"def lock_errors(lock_text: str) -> Iterator[str]:@@ -87,10 +101,14 @@ def workflow_errors(rel: Path, text: str) -> Iterator[str]:f"land in the version-keyed default path the {CACHE_ACTION} action restores.")- for job_name, job in iter_jobs(yaml.safe_load(text)):- steps: Final = job_steps(job)- if any(map(step_generates_prisma_client, steps)) and not any(- map(step_restores_cache, steps)+ workflow: Final = parse_workflow(text)+ if isinstance(workflow, str):+ yield f"{rel}: {workflow}"+ return++ for job_name, job in workflow.jobs.items():+ if any(s.generates_prisma_client() for s in job.steps) and not any(+ s.restores_cache() for s in job.steps):yield (f"{rel}: job `{job_name}` generates the Prisma client without a "