test: add e2e coverage module metrics - #32403
Conversation
|
|
Greptile SummaryThis PR splits the single "LLMs" dashboard module into "Core LLMs" (
Confidence Score: 4/5Safe to merge; changes are entirely within the tests/e2e tooling layer with no production code impact. The split and schema tightening are clean and consistent with all existing YAML registry data. The one omission worth noting is that p0_gaps (the list of specific uncovered P0 cell IDs) is computed on every run but silently dropped from both JSON and Prometheus output, leaving downstream alerting jobs without the gap-ID detail. tests/e2e/coverage_registry/collector.py — _report_dict omits the p0_gaps field that is always populated by compute_coverage.
|
| Filename | Overview |
|---|---|
| tests/e2e/coverage_registry/collector.py | Adds JSON/Prometheus output formats and --strict/--fail-on-collection-errors CLI flags; logic is correct but p0_gaps is computed yet omitted from JSON serialization. |
| tests/e2e/coverage_registry/schema.py | Introduces typed LlmEndpoint/LlmRoute/LlmCapability literals and replaces flat ROLLUP dict with dashboard_module() function; PREFIX_ROLLUP covers all non-llm module keys, no KeyError risk. |
| tests/e2e/coverage_registry/test_collector.py | Adds well-targeted tests for Core/Non-Core rollup, text render language, JSON, and Prometheus output; assertions are correct and match actual render logic. |
| tests/e2e/management/test_management_e2e.py | Fixes four orphan markers: wrong management. prefix corrected to mgmt., two .persists assertions updated to .happy_path to match actual registry cells, and a misplaced key-permission marker moved to the correct other.auth.virtual_key cell. |
Reviews (1): Last reviewed commit: "Add e2e coverage dashboard metrics" | Re-trigger Greptile
| def _report_dict(report: CoverageReport) -> dict[str, object]: | ||
| return { | ||
| "covered": report.covered, | ||
| "total": report.total, | ||
| "coverage_percent": report.coverage_percent, | ||
| "modules": [ | ||
| { | ||
| "module": m.module, | ||
| "covered": m.covered, | ||
| "total": m.total, | ||
| "coverage_percent": m.coverage_percent, | ||
| "p0_covered": m.p0_covered, | ||
| "p0_total": m.p0_total, | ||
| } | ||
| for m in report.modules | ||
| ], | ||
| "orphan_markers": list(report.orphan_markers), | ||
| "collection_errors": list(report.collection_errors), | ||
| } | ||
|
|
||
|
|
||
| def render_json(report: CoverageReport) -> str: | ||
| return json.dumps(_report_dict(report), indent=2, sort_keys=True) |
There was a problem hiding this comment.
p0_gaps computed but never serialized
compute_coverage() always populates report.p0_gaps (the sorted list of uncovered P0 cell IDs), but _report_dict() omits it entirely. As a result, the JSON output shipped to Grafana only includes per-module p0_covered/p0_total counts — the actual gap IDs are silently dropped. Any alert or downstream job that needs to enumerate specific P0 cells currently failing to meet coverage would have no way to retrieve them from the collector output.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
3ea27bd
into
litellm_internal_staging
What improves
chat_completions,messages,responses) and Non-Core LLMs.@pytest.mark.covers(...)markers must point to known coverage cells.Checks
PYTHONPATH=tests/e2e uv run pytest tests/e2e/coverage_registry/test_collector.py -qPYTHONPATH=. uv run python -m coverage_registry.collector --strictPYTHONPATH=. uv run python -m coverage_registry.collector --format prometheus --strictuv run ruff check --target-version py312 tests/e2e/coverage_registry