Commit db2e76f
fix(coverage): stop the report hiding what it dropped, and name whole-file failures (#963)
Two silent failures in the parse-coverage report, both made visible by the
Phase 2 range refinement that came before this.
## The caps dropped ranges with no signal
Two caps sat in series and both returned early without saying anything:
CBM_MAX_ERROR_REGIONS = 64 internal/cbm/cbm.c
COVERAGE_RANGE_MAX = 128 src/mcp/mcp.c
Raising only the first would have moved the clip from 64 to 128, so both move
to 256. This was live behaviour, not a theoretical limit: after Phase 2 split
one whole-file range into many small ones, src/cli/cli.c and tests/test_cli.c
both reported exactly 64 ranges — the cap binding, dead-on, twice. Every
coverage figure measured before this change was a floor. With the cap at 256
the true numbers are cli.c 13.9% (not 9.8%) and test_cli.c 3.1%, and the
longest list in the repo is 85 ranges.
A raised cap is still a cap, so the report now says when it clipped:
- cbm_error_regions_t gained a `dropped` counter, and cbm_collect_error_regions
walks to the end instead of stopping at the cap, so the count is exact rather
than a lower bound. That costs little — the walk never descends into an ERROR
subtree.
- cbm_error_ranges_str appends ",+<N>" when N ranges were thrown away.
- coverage_add_ranges reads that marker and sets "truncated": true, and also
sets it when its own limit stops the loop. Before this the marker was
invisible: the parser stopped at the '+' with no error and no leftover, so a
clipped list arrived looking complete.
- objectscript_export_append_error_ranges strips markers off both operands
before joining two Studio Export parts and adds one back at the end. A marker
left mid-string would make every reader stop there and silently lose every
range after it.
## A whole-file range is not advice
"Look at lines 1 to 13047" of a 13046-line file tells a reader nothing. Those
files now carry their own kind rather than being described as partially
covered.
New `parse_unusable` field in CBMFileResult, set when one range covers 80% or
more of the file. Its customers are non-C languages: the Phase 2 refinement
that narrows a whole-file range using the preprocessed parse only runs for C,
C++ and CUDA, so a Python, Java, Ruby or TypeScript file whose root node is
ERROR still reports 1-N. Verified against real files in all four.
The kind is `parse_unusable`, not `parse_failed`. index_coverage.kind already
means one of two things — indexed-but-partial, or a skip phase saying the file
was never indexed at all — and `parse_failed` reads as the second when it is
the first. The store.c schema comment, which is the only written record of this
vocabulary, now describes all three classes and says why.
Two places would have mislabelled the new kind as "skipped", which is exactly
that confusion: coverage_status fell through to its catch-all pass, and
add_coverage_report fell into its else branch. A reader who finds a file under
"skipped" believes it is absent from the graph, when it was indexed. Both now
have explicit branches. index_status gained parse_unusable_count so a CI gate
can read it without parsing anything else, get_code_snippet says "read the
source directly" instead of naming useless ranges, and the three tool
descriptions that listed two coverage kinds now list three.
## Tests
Seven added. The cap test moved from 64 to 256; a new test asserts the marker
carries a real drop count and that nothing follows it; an inverse test asserts
an under-cap file carries no marker at all. For the new kind: a Python file
whose root is ERROR is unusable, a file with a local parse failure stays
partial, a clean file is neither, and — the one that matters most — the
#ifdef-split C file that started this work is partial and never unusable. If
that last one ever flips, the Phase 2 refinement has stopped working.
Full suite: 7732 passed, 28 failed, 7 skipped. The 28 are pre-existing
agent-client install/uninstall failures in the cli suite, identical in count
and identity at clean HEAD.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VgDHuhXmjdrwzowPN68wsC1 parent c224c9b commit db2e76f
7 files changed
Lines changed: 447 additions & 45 deletions
File tree
- internal/cbm
- src
- mcp
- pipeline
- store
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
777 | | - | |
778 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
779 | 785 | | |
780 | 786 | | |
781 | 787 | | |
782 | 788 | | |
| 789 | + | |
783 | 790 | | |
784 | 791 | | |
785 | 792 | | |
786 | 793 | | |
| 794 | + | |
787 | 795 | | |
788 | 796 | | |
789 | 797 | | |
| |||
843 | 851 | | |
844 | 852 | | |
845 | 853 | | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
846 | 858 | | |
847 | 859 | | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | 860 | | |
852 | | - | |
| 861 | + | |
853 | 862 | | |
854 | 863 | | |
855 | 864 | | |
| |||
1290 | 1299 | | |
1291 | 1300 | | |
1292 | 1301 | | |
1293 | | - | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
1294 | 1307 | | |
1295 | 1308 | | |
1296 | 1309 | | |
| |||
1322 | 1335 | | |
1323 | 1336 | | |
1324 | 1337 | | |
1325 | | - | |
| 1338 | + | |
1326 | 1339 | | |
1327 | 1340 | | |
1328 | 1341 | | |
| |||
1349 | 1362 | | |
1350 | 1363 | | |
1351 | 1364 | | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
1352 | 1393 | | |
1353 | | - | |
| 1394 | + | |
1354 | 1395 | | |
1355 | 1396 | | |
1356 | 1397 | | |
1357 | | - | |
| 1398 | + | |
1358 | 1399 | | |
1359 | 1400 | | |
1360 | 1401 | | |
| |||
1363 | 1404 | | |
1364 | 1405 | | |
1365 | 1406 | | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1366 | 1410 | | |
1367 | 1411 | | |
1368 | 1412 | | |
| |||
1680 | 1724 | | |
1681 | 1725 | | |
1682 | 1726 | | |
1683 | | - | |
| 1727 | + | |
1684 | 1728 | | |
1685 | 1729 | | |
1686 | 1730 | | |
| |||
1889 | 1933 | | |
1890 | 1934 | | |
1891 | 1935 | | |
1892 | | - | |
| 1936 | + | |
1893 | 1937 | | |
1894 | 1938 | | |
1895 | 1939 | | |
| |||
1914 | 1958 | | |
1915 | 1959 | | |
1916 | 1960 | | |
1917 | | - | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
1918 | 1965 | | |
1919 | 1966 | | |
1920 | 1967 | | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
1921 | 1980 | | |
1922 | 1981 | | |
1923 | 1982 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
514 | 529 | | |
515 | 530 | | |
516 | 531 | | |
| |||
0 commit comments