Skip to content

feat(coverage): add noise tolerance to the coverage gates#23

Merged
pedromvgomes merged 3 commits into
mainfrom
feature/vulture-inselberg
Jul 15, 2026
Merged

feat(coverage): add noise tolerance to the coverage gates#23
pedromvgomes merged 3 commits into
mainfrom
feature/vulture-inselberg

Conversation

@pedromvgomes

Copy link
Copy Markdown
Contributor

Why

The coverage gate failed PRs on sub-rounding-error regressions — a strict cur < base comparison printed [FAIL] rust: 86.1% (baseline 86.1%, regressed 0.0%) on PRs containing no Rust changes at all.

What

  • coverage.tolerance (default 0.1pp): the aggregate gate now tolerates dips up to this many percentage points below baseline. The comparison happens at the report's tenth-of-a-point display precision (regressedBeyond), so what's shown and what's gated always agree — raw float subtraction decided an exactly-at-tolerance dip by representation noise (86.2−86.1 > 0.1 but 86.1−86.0 ≤ 0.1).
  • coverage.patch.tolerance (default 0.1pp): the patch gate gets its own knob, deliberately independent, so loosening the aggregate tolerance for a noisy suite never silently weakens the untested-new-code check.
  • Anti-ratchet: baseline writers restore any within-tolerance dip to the prior high-water value when recording, so tolerated dips can't compound at one tolerance per merge; a beyond-tolerance drop (FAIL-visible on the PR that introduced it) still resets the baseline deliberately.
  • Validation: Load() rejects negative/NaN/±Inf tolerances, which would otherwise invert the gate (failing improved coverage) or silently disable both gates.
  • Docs (README, AGENTS.md, config schema comments) updated to match, including the previously stale "below its baseline fails" claims.

Tests

New: TestDiffReportPassesWithinTolerance, TestDiffReportFailsBeyondTolerance, TestDiffReportToleranceBoundaryIsRepresentationIndependent, TestRegressedBeyond, TestWithToleratedDipsRestored, TestDefaultCoverageTolerance, TestLoadRejectsInvalidTolerance, TestLoadCoverageToleranceExplicitZero. Full suite, go vet, gofmt clean.

Merge Commit Message

feat(coverage): tolerate sub-noise coverage dips (0.1pp default, anti-ratchet recording, validated config knobs for aggregate and patch gates)

https://claude.ai/code/session_01QMTWVM4pUB4xy6F6P9wWYA

A strict < comparison failed PRs on dips smaller than the displayed
precision ("86.1% vs baseline 86.1%, regressed 0.0%") even when the PR
touched no code in that language. Both gates now tolerate a configurable
dip, compared at the report's tenth-of-a-point display precision so what
is shown and what is gated always agree:

- coverage.tolerance (default 0.1pp) for the aggregate gate
- coverage.patch.tolerance (default 0.1pp) for the patch gate,
  deliberately independent so loosening the noisy aggregate knob never
  weakens the untested-new-code check

To keep tolerated dips from compounding into an unbounded downward
ratchet, the baseline writers restore any within-tolerance dip to the
prior high-water value when recording; only a beyond-tolerance drop
(FAIL-visible on the PR that introduced it) resets the baseline.

Load() rejects negative/NaN/Inf tolerances, which would otherwise
silently invert or disable the gates.

Claude-Session: https://claude.ai/code/session_01QMTWVM4pUB4xy6F6P9wWYA
@pedromvgomes
pedromvgomes force-pushed the feature/vulture-inselberg branch from 06994e0 to 2cc292c Compare July 15, 2026 03:19
@pedromvgomes
pedromvgomes merged commit ceaf6cc into main Jul 15, 2026
4 checks passed
@pedromvgomes
pedromvgomes deleted the feature/vulture-inselberg branch July 15, 2026 03:45
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