build(coverage): switch from grcov to cargo-llvm-cov - #19
Conversation
Replace the grcov pipeline with cargo-llvm-cov, raise the threshold from 60% to 80%, and exclude src/main.rs (binary entry point, not unit-testable) from the report denominator.
Greptile SummaryThis PR migrates code coverage from Confidence Score: 5/5Safe to merge — clean tooling migration with correct new tests and no functional regressions. All changes are in the build/CI tooling and test additions. The new four tests are mathematically correct (verified against bs775_weight coefficients and the arithmetic-mean fallback logic). The cargo-llvm-cov two-step workflow (--no-report → report) is the canonical pattern for generating multiple report formats. No P0 or P1 findings. No files require special attention.
|
| Filename | Overview |
|---|---|
| justfile | Replaces grcov invocation with cargo-llvm-cov two-step workflow (--no-report then report), raises threshold to 80%, and removes manual RUSTFLAGS/LLVM_PROFILE_FILE plumbing — all correct. |
| mise.toml | Swaps cargo:grcov 0.10.7 for cargo:cargo-llvm-cov 0.8.5; straightforward dependency swap. |
| src/audio.rs | Adds four new unit tests (7.1 downmix, rear-centre downmix, all-zero-weight arithmetic mean, bs775_weight wildcard); all test assertions are mathematically correct. |
| src/main.rs | Removes grcov-excl-start/stop annotations around the binary entry point; no functional change. |
| src/output.rs | Removes grcov-excl-start/stop around the test module; no functional change. |
| src/transcribe.rs | Removes grcov-excl-start/stop from the transcribe function and test module; no functional change. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[just coverage] --> B[mkdir -p coverage]
B --> C[cargo llvm-cov --no-report\nruns tests + collects profdata]
C --> D[cargo llvm-cov report --lcov\n--ignore-filename-regex src/main.rs\n→ coverage/lcov]
C --> E[cargo llvm-cov report --html\n--ignore-filename-regex src/main.rs\n→ coverage/]
D --> F[lcov --summary coverage/lcov\nextract line %]
F --> G{line % >= 80?}
G -->|yes| H[✅ pass]
G -->|no| I[❌ exit 1]
Reviews (1): Last reviewed commit: "test(audio): cover downmix paths for sid..." | Re-trigger Greptile
Summary
The project used grcov for coverage with a 60% threshold and inline
grcov-excl-*annotations to exclude certain blocks. grcov requires manual RUSTFLAGS plumbing and a separate profraw collection step. This migrates to cargo-llvm-cov (simpler invocation, no manual env vars), raises the threshold to 80%, and removes the now-dead exclusion annotations. Four new tests are added to cover the previously untested downmix paths that the annotation removal exposed.Coverage after: 86.7% (up from 75.8% under the old tool).
Changes
mise.tomlandjustfilesrc/main.rs(binary entry point, not unit-testable) from the report denominatorgrcov-excl-start/grcov-excl-stopannotations fromsrc/main.rs,src/output.rs,src/transcribe.rs,src/audio.rsdownmixes_7_1_to_mono— coversSIDE_LEFT | SIDE_RIGHTarmdownmixes_rear_centre_to_mono— coversREAR_CENTREarmdownmixes_all_zero_weight_channels_uses_arithmetic_mean— covers the BS.775 fallback arithmetic mean pathbs775_weight_returns_zero_for_unrecognized_channel— covers the_ => 0.0wildcard arm