From 801ea47d1ce651e7cff692458257a63d8a873365 Mon Sep 17 00:00:00 2001 From: Albert Hui Date: Mon, 3 Aug 2026 08:58:14 +0800 Subject: [PATCH] fix(ci): measure coverage over all test targets, not just --lib `cargo llvm-cov --lib` builds only the lib target's own unit tests. Integration tests under tests/ are separate crates producing separate binaries, so `--lib` never builds them and nothing they cover is recorded. That makes the number mean something narrower than it reads. Any code reached through the public seam rather than from inside src/ shows as uncovered even when the suite exercises it fully. bluetooth-forensic hit exactly this: 54 lines reported uncovered on a library its own integration tests cover to 100%, a phantom debt that would have sent someone writing duplicate unit tests for code already tested -- or deleting the integration tests that made it green. Dropping `--lib` pulls binary targets into the report at 0% (built by the test profile, never executed), which would make a 100% gate unsatisfiable for reasons unrelated to test quality. Binary shells are excluded instead, matching the rule blob-decoder's gate script already carries: the CLI is a Humble Object over the library, and the library is what the gate is about. This repo passes today under `--lib`, which is the stronger claim -- the library is fully covered by unit tests alone -- so this changes nothing about its current result. Coverage can only grow when more test binaries run. What it prevents is the phantom debt appearing the first time someone covers new code from an integration test. 62 of the fleet's 76 repos with a coverage step already measure all test targets; this brings the remaining outliers in line. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c8fffa..3f15203 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: # error arm of a conversion that `chunks_exact(2)` guarantees, and the empty # arm of a `slice::split` that always yields a segment — so the region figure # sits just under 100 and lines/functions are the meaningful invariants. - - run: cargo llvm-cov --lib --fail-under-lines 100 --fail-under-functions 100 --show-missing-lines + - run: cargo llvm-cov --fail-under-lines 100 --fail-under-functions 100 --show-missing-lines --ignore-filename-regex '(^|/)src/(main\.rs|bin/)' msrv: name: MSRV (1.75)