Skip to content

ci: add coverage gate to reject PRs below 90% coverage - #14

Merged
yordis merged 2 commits into
mainfrom
ci/coverage-gate
Feb 25, 2026
Merged

ci: add coverage gate to reject PRs below 90% coverage#14
yordis merged 2 commits into
mainfrom
ci/coverage-gate

Conversation

@yordis

@yordis yordis commented Feb 25, 2026

Copy link
Copy Markdown
Member

Summary

Adds insightsengineering/coverage-action to enforce test coverage on PRs.

Changes

  • Run cargo llvm-cov with Cobertura XML output
  • Add coverage-action with 90% threshold
  • Fail PRs when coverage drops below threshold or when overall coverage rate decreases vs main
  • Publish coverage summary and diff as PR comments

Coverage

Current coverage ~92.5%, threshold set to 90%.

@cursor

cursor Bot commented Feb 25, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
CI-only change that may increase PR failures due to stricter coverage enforcement, but does not affect runtime code paths.

Overview
Updates the Rust CI workflow to emit a Cobertura XML coverage report (cargo llvm-cov ... --cobertura --output-path coverage.xml) and adds insightsengineering/coverage-action@v3 to publish coverage results and fail PRs when coverage drops below 90% or regresses versus main (including new/uncovered-statement checks).

Adds coverage.xml to .gitignore so the generated report isn’t committed.

Written by Cursor Bugbot for commit 61095d3. This will update automatically on new commits. Configure here.

@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@yordis has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9d2addb and 61095d3.

📒 Files selected for processing (2)
  • .github/workflows/ci-rust.yml
  • .gitignore

Walkthrough

CI workflow enhanced with code coverage reporting and enforcement. The Rust CI pipeline now generates Cobertura-formatted coverage reports and enforces a 90% minimum coverage threshold with main branch comparison. Coverage artifact added to gitignore.

Changes

Cohort / File(s) Summary
CI Coverage Integration
.github/workflows/ci-rust.yml
Added cargo llvm-cov step with Cobertura output flag and new coverage-action step to enforce 90% minimum coverage threshold, publish reports, and fail on coverage reduction relative to main branch.
Build Artifacts
.gitignore
Added coverage.xml to ignored files under Coverage section.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 Coverage hops along so neat,
90 percent, can't accept defeat!
Cobertura reports in gleaming XML,
Bunny approves—regression? Null!
Branch by branch, we hopping guard,
Code quality standards? Not very hard! 🎯

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a coverage gate that rejects PRs below 90% coverage, which is the primary purpose of the workflow modifications.
Description check ✅ Passed The description is clearly related to the changeset, providing detailed explanation of coverage action setup, threshold enforcement, and reporting functionality that matches the actual modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/coverage-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Feb 25, 2026

Copy link
Copy Markdown

badge

Code Coverage Summary

Details
Filename                                     Stmts    Miss  Cover    Missing
-----------------------------------------  -------  ------  -------  --------------------------------------------
crates/acp-nats/src/config.rs                  122       0  100.00%
crates/trogon-nats/src/messaging.rs            507      12  97.63%   14-16, 51-52, 135-140, 150-151, 203-205
crates/trogon-nats/src/connect.rs               96      16  83.33%   21-23, 36, 50, 69-152
crates/trogon-nats/src/auth.rs                 114       3  97.37%   49-51
crates/trogon-nats/src/client.rs                25      25  0.00%    47-86
crates/trogon-nats/src/mocks.rs                196      14  92.86%   137-144, 175-180
crates/acp-nats/src/agent/authenticate.rs      180       2  98.89%   106, 111
crates/acp-nats/src/agent/new_session.rs       207      24  88.41%   104-106, 118-146, 175, 180
crates/acp-nats/src/agent/initialize.rs        196       2  98.98%   113, 118
crates/acp-nats/src/agent/mod.rs                74       0  100.00%
crates/trogon-std/src/env/system.rs             17       0  100.00%
crates/trogon-std/src/env/in_memory.rs          76       3  96.05%   48-50
crates/acp-nats/src/telemetry/metrics.rs        32       7  78.12%   39-47
crates/trogon-std/src/time/mock.rs             123       0  100.00%
crates/trogon-std/src/time/system.rs            24       0  100.00%
crates/trogon-std/src/dirs/system.rs            98      11  88.78%   57, 65, 67, 75, 77, 85, 87, 96, 98, 109, 154
crates/trogon-std/src/dirs/fixed.rs             84       0  100.00%
crates/trogon-std/src/fs/mem.rs                220      10  95.45%   61-63, 77-79, 133-135, 158
crates/trogon-std/src/fs/system.rs              29      12  58.62%   17-19, 31-45
crates/acp-nats/src/nats/subjects.rs            12       3  75.00%   14-16
crates/acp-nats/src/nats/extensions.rs           3       3  0.00%    15-17
TOTAL                                         2435     147  93.96%

Results for commit: 61095d3

Minimum allowed coverage is 90%

♻️ This comment has been updated with latest results

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci-rust.yml:
- Around line 49-59: Add a permissions block to the workflow job that runs the
"Coverage report and gate" (uses: insightsengineering/coverage-action@v3) so the
GITHUB_TOKEN has the required scopes: grant pull-requests: write (for publish:
true) and contents: write (for diff-storage: _xml_coverage_reports); update the
job (e.g., check job) to include a top-level permissions mapping with those keys
so the action can post PR comments and write the coverage XML without "Resource
not accessible by integration" errors.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94326f7 and 9d2addb.

📒 Files selected for processing (2)
  • .github/workflows/ci-rust.yml
  • .gitignore

Comment thread .github/workflows/ci-rust.yml

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Comment thread .github/workflows/ci-rust.yml
- Use cargo-llvm-cov --cobertura for Cobertura XML output
- Add insightsengineering/coverage-action to enforce threshold and publish PR comments
- Fail on coverage below 90% (threshold) and on coverage rate reduction vs main
- Enable diff report against main branch for PR visibility

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis merged commit af437c6 into main Feb 25, 2026
4 checks passed
@yordis
yordis deleted the ci/coverage-gate branch February 25, 2026 07:57
yordis added a commit that referenced this pull request Jun 16, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 22, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 22, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 23, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 23, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 23, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 25, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 25, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 26, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 26, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 26, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 26, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
yordis added a commit that referenced this pull request Jun 26, 2026
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
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