Skip to content

Reject pull requests that reduce coverage - #16

Merged
ip332 merged 1 commit into
mainfrom
ci/prevent-coverage-regressions
Nov 23, 2026
Merged

ip332 merged 1 commit into
mainfrom
ci/prevent-coverage-regressions

Conversation

@ip332

@ip332 ip332 commented Nov 23, 2026

Copy link
Copy Markdown
Owner

The existing coverage check only enforces fixed minimums, allowing a PR to reduce coverage while remaining above them. Compare each PR’s tested merge revision with its base SHA and fail on any decrease in line, branch, or function coverage. Compare exact covered/total ratios so rounding cannot hide a small regression; retain the 97.8% line and 93.3% branch floors, including on pushes to main.

Collect both revisions using the same Docker image, test suite entry point, and filters in fresh build directories. Instrument C as well as C++, exclude generated CMake files and test helpers, and publish the comparison in the job summary. Upload both revisions’ HTML, text, JSON, and test logs even when the check fails. Keep the existing Build job/check name and use read-only repository permissions.

Validation:

  • Four Python tests cover equality, improvements, tiny decreases in every metric, minimum boundaries, and invalid/empty counts.
  • End-to-end collection on base and head: 349 tests passed per revision; 9 optional external-log tests skipped and 7 existing tests disabled, matching normal CI inputs.
  • Both revisions report identical coverage: 98.483442% lines, 94.851658% branches, 98.847262% functions.
  • Deliberately reducing the real report’s covered-line count by one causes exit 1.
  • Workflow YAML and shell syntax validated.

@ip332
ip332 merged commit f279d2a into main Nov 23, 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