Repository navigation
ci: run the dashboard API types and Terraform endpoint checks on every change that can alter the spec - #49022
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
[Medium impact] The PR appears safe to merge, with no outstanding findings SummaryExpands the dashboard API-type checks to cover The latest change moves the Terraform regression into the existing workflow test file without changing what it checks. No new actionable issues were found Greptile previously withdrew the request to move subprocess checks outside
Reviews (8) · Last reviewed commit: "test: keep the Terraform trigger test in..." · Reviewed by Greptile |
… and dashboard AGENTS.md
|
|
||
| def _tracked_paths_matching(extended_regex: str) -> frozenset[str]: | ||
| tracked: Final = _git(WORKFLOW.parents[2], "ls-files") | ||
| selected: Final = subprocess.run(["grep", "-E", extended_regex], input=tracked, capture_output=True, text=True) |
There was a problem hiding this comment.
Unit tests start external programs
tests/unit/AGENTS.md bans subprocesses. Move these Git/Bash checks outside tests/unit/, including the workflow and staged-file cases, before merging
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
These files already ran git and bash on main, and no test directory fits script tests, so this PR extends the existing mapped files
There was a problem hiding this comment.
Fair point: test_lint_workflow_diff_gates.py is already the mapped home for these workflow/path-filter checks, and its existing tests invoke git. Moving just the additions would split the coverage without resolving the underlying policy mismatch. I overstated the move-out-of-tests/unit/ suggestion as a merge blocker; I withdraw that request.
The remaining inconsistency is that tests/unit/AGENTS.md explicitly says “In-process. No network or subprocess,” while these tests use subprocesses (and the additions also invoke bash and grep). That may be an intentional exception for workflow-script tests, but it is not documented there. If so, clarifying that exception would prevent future reviews from raising the same concern.
Should I remember this as a review preference: keep workflow/script checks in their existing mapped test files rather than requiring them to move solely because they invoke Git or shell commands?
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit ee7e45f. Configure here.
…y change that can alter the spec (#49022) * ci: run the dashboard API types check on every change that can alter the OpenAPI spec * chore: shorten the spec_pattern comment to a pointer at the CI filter * chore: drop the spec_pattern comment * docs: name the full ui-api-types trigger set in the make check header and dashboard AGENTS.md * test: check make check and CI pick the same files for the API-type sync * ci: run the Terraform provider endpoint audit on enterprise route changes * test: keep the Terraform trigger test in the mapped workflow test file --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> (cherry picked from commit e73f06e)
The dashboard API types check only ran when a PR touched
litellm/proxy/orlitellm/types/, so a PR that changed a response model anywhere else skipped it and merged withschema.d.tsstale. Every later proxy PR then failed the requiredlint passedon drift it didn't causeThis runs the check on any change under
litellm/orenterprise/and on dependency pin changes, since each can change the OpenAPI spec.make checkgets the same fix, and the Terraform provider's endpoint audit now runs onenterprise/route changesOriginal
TLDR
Problem this solves:
lint / ui-api-typesskipped PRs changing spec inputs outside proxy/typeslitellm/rust_bridge/on Oct 2 and merged withschema.d.tsstalemake checkskipped the same files locallyHow it solves it:
litellm/,enterprise/,pyproject.toml, anduv.lockmake checkuses the same trigger set, minus the workflow file itselfenterprise/changesUser Flow
Before: a PR that changes a response model outside
litellm/proxy/orlitellm/types/merges with stale dashboard typeslitellm/tracing/generated/models.py, adding a trace table namelint / ui-api-typescheck prints "nothing to verify" and passes, so the PR merges without a regeneratedschema.d.tslitellm/proxy/runs the check against main, and it fails with "Generated API types are out of sync with the proxy OpenAPI spec"lint passedis red on that PR until someone regenerates the types on mainAfter: the same PR gets the failure itself before it merges
lint / ui-api-typescheck regenerates the types and fails with "Generated API types are out of sync with the proxy OpenAPI spec" and thenpm run gen:apihintnpm run gen:api, commitschema.d.ts, and the check passeslitellm/proxy/stay greenA PR that only adds a management route under
enterprise/now also runs the Terraform provider audit, which it used to skipPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreScreenshots / Proof of Fix
Last updated: ee7e45f. QA ran on 5b50007 (CI legs), 538c01d (
make checklegs), and 40b70c9 (Terraform legs). Changes after the first two: a main merge, comment and docs edits, tests, and the Terraform paths. Then a test moved files. Proof remains valid because the merge left the workflow, script, generator, andmodels.pyunchanged, and the Terraform paths have their own legs. Verification: the make check tests pass at the tipThis ran the real
lint / ui-api-typesjob on GitHub's runners. On a fork I opened the same one-line PR into a copy of main and into a copy of this branch, adding"llm_traces"to the trace table names inlitellm/tracing/generated/models.py. Only the workflow file GitHub runs from the merge commit differsd9c9d842985b50007f9e5b50007f9emake checkbefore3f5e42d032make checkafter538c01dc663f5e42d03240b70c919eSteps to reproduce the CI and make check legs
Steps, from a clone with a fork remote
fork(useorigin/mainfor the before leg and this PR's branch for the after leg as$base):git push fork $base:refs/heads/litellm_qa_base && git switch --detach $basesed -i 's/"spend_logs"\]/"spend_logs", "llm_traces"]/' litellm/tracing/generated/models.py && git commit -qam "feat(tracing): add the llm_traces trace table name" && git push fork HEAD:refs/heads/litellm_qa_prgh pr create -R <fork> --base litellm_qa_base --head litellm_qa_pr --fill, then open thelint / ui-api-typesjobcd ui/litellm-dashboard && npm run gen:api, commitsrc/lib/http/schema.d.ts, and pushTerraform legs: the probe PR, then what each base started
On the same fork I opened a PR into a copy of main and one into a copy of this branch. Each adds one route to
enterprise/litellm_enterprise/proxy/management_endpoints/project_endpoints.py:Before (PR). Seven workflows started and the Terraform Provider workflow is not one of them:
After. The Terraform Provider workflow started, and its endpoint audit fails on the route:
After, the headline case. The job now runs, and its stale-types step fails:
After: the drift the same step printed above the error
Before: the check is skipped and the job passes
After, types regenerated: the job passes
make checkbefore, at the merge base: the API-type sync is skippedmake checkafter, at this branch: the stale types fail the checkType
🐛 Bug Fix
🚄 Infrastructure
Caveats (if any)
Medium
schema.d.tsis stale, everylitellm/orenterprise/PR failslint passed, and so doesmake checkLow
make checkruns the type sync for non-Pythonlitellm/changes, about 3.5 min on a loaded machinetests/unit, as the mapped file already didDecisions
Why this filter and not another one
uv syncandnpm cilitellm/instead of listing more subfolders. The spec is built fromlitellm.proxy.proxy_server, which imports models fromlitellm/models,litellm/router_strategy,litellm/tracing,litellm/telemetry, andlitellm/litellm_core_utilstoday (78 of 1044 components), and a list would go stale the next time someone adds a moduleenterprise/becauselitellm_enterpriseis a workspace package whose models show up in the spec (audit logs, email events)pyproject.tomlanduv.lockbecause about 160 components come fromopenai,fastapi, andmcpmodels, so a version bump can change the spec with no repo code changelitellm-rust/andlitellm-proxy-extras/. The spec only reads Python models, and the Rust trace types reach it through generated files underlitellm/tracing/generated/, which the filter now coverslitellm/too, so a cost-map-only PR also runs the check. In CI it runs next to the longer lint jobs, whilemake checkwaits on it alonemake checkin the same PR, since it would keep skipping locally what CI now fails onschema.d.tscurrententerprise/**to the Terraform provider audit's PR paths, since/project/infoand/project/list, which the provider calls, are enterprise routes. Left outlitellm/types/and dependency files there, because that audit only compares route paths and methodsFinal Attestation
/live-pr-risk report
Verdict: no breaking path found. The change widens two trigger lists and edits two skip messages. Graph walked at 0aacbab, live legs at 5b50007 (CI) and 538c01d (make check), carried to af3e8a0 because later commits change only comments, docs, and tests. The Terraform paths commit got its own walk and live legs at 40b70c9. Carried to ee7e45f, which only moves that commit's test into the mapped test file.
Breaking
None observed. Every dependent that reads the changed values was driven live on base and head or is covered by a test that runs the real script.
Backward incompatible
ui-api-typesdetect step changed text. Nothing parses it (grep over .github, scripts, tests, ~/.claude tooling found only the new test).litellm/,enterprise/,pyproject.tomloruv.lockfile now run gen:api. This is the PR's intent, and it is the Medium merge-skew caveat's cause (a drifted main now fails everylitellm/PR, not only proxy/types PRs). Disposition: kept as an inherent caveat in the PR body, the fix being whichever PR commits the regenerated schema.d.ts.litellm/now runs gen:api in make check (about 77s). Disposition: Low caveat, kept as net-negative to fix.Regression risk
litellm/,enterprise/,pyproject.tomloruv.locknow prints a second SKIPPED warning. Advisory output only, no exit code change. Not driven live (each make check leg waits over an hour for a machine slot).litellm/orenterprise/files, since the API-type sync now runs for them. That is correct for the new trigger set and is covered for pyproject/uv.lock by the new tests through the real script.Dependency graph
relevantrelevanttest-terraform-provider.yml had its own narrower filter, now widened to
enterprise/**. No ruleset requires its checks and no workflow reads its result. No other workflow, hook, or ~/.claude tool duplicates the filter. The legacy suites do not reach it. There is no proxy HTTP surface.Not verified
Bugbot summary