ci: enforce patch coverage of changed lines - #378
Merged
Merged
Conversation
TheWitness
requested review from
bmfmancini,
browniebraun,
cigamit and
xmacan
and
a balanced review from Copilot
September 29, 2026 18:30
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Renamed PHP files can bypass the gate, while edits to production files excluded from Clover can fail it regardless of their tests.
Review effort: Balanced
Findings: None
What changed in this PR
This PR adds a changed-line coverage gate to the Syslog plugin’s pull-request CI, following the approach used by plugin_thold.
Changes:
- Add a helper that compares changed PHP lines with Clover coverage.
- Run the gate on pull requests, fetch the base history, and remove an inert Composer environment variable.
| File | Description |
|---|---|
tests/bin/patch-coverage.php |
Calculates coverage for changed production PHP lines. |
.github/workflows/plugin-ci-workflow.yml |
Adds the pull-request gate and fetches the history it needs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Adds tests/bin/patch-coverage.php and an "Enforce coverage of changed lines" CI step (pull_request only) that fails when production PHP lines a PR changes are left uncovered, mirroring plugin_thold. Whole-file coverage is not meaningful for a Cacti plugin (most code only runs inside a live Cacti), so the gate measures only the lines a change adds. Also sets fetch-depth: 0 on the plugin checkout so the gate can diff against the PR base, and removes the inert COMPOSER_ROOT_VERSION env from the Pest step (it only affects composer root-version detection, which does not run in that step).
TheWitness
force-pushed
the
ci/enforce-patch-coverage
branch
from
September 29, 2026 18:55
2924ba4 to
335cfd2
Compare
xmacan
approved these changes
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Brings this plugin's CI in line with
plugin_tholdby enforcing patchcoverage — coverage of the production PHP lines a pull request actually
changes — and cleans up an inert env var.
Changes:
tests/bin/patch-coverage.php(mirrorsplugin_thold).pull_requestevents, that fails when production lines a PR adds/modifiesare left uncovered by the Pest suite.
fetch-depth: 0on the plugin checkout so the gate can diff againstthe PR base commit.
COMPOSER_ROOT_VERSION: 1.3.0-devfrom the Pest step. It onlyinfluences Composer root-version detection, which does not run in that
step, so it was inert.
Why
Whole-file coverage is not meaningful for a Cacti plugin: most code only
runs inside a live Cacti, so the repository figure sits near zero regardless
of test quality. What is enforceable — and what a reviewer cares about — is
that the lines a change introduces are exercised. This is the same gate
plugin_tholdalready uses; this PR is part of harmonizing it across theplugin fleet.
Notes
lines to measure (only workflow YAML and the
tests/helper changed), soit reports "no measured lines changed" and passes.
patch-coverage.php's$unmeasured_allowliststarts empty; entry pointsthat cannot be loaded into the isolated unit process can be added there
per repo, each with a one-line justification, as the need arises.