Repository navigation
feat(health): make the Coverage tab a Tests tab that answers without a report - #1758
Conversation
|
✅ Health of changed files: 7.2 → 7.5 (+0.4) 📋 At a glance ✅ Health gate: passed 📌 Before you merge
🎯 Blast radius (symbols whose signature this PR changed, and who calls them)
🔎 More signals (3)🗺️ Change map flowchart LR
subgraph PR ["Changed in this PR (5 modules)"]
m_packages_api_client["packages/api-client (1 file)"]:::changed
m_packages_server["packages/server (1 file)"]:::changed
m_packages_types["packages/types (1 file)"]:::changed
m_packages_ui["packages/ui (8 files)"]:::changed
m_packages_web["packages/web (1 file)"]:::changed
end
d_packages_vscode["packages/vscode"]
m_packages_api_client -->|3 files| d_packages_vscode
d_packages_web["packages/web"]
m_packages_ui -->|2 files| d_packages_web
d_packages_api_client["packages/api-client"]
m_packages_types -->|1 file| d_packages_api_client
d_packages_server["packages/server"]
m_packages_types -->|1 file| d_packages_server
d_packages_server["packages/server"]
m_packages_ui -->|1 file| d_packages_server
classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Solid arrows: code that imports the changed files (59 direct dependents, from the last indexed snapshot). Dashed: history/tests. 🔥 Hotspots touched (5)
2 more
💀 Dead code (1 finding)
📊 See the full report for this PR |
…a report The core answers "does a test reach this file" from the call graph, and #1757 carries that to the API as a `basis`. The UI was the last layer still assuming a coverage report is the only way to know, and in two places it contradicted the product: the empty state told people to go ingest one while claiming "Nothing is inferred: we read the lines your tests really executed", and the lede repeated the claim. Both now read as they should. Coverage -> Tests on the health tab, the file-page tab and the breadcrumb. The URL stays `/coverage`. One tab, two bases: splitting them would put one question ("is this tested?") in two places and make the reader check both to be sure. Inside the tab "coverage" keeps meaning the measured thing, which is why the health drawer's metric cell stays "Coverage" - a "Tests" cell already sits four rows under it carrying the paired-file flag. The chart is the same component with a prop, not a second chart. On the inferred basis X collapses from a 0-100 continuum to two positions, which is the honest statement about the evidence: two columns read as coarser than a measurement without a disclaimer nobody reads, ingesting a report becomes "the axis gains focus" rather than the price of entry, and a gradient that is never drawn cannot be misread as one. The columns are beeswarmed because X carries one bit there, so horizontal space is otherwise dead and a thousand files stack into two lines; the jitter is seeded off the file path so a re-render does not move the field. Column grounds are the sunset pair, plum and orange, not green and red. Health bands are reserved for health readouts, and painting a static reading in band colours would make it look like a measurement. The dots keep their health band, which is a different mark on a different object, so nothing collides. Nothing on the inferred basis is a percentage or a bar. The hero is a small integer - risky files nothing reaches - because "1,074 of 2,185 reached" begs for a bar and a bar is a percentage. A test asserts no `%` appears anywhere in the rendered view. The file page is the piece that works on install: it names the tests that reach this file, with `via` separating a test whose calls run into it from one that only imports it. Its no-report state stops being a dead end. Also fixes a false tab description ("Line coverage, once a test report has been ingested") which the tab's own docstring requires to stay true above the empty state, and a "1 are reached" plural bug the tests caught. 12 new tests; full packages/ui suite green (1,208).
Pairs with the server side. The badge reads one number off `summary`, so it already declines file rows and modules; it now also declines the inferred map, which it could not render anyway - the inferred basis has no percentage, by design.
The code-health page badges the Tests tab from a deliberately cheap request: `limit=1, module_limit=0`, which its own comment measures at 0.7 KB against the tab's 442 KB. The inferred fallback made that call read every call edge in the repository plus every health metric, on any repo without a coverage report. `include_inferred=false` declines it. Not a third cap: the other two bound how much of an answer comes back, this one decides whether an expensive second answer is computed at all. A declined response omits `basis` rather than reporting "none". The graph was not consulted, which is not the same as the graph having nothing to say, and collapsing the two would leave a consumer unable to tell a repo with no tests from a request that never asked.
The inferred chart painted its two columns as a 6% ground and left the dots on the health ramp. On screen that failed twice over: plum at that opacity is indistinguishable from grey on a light background, so the split was invisible, and the health-banded dots took the entire visual budget to re-say what their own vertical position already said. Health is the Y axis. Colouring a dot by health band is therefore redundant, and it left nothing carrying the one fact the chart exists to show. The dots now take plum for "no test reaches it" and orange for "a test reaches it", and the grounds are gone rather than competing with them. This also keeps green/amber/red off inferred data, which is the point: those carry a measured band, and a static reading should not borrow them.
d174afc to
30f0819
Compare
Test intelligence went from something you configure to something you have. The CLI and MCP tools already reflect that; the web UI was the last layer still assuming a coverage report is the only way to know whether code is tested, and in two places it contradicted the product:
Coverage → Tests
The health tab, the file-page tab and the breadcrumb. The URL stays
/coverage.One tab, two bases. A second tab would split one question — is this tested? — across two places and make you check both to be sure. Inside the tab, "coverage" still means the measured thing.
The chart
RiskCoverageScattertakes abasisprop rather than being rewritten. On the inferred basis the X axis collapses from a 0–100 continuum to two positions: nothing reaches this file, or something does.That is the point, not a fallback. Two columns read as coarser than a measurement without needing a disclaimer, and ingesting a report becomes the axis gains focus rather than the price of entry. A gradient that is never drawn cannot be misread as one.
The columns are beeswarmed because X carries a single bit there, so without spread a thousand files stack into two lines and the mass is invisible. The jitter is seeded off a hash of the file path, so re-rendering does not move the field.
Dots are plum for "nothing reaches it" and orange for "a test reaches it", not the red/amber/green health ramp. Those colours carry a measured band, and a static reading should not borrow them. Height already is the health score, so banding the dots would only re-say their own position while leaving nothing to carry the split.
No percentage anywhere on the inferred basis
The hero figure is a small integer — risky files nothing reaches — because "1,074 of 2,185 reached" invites a progress bar, and a progress bar is the coverage percentage this data cannot claim. A test asserts no
%and no bar element renders.The file page
Names the tests that reach a file, distinguishing a test whose calls run into it from one that only imports it. This works on install, with no setup, and its no-report state is no longer a dead end.
Also fixed
Carries one server change
include_inferred=falselets a caller decline the graph fallback. The code-health page badges this tab from a deliberately cheap request, and without this that request would read every call edge in the repository to compute a number the badge cannot render anyway. It was part of #1757 but did not make its squash, so it rides here.Checks
Typecheck clean across
types,api-client,uiandweb. Fullpackages/uisuite green at 1,209 tests, 13 of them new. Verified against a live index in the browser on both bases.