ci(coverage): disable jacoco PR comments, relax overall delta threshold to 0.4%#22
ci(coverage): disable jacoco PR comments, relax overall delta threshold to 0.4%#22
Conversation
📝 WalkthroughWalkthroughThe GitHub Actions workflow modifies JaCoCo report aggregation to include summary-type comments and tightens code coverage enforcement by raising the maximum allowed coverage drop threshold from -0.1% to -0.4%. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/pr-build.yml (2)
391-391: Keep the threshold message in sync withMAX_DROP.The hardcoded
0.4%in the failure message will drift ifMAX_DROPis tuned again. Consider interpolating the variable.Proposed fix
- echo "Coverage gate failed: overall coverage dropped more than 0.4%." + echo "Coverage gate failed: overall coverage dropped more than ${MAX_DROP#-}%."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/pr-build.yml at line 391, The failure message currently hardcodes "0.4%" which can go out of sync with the MAX_DROP setting; update the echo that prints the coverage gate failure so it interpolates the MAX_DROP variable (referencing MAX_DROP and the echo command) instead of a literal "0.4%" so the message always reflects the configured threshold.
361-364: Minor: status string reads awkwardly with a negative threshold.With
MAX_DROP=-0.4, the summary renders asPASS (>= -0.4%)/FAIL (< -0.4%), which conflates the delta with the threshold. Consider phrasing in terms of the delta for clarity.Proposed wording
- OVERALL_STATUS="PASS (>= ${MAX_DROP}%)" + OVERALL_STATUS="PASS (delta ${DELTA}% >= ${MAX_DROP}%)" if [ "$DELTA_OK" -ne 1 ]; then - OVERALL_STATUS="FAIL (< ${MAX_DROP}%)" + OVERALL_STATUS="FAIL (delta ${DELTA}% < ${MAX_DROP}%)" fi🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/pr-build.yml around lines 361 - 364, The status message uses the threshold variable MAX_DROP in a way that reads awkwardly when it's negative; update the strings set to OVERALL_STATUS to phrase them in terms of the observed delta instead of the threshold. Replace "PASS (>= ${MAX_DROP}%)" and "FAIL (< ${MAX_DROP}%)" with clearer wording such as "PASS (delta >= ${MAX_DROP}%)" and "FAIL (delta < ${MAX_DROP}%)" (or "delta >=/ <" whatever style you prefer), ensuring the branch that checks DELTA_OK continues to set OVERALL_STATUS accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/pr-build.yml:
- Line 391: The failure message currently hardcodes "0.4%" which can go out of
sync with the MAX_DROP setting; update the echo that prints the coverage gate
failure so it interpolates the MAX_DROP variable (referencing MAX_DROP and the
echo command) instead of a literal "0.4%" so the message always reflects the
configured threshold.
- Around line 361-364: The status message uses the threshold variable MAX_DROP
in a way that reads awkwardly when it's negative; update the strings set to
OVERALL_STATUS to phrase them in terms of the observed delta instead of the
threshold. Replace "PASS (>= ${MAX_DROP}%)" and "FAIL (< ${MAX_DROP}%)" with
clearer wording such as "PASS (delta >= ${MAX_DROP}%)" and "FAIL (delta <
${MAX_DROP}%)" (or "delta >=/ <" whatever style you prefer), ensuring the branch
that checks DELTA_OK continues to set OVERALL_STATUS accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3ff2d486-cf3d-476b-b392-960144f1732f
📒 Files selected for processing (1)
.github/workflows/pr-build.yml
What
Three targeted fixes to the
coverage-gateCI job inpr-build.yml:comment-type: summaryto bothjacoco-reportsteps — routes output to the workflow step summary instead of PR comments.MAX_DROPfrom-0.1%to-0.4%.Why
Issue 1 — 403 errors on PR comment posting
The
coverage-gatejob declares onlypermissions: contents: read. Themadrapps/jacoco-reportaction defaults tocomment-type: pr_comment, which calls the GitHub PR comment API and requirespull-requests: write. Every CI run was producing a 403 error in the logs, though it did not block the gate because the action's owncontinue-on-errordefault istrue.Setting
comment-type: summarymakes the action write to$GITHUB_STEP_SUMMARY(a local file write, no API call), so the 403 disappears entirely without needing to grant broader token permissions.Issue 2 —
coverage-changed-filesreports INSTRUCTION coverage, not LINE coverageThe value shown as Changed Files Coverage is bytecode instruction coverage, not source-line coverage. This is a fixed behavior of
madrapps/jacoco-report@v1.7.2— the action has nocoverage-typeparameter and internally reads only theINSTRUCTIONcounter from JaCoCo XML.Why INSTRUCTION ≠ LINE and why it matters:
INSTRUCTION,BRANCH,LINE,COMPLEXITY,METHOD,CLASS.if (x != null)may emit 3–5 instructions; a fluent chain on one line may emit 10+.toString, enum boilerplate) inflates the instruction count without adding meaningful semantic coverage.To switch to LINE coverage the action would need to be replaced with a custom script that reads the
LINEcounter (<counter type="LINE" covered="N" missed="M"/>) from each matching<sourcefile>node. The action itself does not expose this as a configuration option in any released version through v1.7.2.Issue 3 —
-0.1%delta threshold causes false failuresNormal variance in test execution timing, minor refactoring (renaming, extracting constants), or adding tests to previously uncovered edge-case paths can shift overall INSTRUCTION coverage by ±0.2%. A threshold of
-0.1%triggered spurious gate failures in these scenarios.-0.4%still catches real coverage regressions while eliminating the noise.Summary by CodeRabbit