Skip to content

fix(coverage): relabel per-rule totals so they don't read as artifact counts (REQ-110/111)#348

Open
avrabe wants to merge 1 commit into
mainfrom
fix/req-110-111-coverage-relabel
Open

fix(coverage): relabel per-rule totals so they don't read as artifact counts (REQ-110/111)#348
avrabe wants to merge 1 commit into
mainfrom
fix/req-110-111-coverage-relabel

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 30, 2026

First fix of the v0.15.0 "report correctness" track. Bug-hunt findings REQ-110 (HTML) + REQ-111 (JSON), 3/3 lens-confirmed.

The bug

The coverage overview summed per-rule denominators (an artifact satisfying N traceability rules is counted N times) but presented the result as if it were an artifact count:

  • HTML overview: {n} / {m} artifacts covered
  • coverage --format jsonoverall.total / overall.covered

…where stats uses total for the distinct-artifact count. Same label, two cardinalities.

The fix (relabel — numbers unchanged, per decision)

  • HTML: {n} / {m} coverage checks across R rules
  • JSON overall: checks_covered / checks_total (the ambiguous total/covered keys are removed from overall — a JSON consumer change, noted in CHANGELOG). Per-rule entries[] keep covered/total, which are correct at rule scope.

Regression test asserts the checks_* keys exist and the bare total/covered are absent from overall. rivet validate PASS.

Fixes REQ-110, REQ-111.

🤖 Generated with Claude Code

…ct counts

Bug-hunt findings REQ-110 (HTML) + REQ-111 (JSON), 3/3 lens-confirmed. The
coverage overview summed per-RULE denominators (an artifact in N rules counts
N times) but labelled the result "artifacts covered" / exposed it under the
JSON key `total` — the same key `stats` uses for the distinct-artifact count.
Two different cardinalities, one label.

Per the relabel decision (numbers unchanged):
- HTML overview: "{n} / {m} coverage checks across R rules" (was "artifacts
  covered").
- coverage --format json `overall`: `checks_covered` / `checks_total`
  (the ambiguous `total`/`covered` keys are removed from `overall`). Per-rule
  `entries[]` keep `covered`/`total`, correct at rule scope.

Regression test asserts the `checks_*` keys exist and the bare `total`/
`covered` keys are absent from `overall`.

Fixes: REQ-110, REQ-111
Verifies: REQ-110, REQ-111

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

📐 Rivet artifact delta

No artifact changes in this PR. Code-only changes (renderer, CLI wiring, tests) don't touch the artifact graph.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant