mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
fix(ci): bugbot — persist compat-results artifacts from PR gate
The conftest's pytest_sessionfinish writes per-cell tagged-union JSON (compat-results.json) and the per-provider rate-limit summary to paths controlled by COMPAT_RESULTS_PATH / COMPAT_RATE_LIMIT_SUMMARY_PATH. The PR gate never set either env var, so the artifacts were written to the working directory — but store_test_results only collects test-results/junit.xml, leaving the per-cell JSON unreachable from the CircleCI artifact browser. Reviewers triaging a red PR gate couldn't pull the cell-level breakdown without re-running. Point both env vars at a dedicated compat-artifacts/ directory and add a store_artifacts step so the JSON blobs become downloadable. Also extend the existing PR-gate wiring test to pin all three pieces: COMPAT_RESULTS_PATH override, COMPAT_RATE_LIMIT_SUMMARY_PATH override, and at least one store_artifacts step whose path matches the directory the exports point at. Without the cross-check, a future refactor could break the chain (e.g. only export the env vars, or only add the store_artifacts step) and the wiring would silently drop the artifacts again. Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
This commit is contained in:
parent
c23b1bba8c
commit
0915e87f08
2 changed files with 61 additions and 2 deletions
|
|
@ -2370,7 +2370,15 @@ jobs:
|
|||
command: |
|
||||
export LITELLM_PROXY_BASE_URL="http://localhost:4000"
|
||||
export LITELLM_PROXY_API_KEY="sk-1234"
|
||||
mkdir -p test-results
|
||||
mkdir -p test-results compat-artifacts
|
||||
# Point the conftest's tagged-union artifacts at a directory
|
||||
# we explicitly persist below via store_artifacts. Without
|
||||
# this override, the conftest defaults to compat-results.json
|
||||
# / compat-rate-limit-summary.json in the working directory,
|
||||
# which no CI step collects -- so reviewers can't pull the
|
||||
# per-cell pass/fail breakdown when a red gate needs triage.
|
||||
export COMPAT_RESULTS_PATH="$(pwd)/compat-artifacts/compat-results.json"
|
||||
export COMPAT_RATE_LIMIT_SUMMARY_PATH="$(pwd)/compat-artifacts/compat-rate-limit-summary.json"
|
||||
uv run --no-sync python -m pytest -vv tests/claude_code/ \
|
||||
--ignore=tests/claude_code/_driver_unit_tests \
|
||||
--ignore=tests/claude_code/_builder_unit_tests \
|
||||
|
|
@ -2380,9 +2388,17 @@ jobs:
|
|||
--durations=10
|
||||
no_output_timeout: 30m
|
||||
|
||||
# Store test results
|
||||
# Store test results (JUnit) for CircleCI's test-summary view.
|
||||
- store_test_results:
|
||||
path: test-results
|
||||
# Persist the compat-matrix artifacts (per-cell tagged-union JSON
|
||||
# + per-provider rate-limit summary) so a red gate can be triaged
|
||||
# from the CircleCI UI without re-running. `store_test_results`
|
||||
# only handles JUnit-shaped XML, so these JSON blobs need their
|
||||
# own store_artifacts step.
|
||||
- store_artifacts:
|
||||
path: compat-artifacts
|
||||
destination: compat-artifacts
|
||||
|
||||
upload-coverage:
|
||||
docker:
|
||||
|
|
|
|||
|
|
@ -113,6 +113,49 @@ def test_pr_gate_job_exports_proxy_env_used_by_tests(
|
|||
assert "LITELLM_PROXY_API_KEY" in commands
|
||||
|
||||
|
||||
def test_pr_gate_job_persists_compat_result_artifacts(
|
||||
circleci_config: dict,
|
||||
) -> None:
|
||||
"""The conftest writes per-cell tagged-union JSON + the per-provider
|
||||
rate-limit summary to paths controlled by COMPAT_RESULTS_PATH /
|
||||
COMPAT_RATE_LIMIT_SUMMARY_PATH. The PR gate must (1) point both env
|
||||
vars at a known directory, and (2) `store_artifacts` that directory
|
||||
so reviewers can pull the breakdown when a red gate needs triage.
|
||||
|
||||
Without this, the conftest silently writes the artifacts to the
|
||||
working directory and no CI step persists them.
|
||||
"""
|
||||
job = circleci_config["jobs"][JOB_NAME]
|
||||
commands = "\n".join(_job_step_runs(job))
|
||||
assert "COMPAT_RESULTS_PATH" in commands, (
|
||||
"PR gate must override COMPAT_RESULTS_PATH so the compat JSON "
|
||||
"lands in a directory we explicitly persist below."
|
||||
)
|
||||
assert "COMPAT_RATE_LIMIT_SUMMARY_PATH" in commands, (
|
||||
"PR gate must override COMPAT_RATE_LIMIT_SUMMARY_PATH so the "
|
||||
"per-provider rate-limit summary lands in a persisted directory."
|
||||
)
|
||||
# The chosen directory must be wired into a store_artifacts step.
|
||||
store_artifacts_paths: list[str] = []
|
||||
for step in job.get("steps", []):
|
||||
if not isinstance(step, dict):
|
||||
continue
|
||||
sa = step.get("store_artifacts")
|
||||
if isinstance(sa, dict) and isinstance(sa.get("path"), str):
|
||||
store_artifacts_paths.append(sa["path"])
|
||||
assert store_artifacts_paths, (
|
||||
"PR gate must declare at least one store_artifacts step so the "
|
||||
"compat-results.json / compat-rate-limit-summary.json can be "
|
||||
"downloaded from the CircleCI artifact browser."
|
||||
)
|
||||
# And the export must point at that directory (any of them), so the
|
||||
# conftest actually writes inside the persisted tree.
|
||||
assert any(path in commands for path in store_artifacts_paths), (
|
||||
"PR gate exports COMPAT_RESULTS_PATH but not into any directory "
|
||||
f"declared by store_artifacts (declared: {store_artifacts_paths})."
|
||||
)
|
||||
|
||||
|
||||
def test_existing_proxy_e2e_anthropic_job_unchanged(circleci_config: dict) -> None:
|
||||
"""No regression to the existing `proxy_e2e_anthropic_messages_tests`
|
||||
job (acceptance criterion). We don't lock its full body, but we do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue