(MODULES-11831) Add SimpleCov coverage gate with baseline mode#648
Open
imaqsood wants to merge 1 commit into
Open
(MODULES-11831) Add SimpleCov coverage gate with baseline mode#648imaqsood wants to merge 1 commit into
imaqsood wants to merge 1 commit into
Conversation
imaqsood
requested review from
LukasAud,
actowery,
bronachfalls,
david22swan,
gavindidrichsen,
gregohardy and
pmcmaw
June 25, 2026 16:46
There was a problem hiding this comment.
Pull request overview
Adds a managed GitHub Actions coverage workflow and a SimpleCov hook to CAT-supported module templates so pdk update can roll out a coverage gate (either absolute threshold or baseline “ratchet” mode) across modules.
Changes:
- Introduces a managed
.github/workflows/coverage.ymltemplate that delegates topuppetlabs/cat-github-actionsreusable workflow and passesthreshold/baseline_modefrom.sync.yml. - Adds an env-gated SimpleCov + LCOV formatter hook at the top of
spec/spec_helper.rb(only active whenCOVERAGE=yesandsimplecov: true). - Updates defaults and documentation to include the new workflow/config keys and required gems.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| README.md | Documents the new coverage.yml workflow behavior and the simplecov config flag. |
| moduleroot/spec/spec_helper.rb.erb | Adds an env-gated SimpleCov/LCOV initialization before any app code loads. |
| moduleroot/.github/workflows/coverage.yml.erb | Adds the managed coverage workflow delegating to the reusable module_coverage.yml. |
| config_defaults.yml | Enables SimpleCov by default, adds coverage workflow defaults, and adds simplecov/simplecov-lcov gems. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| uses: "puppetlabs/cat-github-actions/.github/workflows/module_coverage.yml@main" | ||
| with: | ||
| threshold: <%= coverage['threshold'] || 80 %> | ||
| baseline_mode: <%= coverage['baseline_mode'] ? true : false %> |
Sync a coverage gate to all modules via `pdk update`: * moduleroot/.github/workflows/coverage.yml.erb - thin caller that delegates to puppetlabs/cat-github-actions module_coverage.yml, passing threshold and baseline_mode from .sync.yml. * moduleroot/spec/spec_helper.rb.erb - SimpleCov hook that starts before any application code loads. Gated behind the COVERAGE env var and the `simplecov` config flag, so local `rake spec` runs are unaffected and there is no double-load or json/json_pure conflict. * config_defaults.yml - add `simplecov: true`, a managed coverage.yml entry (threshold 80, baseline_mode true), and the simplecov / simplecov-lcov gems. baseline_mode with no `.coverage_baseline` file is a no-op gate, so the rollout is non-breaking. * README.md - document the new keys and the two coverage modes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
imaqsood
force-pushed
the
MODULES-11831-coverage-gate
branch
from
July 1, 2026 10:36
cc20531 to
2786999
Compare
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
Syncs a SimpleCov coverage gate to all CAT-supported modules via
pdk update.moduleroot/.github/workflows/coverage.yml.erb- thin caller that delegates topuppetlabs/cat-github-actions/.github/workflows/module_coverage.yml@main, passingthresholdandbaseline_modefrom.sync.yml.moduleroot/spec/spec_helper.rb.erb- SimpleCov hook placed at the top of the file (before any application code is required). Gated behind thesimplecovconfig flag and theCOVERAGEenv var, so localrake specruns are unaffected - no double-load and no json/json_pure conflict.config_defaults.yml- addssimplecov: true, a managedcoverage.ymlentry (threshold: 80,baseline_mode: true), and thesimplecov/simplecov-lcovgems.README.md- documents the new keys and the two coverage modes.Rollout behaviour
coverage.ymlis managed (notunmanaged) sopdk updatedeploys it everywhere.baseline_modewith no.coverage_baselinefile is a no-op gate (baseline0), so deploying it is non-breaking: each module reports its current coverage and ratchets by committing a baseline, or setsbaseline_mode: falseto gate againstthreshold. Opt out per module withsimplecov: false+unmanaged: trueon.github/workflows/coverage.yml.Depends on
puppetlabs/cat-github-actions#179 (the reusable
module_coverage.yml). Merge that first.Ticket
MODULES-11831 (epic MODULES-11828).
Acceptance criteria
rake specwith SimpleCovabsoluteandbaseline_modemodes via.sync.ymlrake specstill passes when SimpleCov is loaded (env-gated, no double-load)@mainresolves)🤖 Generated with Claude Code