Skip to content

ci: enforce patch coverage of changed lines - #277

Merged
TheWitness merged 2 commits into
developfrom
ci/enforce-patch-coverage
Sep 29, 2026
Merged

TheWitness merged 2 commits into
developfrom
ci/enforce-patch-coverage

Conversation

@TheWitness

Copy link
Copy Markdown
Member

What

Brings this plugin's CI in line with plugin_thold by enforcing patch
coverage
— coverage of the production PHP lines a pull request actually
changes — and cleans up an inert env var.

Changes:

  • Add tests/bin/patch-coverage.php (mirrors plugin_thold).
  • Add an Enforce coverage of changed lines CI step, gated to
    pull_request events, that fails when production lines a PR adds/modifies
    are left uncovered by the Pest suite.
  • Set fetch-depth: 0 on the plugin checkout so the gate can diff against
    the PR base commit.
  • Remove COMPOSER_ROOT_VERSION: 1.3.0-dev from the Pest step. It only
    influences 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_thold already uses; this PR is part of harmonizing it across the
plugin fleet.

Notes

  • The gate only runs on pull requests. On this PR it has no production PHP
    lines to measure (only workflow YAML and the tests/ helper changed), so
    it reports "no measured lines changed" and passes.
  • patch-coverage.php's $unmeasured_allowlist starts empty; entry points
    that cannot be loaded into the isolated unit process can be added there
    per repo, each with a one-line justification, as the need arises.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Renamed-and-edited PHP files can bypass the coverage gate.

Review effort: Balanced
Findings: None

What changed in this PR

Adds pull-request patch coverage enforcement to FlowView CI.

Changes:

  • Adds a Clover-based changed-line coverage checker.
  • Enables full checkout history and runs the gate on pull requests.
  • Removes 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 Integrates the patch coverage gate into CI.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

browniebraun
browniebraun previously approved these changes Sep 29, 2026
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
TheWitness merged commit dc450ae into develop Sep 29, 2026
3 checks passed
@TheWitness
TheWitness requested a review from xmacan September 29, 2026 22:21
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.

4 participants