fix(stats): count coverage against all 15 libraries - #11835
Merged
Merged
Conversation
The stats-page coverage matrix divided by a hardcoded 9 — a leftover from when nine libraries were supported — so a fully covered spec showed "15/9" and the "of N possible" total was computed against the wrong denominator. /insights/dashboard now serves total_libraries (len(SUPPORTED_LIBRARIES), the same value already behind coverage_percent) and the page renders the matrix against it, so the denominator tracks the library set. Also reworks the cells for legibility: 14px instead of 10px, full coverage as solid brand green and anything below it outlined in amber (dashed when a spec has no implementation), a labelled three-state legend instead of the less/more opacity ramp, and a count of specs below full coverage in the summary line — the incomplete specs are the minority and were the hardest cells to spot. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AkKTuCSmiEeUaPQDK5kXqS
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The redesigned cells have insufficient touch-target sizing and light-theme contrast, and the compatibility fallback lacks regression coverage.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes stats-page coverage calculations to use all supported libraries and improves incomplete-coverage visibility.
Changes:
- Adds
total_librariesto the dashboard API. - Updates coverage totals, cells, legend, and tests.
- Documents the fix and visual changes.
File summaries
| File | Description |
|---|---|
api/routers/insights.py |
Exposes the canonical library count. |
app/src/pages/StatsPage.tsx |
Corrects coverage rendering and redesigns cells. |
app/src/pages/StatsPage.test.tsx |
Tests 15-library totals and labels. |
tests/unit/api/test_routers.py |
Verifies the API field. |
changelog.d/stats-coverage-denominator.md |
Records the changes. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Addresses the Copilot review on the coverage matrix: - The amber outline was the only marker of the partial/none states, and amber is one of the palette colors the style guide flags as failing on the cream background (1.46:1, below WCAG 1.4.11's 3:1). Switched both incomplete branches to an ink stroke, which is theme-adaptive and keeps the solid/dashed distinction. - Each cell is now a 16px mark centred in a 24px link, so the tap target meets WCAG 2.2 SC 2.5.8 without turning the dense strip into a grid of chunky blocks. - Added a test for the library_stats fallback, so a frontend-before-API deploy (payload without total_libraries) keeps the right denominator. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AkKTuCSmiEeUaPQDK5kXqS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
9(a leftover from when nine libraries were supported), so a fully covered spec rendered as15/9and the "of N possible" total used the wrong denominator. The API already computescoverage_percentagainstlen(SUPPORTED_LIBRARIES)(15), so only the page was wrong./insights/dashboardnow servestotal_librariesandStatsPagerenders the matrix against it (falling back tolibrary_stats.lengthfor a frontend-before-API deploy), so the denominator tracks the library set instead of drifting from it.· N below 15/15in the summary line. The interesting signal is which specs are not complete, and those are the minority the old opacity ramp buried.Test plan
uv run pytest tests/unit/api -q— 794 passed; the dashboard test now assertstotal_libraries == len(SUPPORTED_LIBRARIES).yarn vitest run src/pages/StatsPage.test.tsx src/pages/DebugPage.test.tsx— green, with three new cases: the summary line renders987 of 2130 possible · 1 below 15/15, cells are labelledBasic Scatter Plot: 1/15/Basic Line Plot: 15/15, and a payload withouttotal_librariesstill derives 15 fromlibrary_stats.npx tsc --noEmit,eslint,prettier,uv run ruff check,uv run ruff format --check,uv run mypy api/routers/insights.py— all clean./statsin headless Chromium against a mocked dashboard (121 complete specs + 3 partial + 1 empty) at 1280×900 and 390×844, light and dark. Summary read97.4% · 1836 of 1875 possible · 4 below 15/15; the four outliers are immediately pickable out of the strip in all four combinations. A live run against the production API was not possible here (no DB credentials in the session).Checklist
changelog.d/stats-coverage-denominator.mdadded (Fixed + Changed, noCHANGELOG.mdbullet)docs/reference/api.mddescribes/insights/dashboardwithout a field list, so the new response field needs no doc change.🤖 Generated with Claude Code
https://claude.ai/code/session_01AkKTuCSmiEeUaPQDK5kXqS