Skip to content

fix(ci): enforce non-zero coverage gate threshold (closes #589) - #601

Merged
s2x merged 3 commits into
masterfrom
feat/issue-589-coverage-gate-threshold
Jul 28, 2026
Merged

fix(ci): enforce non-zero coverage gate threshold (closes #589)#601
s2x merged 3 commits into
masterfrom
feat/issue-589-coverage-gate-threshold

Conversation

@s2x

@s2x s2x commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Description

Closes #589

The CI coverage gate was present in name only: the threshold was 0.0 (trivially green at the measured ~82.17% coverage) and the same check ran twice per matrix leg. This PR makes the gate effective.

Changes

  • Threshold 0.0 → 80.0, defined once in composer.json (coverage:check) — 80% leaves ~2.2pp headroom against the observed 82.17%, while the measured 0.04pp per-leg spread makes flaky failures impossible
  • Removed the duplicate invocation.github/workflows/tests.yaml now calls composer coverage:check only; the verbatim php bin/check-coverage.php var/coverage.xml 0.0 duplicate is gone, so the threshold lives in exactly one place
  • Gate runs once, not nine times — the Check coverage threshold step is restricted via if: to the lowest supported matrix leg (PHP 8.2 / Symfony 6.4.*); per-leg coverage differs by ~0.04pp so the remaining eight gates were wasted signal. Per-leg coverage reports are still uploaded as artifacts (if: always() preserved)
  • Benchmark comment clarified — the ci aggregation job's "advisory initially" comment now states the advisory mode is intentional (runner timing is too variable to gate merges on)
  • Regression test hardenedCoverageCiGateTest now asserts: single gate invocation tied to the correct step, the 8.2/6.4.* leg condition, no direct check-coverage.php call in the workflow, upload step keeps if: always(), and a non-zero threshold defined in composer.json
  • Docsdocs/workflow.md step 7 and CONTRIBUTING.md now state the 80% floor and where it is defined, so contributors learn about it before CI tells them

Not implemented (explicitly optional in the issue): the coverage ratchet. 80.0 is the recommended safe first step; a ratchet can follow separately.

Changelog

Added under [Unreleased]Fixed: make the CI coverage gate effective (threshold 80% defined once in composer.json, duplicate removed, single-leg gate).

Code Review

  • Passed subagent code review
  • All review comments addressed

Gate failure demonstration

The gate was demonstrated to fail correctly by a temporary commit (now removed) that excluded three covered test directories (tests/Command, tests/Phar, tests/Supervisor) from the PHPUnit suite. Coverage dropped from ~82% to 68.21%, and the gate failed on the single 8.2 / 6.4 leg:

Coverage: 68.21% (6213/9108 statements). Threshold: 80.00%. FAILED

Failing run (8.2/6.4 leg): https://github.com/crazy-goat/workerman-bundle/actions/runs/30379541493/job/90343929802

All other 8 matrix legs stayed green (the gate only runs on the designated leg), Lint and Benchmark passed, and the coverage report artifact still uploaded (if: always()). The temporary commit was removed via force-push; the branch now contains only the three implementation commits.

Note for reviewer

#597 also touches .github/workflows/tests.yaml (per its author's comment on #589) — whichever lands second should rebase.

@s2x s2x self-assigned this Jul 28, 2026
@s2x
s2x force-pushed the feat/issue-589-coverage-gate-threshold branch from f3c4940 to 9a7b405 Compare July 28, 2026 19:31
@s2x
s2x merged commit 82313d3 into master Jul 28, 2026
24 checks passed
@s2x
s2x deleted the feat/issue-589-coverage-gate-threshold branch July 28, 2026 19:36
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.

[CI] Coverage gate threshold is 0.0 and runs twice — 82.17% coverage is effectively unguarded

1 participant