Skip to content

feat(reviewer-report): count a comment-only reviewer's response as a Review (SonarCloud) - #1237

Merged
don-petry merged 4 commits into
mainfrom
claude/reviewer-scorecard-sonar
Jul 14, 2026
Merged

don-petry merged 4 commits into
mainfrom
claude/reviewer-scorecard-sonar

Conversation

@don-petry

Copy link
Copy Markdown
Collaborator

What

Follow-up to #1236. SonarCloud (and any bot that delivers its verdict as a top-level comment rather than a formal GitHub review) previously showed 0 Reviews. Now, when a bot submits no formal review on a PR, its non-refusal top-level comment is counted as its review — so its work is visible.

Requested: "count SonarCloud's response as a Review (unless it says Rate Limited)."

Rule (general, not a SonarCloud special-case)

Per PR, per bot:

  • If the bot submitted ≥1 formal review → Reviews = its formal review count (unchanged; its extra summary comments are not double-counted).
  • If it submitted 0 formal reviews but posted a non-refusal top-level comment → that comment is counted as its review.
  • Rate-limit refusals are still excluded.

Verified against live data: SonarCloud posts exactly one issue comment per PR (its quality-gate result), no formal review / no inline — so this counts the right thing.

Effect on live 30-day data (.github-private)

Reviewer Reviews before → after
SonarCloud 0 → 97 (its quality-gate comments)
Gemini 78 → 94 (comment-only PRs now credited)
CodeRabbit 193 → 197 (formal reviews unchanged; +4 comment-only PRs)
Copilot 84 → 84
Codex 11 → 12

Validation

  • shellcheck --severity=warning -x clean · markdownlint clean
  • tests/reviewer_report.bats — 28/28, added:
    • a comment-only responder (SonarCloud) has its comment counted as a review
    • a formal-review bot does not also count its summary comment (no double-count)

🤖 Generated with Claude Code

…s no formal review

SonarCloud (and any bot that delivers its verdict as a top-level comment rather
than a GitHub review) previously showed 0 Reviews. Now, when a bot submits no
formal review on a PR, its non-refusal top-level comment is counted as its review
— so its work is visible. Bots that DO submit formal reviews are unaffected
(their extra summary comments are never double-counted), and rate-limit refusals
are still excluded.

On live data SonarCloud now reads 97 reviews (its quality-gate comments) instead
of 0; CodeRabbit's 193 formal reviews are unchanged.

Tests: 28/28 (added comment-as-review for a comment-only responder, and a
no-double-count guard for a formal-review bot that also posts a summary comment).
Copilot AI review requested due to automatic review settings July 14, 2026 21:44
@don-petry
don-petry requested a review from a team as a code owner July 14, 2026 21:44
@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ab3ac96e-2804-45a6-836c-9b059e939713

📥 Commits

Reviewing files that changed from the base of the PR and between 24bc273 and 262f27e.

📒 Files selected for processing (3)
  • docs/reviewer-report.md
  • scripts/reviewer_report.sh
  • tests/reviewer_report.bats
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/reviewer-scorecard-sonar

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the reviewer report script and documentation to count top-level comments as reviews for bots that do not submit formal reviews (such as SonarCloud), while ensuring that bots with formal reviews do not have their summary comments double-counted. It also adds corresponding BATS tests to verify this behavior. The review feedback suggests improving the BATS tests by creating temporary files inside $BATS_TEST_TMPDIR instead of using bare mktemp to ensure automatic cleanup and avoid parallel-execution conflicts.

Comment thread tests/reviewer_report.bats Outdated
Comment thread tests/reviewer_report.bats Outdated
@don-petry
don-petry enabled auto-merge (squash) July 14, 2026 21:45
@don-petry
don-petry disabled auto-merge July 14, 2026 21:46

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.

Pull request overview

Adjusts the reviewer-report normalization so “comment-only” bot responses (notably SonarCloud’s quality-gate comment) are credited as Reviews when the bot did not submit any formal GitHub reviews, making those bots’ contributions visible in the scorecard.

Changes:

  • Update normalization logic to count a bot’s top-level (issue) comments as review events only when it has zero formal review submissions on the PR.
  • Add Bats coverage for the comment-only reviewer case and for preventing double-counting when a bot has both a formal review and a summary comment.
  • Update report text and documentation to reflect the revised “Reviews” definition.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
scripts/reviewer_report.sh Implements “comment-only counts as a review when no formal reviews exist” in _NORMALIZE_JQ, and updates rendered metric definitions accordingly.
tests/reviewer_report.bats Adds regression tests for comment-only review counting and for avoiding double-counting with formal reviews.
docs/reviewer-report.md Updates the metric definition for Reviews to match the new behavior and removes the prior SonarCloud-specific note.

Comment thread tests/reviewer_report.bats Outdated
Comment thread tests/reviewer_report.bats Outdated
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-07-14T22:47:26Z.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 14, 2026
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) July 14, 2026 21:51

