Skip to content

build(coverage): switch from grcov to cargo-llvm-cov - #19

Merged
robdefeo merged 3 commits into
mainfrom
worktree-fuzzy-yawning-snail
Apr 24, 2026
Merged

build(coverage): switch from grcov to cargo-llvm-cov#19
robdefeo merged 3 commits into
mainfrom
worktree-fuzzy-yawning-snail

Conversation

@robdefeo

Copy link
Copy Markdown
Owner

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

  • Replace grcov with cargo-llvm-cov in mise.toml and justfile
  • Raise coverage threshold 60% → 80%; exclude src/main.rs (binary entry point, not unit-testable) from the report denominator
  • Remove grcov-excl-start / grcov-excl-stop annotations from src/main.rs, src/output.rs, src/transcribe.rs, src/audio.rs
  • Add downmixes_7_1_to_mono — covers SIDE_LEFT | SIDE_RIGHT arm
  • Add downmixes_rear_centre_to_mono — covers REAR_CENTRE arm
  • Add downmixes_all_zero_weight_channels_uses_arithmetic_mean — covers the BS.775 fallback arithmetic mean path
  • Add bs775_weight_returns_zero_for_unrecognized_channel — covers the _ => 0.0 wildcard arm

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-apps

greptile-apps Bot commented Apr 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR migrates code coverage from grcov to cargo-llvm-cov, raises the threshold from 60% to 80%, excludes src/main.rs from the report denominator, and removes the now-dead grcov-excl-* annotations. Four new unit tests cover the previously excluded downmix_to_mono paths (7.1 surround, rear-centre, all-zero-weight arithmetic mean fallback, and the bs775_weight wildcard arm), and the math in each test is correct.

Confidence Score: 5/5

Safe 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.

Important Files Changed

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]
Loading

Reviews (1): Last reviewed commit: "test(audio): cover downmix paths for sid..." | Re-trigger Greptile

@robdefeo
robdefeo merged commit 91b4763 into main Apr 24, 2026
3 checks passed
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