Skip to content

feat(ci): opt-in coverage ratchet (default OFF — closes PMAT build-system audit gap #1) - #37

Merged
noahgift merged 1 commit into
mainfrom
feat/coverage-ratchet-optin
Jun 25, 2026
Merged

feat(ci): opt-in coverage ratchet (default OFF — closes PMAT build-system audit gap #1)#37
noahgift merged 1 commit into
mainfrom
feat/coverage-ratchet-optin

Conversation

@noahgift

Copy link
Copy Markdown
Contributor

Gap

PMAT build-system audit gap #1: the strongest quality signal (line coverage) is purely advisory in the fleet-shared sovereign-ci.yml. The coverage job runs cargo llvm-cov but never enforces a floor, and the codecov upload is continue-on-error. A coverage regression therefore merges silently, despite the documented "95% coverage / ZERO tolerance" rule.

Change

Two opt-in inputs added to the reusable workflow:

input default effect
coverage_min '' (empty) line-coverage floor (%)
coverage_baseline_file .pmat/coverage-baseline.txt ratchet baseline path

A new enforcement step in the coverage job:

  1. Derives line coverage from the just-produced lcov.info (sum of hit DA: records ÷ total) — no extra compile/test cost.
  2. Computes effective floor = max(coverage_min, committed-baseline).
  3. Fails the coverage job on a drop below it. The coverage job result is already wired into the top-level gate (needs: [...coverage...]), so a regression now blocks merge instead of merging silently.

It is a ratchet, not an absolute jump: a repo green today records its current % as the baseline, so enabling the gate can never break the currently-green state.

Safety — zero behavior change for every non-pilot repo

The enforcement step is guarded by if: ${{ inputs.coverage_min != '' }}. With the empty default, the step is skipped entirely — coverage stays exactly as advisory as today. Verified: of 73 fleet callers of sovereign-ci.yml, only aprender (the pilot, separate PR) sets coverage_min. The other 72 see no change.

Rollout ordering

This PR must merge before the aprender pilot PR — aprender's @main reference to the new coverage_min input is only valid once this lands.

🤖 Generated with Claude Code

…stem audit gap #1)

The strongest quality signal (line coverage) was purely advisory: the
coverage job runs `cargo llvm-cov` but never enforced a floor, and the
codecov upload is continue-on-error. A coverage regression therefore
merged SILENTLY despite the 95% / ZERO-tolerance rule.

This adds two OPT-IN inputs to the fleet-shared reusable workflow:

  - coverage_min (default '')          — line-coverage floor
  - coverage_baseline_file (default
    .pmat/coverage-baseline.txt)        — ratchet baseline path

When coverage_min is EMPTY (the default for all 72 non-pilot callers),
a new `if: inputs.coverage_min != ''` guard SKIPS the enforcement step
entirely — coverage stays exactly as advisory as before. Zero behavior
change for every repo that does not opt in.

When coverage_min is set, the new step derives line coverage from the
just-produced lcov.info (no extra compile/test cost), computes an
effective floor = max(coverage_min, committed baseline), and FAILS the
coverage job on a drop below it. The coverage job result is already
wired into the top-level `gate` (needs: [...coverage...]), so a
regression now blocks merge. It is a RATCHET, not an absolute jump:
a repo green today records its current % as the baseline, so enabling
the gate can never break the currently-green state.

Pilot: aprender only (paiml/aprender PR). NOT enabled fleet-wide.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@noahgift
noahgift merged commit cd71161 into main Jun 25, 2026
4 checks passed
@noahgift
noahgift deleted the feat/coverage-ratchet-optin branch June 25, 2026 16:16
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