@donpetry-bot donpetry-bot 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.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: b4195bc51919e88c65fca2a4a0fdec5e31ffbf9d
Review mode: triage-approved (single reviewer)

Summary

Small, well-tested reporting-logic change: when a bot submits zero formal GitHub reviews on a PR, its non-refusal top-level comment is now counted as its review (making SonarCloud's quality-gate comments visible in the scorecard). Bots that do submit formal reviews are unaffected — the $rev_events > 0 guard prevents double-counting their summary comments, and rate-limit refusals remain excluded (the fallback filters from $real, which already excludes refusals). Docs and rendered metric definitions updated consistently; two regression tests added (comment-only responder counted, formal-review bot not double-counted). Confirms the triage assessment: low-risk, no security surface.

Linked issue analysis

No linked issues. The PR is a stated follow-up to #1236 and its body documents the requested behavior ("count SonarCloud's response as a Review unless it says Rate Limited"), which the diff implements as a general comment-only-bot rule rather than a SonarCloud special case.

Findings

No blocking findings.

  • All 4 inline review threads (Gemini ×2, Copilot ×2 — bare mktemp → $BATS_TEST_TMPDIR) were addressed in commit b4195bc and are resolved.
  • Logic verified: the issue-comment fallback only activates when a bot has zero formal reviews on the PR, so formal reviewers (CodeRabbit, Copilot, Gemini) are unchanged; refusal comments can never be counted.
  • Secret-scanning MCP tool unavailable in this run; the gitleaks CI check passed on the head SHA.
  • Note: an earlier sweep withheld auto-approval because CodeRabbit was rate-limited (reset 2026-07-14T22:47:26Z); this triage-approved re-review is the scheduled follow-up, and CodeRabbit's commit status reports SUCCESS.

CI status

All required checks green on b4195bc: Lint (shellcheck, bats 28/28, template-drift, personas, agent profiles), CI (ShellCheck, secret scan/gitleaks, agent security scan, workflow compile), CodeQL (actions + python), unit-tests, AgentShield, holdout-guard, test-deletion guard, SonarCloud quality gate (0 new issues, 0 hotspots), CodeRabbit status SUCCESS. One superseded "review / review" trigger run was cancelled and re-run successfully; dependency-audit sub-jobs skipped (no matching ecosystems). Branch is BEHIND main but MERGEABLE.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry merged commit 7d40054 into main Jul 14, 2026
30 of 32 checks passed
@don-petry
don-petry deleted the claude/reviewer-scorecard-sonar branch July 14, 2026 22:29

@donpetry-bot donpetry-bot 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.

Automated review — APPROVED ✓

Risk: LOW
Reviewed commit: 262f27ec7aba51255d7f4a060237d52bd7e6b7ce
Review mode: triage-approved (single reviewer)

Summary

Small, well-tested change to the reviewer-report normalization: a bot that submits no formal review but posts a non-refusal top-level comment (e.g. SonarCloud's quality-gate comment) now has that comment counted as its review. The jq guard (rev_events > 0) ensures bots with formal reviews are unaffected (no double-counting), refusals remain excluded, and APPROVED/CHANGES_REQUESTED counts still derive only from formal reviews. Docs and rendered footnotes updated consistently; two new bats tests cover both the fallback and the no-double-count case. Since the prior approval at b4195bc, the only new commits are merges from main — the PR's own diff is unchanged.

Linked issue analysis

No linked issues. The PR is a follow-up to #1236, and the body documents the requested behavior (count SonarCloud's response as a review unless rate-limited), the general rule adopted, and validation against live 30-day data.

Findings

No blocking findings.

  • Logic verified: $rev_events counts formal reviews in the non-refusal set; the issue-comment fallback only engages when it is 0, so formal-review bots never double-count their summary comments. Verdict columns (✅/🔄) correctly remain formal-review-only, matching the updated docs.
  • Tests: tests/reviewer_report.bats adds coverage for the comment-only responder and the no-double-count case (28/28 per PR body; bats CI check green). Temp files use $BATS_TEST_TMPDIR per reviewer suggestions — all 4 review threads resolved.
  • Secret scan: the run_secret_scanning MCP tool is not available in this environment; the gitleaks CI check is green and the diff (docs, jq logic, test fixtures) contains no secret-like content.
  • Prior bot rate-limit hold (sha a669453) is superseded: it referenced an older commit, and advisory reviews from Gemini and Copilot have since been delivered at the current diff.

CI status

All required checks green: shellcheck, bats, unit-tests, Lint, SonarCloud (quality gate passed), CodeQL (neutral — no findings), gitleaks secret scan, agent-shield, holdout-guard, template-drift, validators. Cancelled dev-lead dispatch jobs and skipped dependency-audit ecosystems are non-blocking.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

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.

3 participants