Skip to content

ci: enforce the coverage floor instead of only measuring it - #230

Merged
MichaelTaylor3d merged 2 commits into
mainfrom
loop/3033-coverage-gate
Aug 16, 2026
Merged

ci: enforce the coverage floor instead of only measuring it#230
MichaelTaylor3d merged 2 commits into
mainfrom
loop/3033-coverage-gate

Conversation

@MichaelTaylor3d

@MichaelTaylor3dMichaelTaylor3d commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Closes DIG-Network/dig_ecosystem#3033.

What changed

ci.yml carried --fail-under-lines 80as a comment. The coverage job measured, printed, and
ignored the number, so a PR below the floor still went green. CLAUDE.md §2.3 requires every repo
CI-gated at ≥80% with a build below the floor FAILING. The flag is now on the actual command, and the
job-summary heading no longer says measure-only.

Worse than no gate: the machinery being present is exactly what made its absence invisible. A
reviewer seeing a green coverage check concludes the floor held.

The real number (measured BEFORE enabling anything)

cargo llvm-cov nextest --workspace --locked --retries 2 --summary-only, full workspace, 2015 tests,
exit 0:

metrictotalmissed%
lines (what the gate reads)63,8827,87587.67%
functions7,6721,38182.00%
regions103,30113,98786.46%

The repo is above the contract floor, so the gate is set at 80 — the contract's value, not a
number tuned to whatever passes today. Headroom is 7.67 points of lines.

Note on reading that table: llvm-cov's summary columns run Regions, then Functions, then Lines, and
the leftmost pair is the largest, which invites reading the region number as the line number. The
gated metric here is the third block, 87.67%.

Exclusions

None. No --ignore-filename-regex was added. Nothing had to be excluded to reach green, so
nothing was; an exclusion list is only honest when each entry carries a reason, and here there are no
reasons to state. (Sibling repos do exclude bin targets — dig-app and dig-installer both ignore
main.rs/src/bin — but dig-node clears the floor with those files counted, so it stays stricter.)

Blast radius

CI configuration plus a patch version bump; no library or binary code is touched. The changed-symbol
set is empty — the diff is .github/workflows/ci.yml, Cargo.toml, Cargo.lock (the lock entry
for dig-node-service follows the workspace version, so --locked still resolves). The real blast
radius is every future PR to this repo, which is the point: from here a PR that drops line coverage
below 80% fails a required check.

No overlap with the sibling lane on crates/dig-wallet/src/sage/peer_reads.rs + the DB layer
(dig_ecosystem#3035) — this branch touches none of those files.

Version

0.121.0 → 0.121.1 (patch — CI/chore, no behaviour change).

How verified

The full instrumented workspace run above is the same invocation CI runs, now with the flag appended;
it completed exit 0 at 87.67% lines. --fail-under-lines is llvm-cov's own exit-code mechanism, so
the enforcing form differs from the measured form only in that a sub-floor total exits non-zero.

MichaelTaylor3dand others added 2 commits August 16, 2026 10:58
Stub commit to anchor the lane. Measuring real coverage next.
Co-Authored-By: Claude <noreply@anthropic.com>
`--fail-under-lines 80` was carried in ci.yml as prose, so the coverage job
computed a real number and acted on none of it. A job that reports without
enforcing reads as enforcement downstream: the PR shows a coverage check, it
goes green, and a reviewer concludes the floor held. Every merge into this repo
has passed a check that could not fail.
Measured before turning it on: 87.67% lines, 82.00% functions, 86.46% regions
across the workspace (2015 tests). The repo is already above the floor, so the
gate is set at the CLAUDE.md 2.3 value of 80 rather than a number tuned to
today's run, and no exclusions are needed.
ClosesDIG-Network/dig_ecosystem#3033
Co-Authored-By: Claude <noreply@anthropic.com>
@MichaelTaylor3d

Copy link
Copy Markdown
ContributorAuthor

The gate is load-bearing — proven from both sides on identical coverage data.

Same profile, two floors, exit codes captured before any pipe (piping into tail reports the pipe's status, not the tool's — that is the exact bug the set -euo pipefail comment above this step exists to prevent):

cargo llvm-cov report --summary-only --fail-under-lines 99 -> EXIT 1
cargo llvm-cov report --summary-only --fail-under-lines 80 -> EXIT 0
TOTAL ... 63882 lines, 7875 missed, 87.67%

So the flag genuinely fails below its floor and genuinely passes at it; a floor tested only from the passing side would confirm nothing but itself.

CI is green with the flag live. Run 31964180875, job Test + coverage, 23m34s, and the log shows the enforcing form actually executed:

cargo llvm-cov nextest --workspace --locked --retries 2 --fail-under-lines 80 --summary-only | tee coverage-summary.txt

All other required checks pass (Clippy, Rustfmt, CodeQL/Analyze x3, version increment, commitlint, all four package builds).

@MichaelTaylor3d
MichaelTaylor3d marked this pull request as ready for review August 16, 2026 18:46
@MichaelTaylor3d
MichaelTaylor3d merged commit dc37940 into mainAug 16, 2026
16 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the loop/3033-coverage-gate branch August 16, 2026 18:47
Sign up for freeto 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

@MichaelTaylor3d