Skip to content

fix: prevent PR review summary exceeding 65535 len#370

Merged
2bndy5 merged 2 commits into
mainfrom
pr-summary-len-capped
Jun 18, 2026
Merged

fix: prevent PR review summary exceeding 65535 len#370
2bndy5 merged 2 commits into
mainfrom
pr-summary-len-capped

Conversation

@2bndy5

@2bndy5 2bndy5 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

resolves #75

This simply focuses on the length of the patch, because all other parts of the PR review summary will fit under 65535 characters without the patch added.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of large patch content in review comments. When patch content exceeds size limits, a "too large to include" message is displayed instead of attempting to embed the full content.
  • Tests

    • Added test coverage for extremely large patch content scenarios.

resolves #75

This simply focuses on the length of the patch, because all other parts of the PR review summary will fit under 65535 characters without the patch added.
@2bndy5 2bndy5 added the bug Something isn't working label Jun 18, 2026
@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@2bndy5, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 41 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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 credits.

🚦 How do rate limits work?

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

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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e32cc349-30ce-44cc-8d2f-889e719d99a3

📥 Commits

Reviewing files that changed from the base of the PR and between 7810388 and fe1d942.

📒 Files selected for processing (1)
  • cpp-linter/src/clang_tools/mod.rs
📝 Walkthrough

Walkthrough

Replaces the hardcoded 65535 literal with u16::MAX in RestClient::post_feedback and adds a length guard in ReviewComments::summarize that computes the prospective summary size and either inserts a truncation message or embeds the full patch. Tests are updated accordingly, including a new regression test for the truncation path.

Changes

Patch truncation and u16::MAX constant alignment

Layer / File(s) Summary
Length guard in summarize and u16::MAX in post_feedback
cpp-linter/src/clang_tools/mod.rs, cpp-linter/src/rest_client.rs
ReviewComments::summarize now builds separate prefix/suffix strings for the diff block, computes body.len() + USER_OUTREACH.len() + patch_size, logs a warning, and inserts a truncation message if u16::MAX is exceeded; otherwise the full patch is embedded. RestClient::post_feedback replaces the 65535 literal with u16::MAX in both the length comparison and the max_len argument to make_comment.
Test constant and truncation regression test
cpp-linter/src/clang_tools/mod.rs, cpp-linter/src/rest_client.rs
Extracts a module-level PSEUDO_VERSION constant reused by summarize_reused_reviews. Adds summary_len_truncated which builds an oversized full_patch and asserts the truncation notice appears in the output. Updates the rest_client stress-test loop bound from 65535 to u16::MAX.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • cpp-linter/cpp-linter-rs#101: Touches ReviewComments::summarize logic around iterating full_patch, directly related to the truncation path added in this PR.
  • cpp-linter/cpp-linter-rs#353: Modifies RestClient::post_feedback and the large-comment handling at the same call sites updated in this PR.
  • cpp-linter/cpp-linter-rs#358: Refactors ReviewComments data model and full_patch production in mod.rs, directly preceding the truncation guard added here.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: preventing PR review summary from exceeding 65535 character limit by defensive handling of large patches.
Linked Issues check ✅ Passed Code changes directly address issue #75: implement length validation logic to prevent patches exceeding 65535 characters and emit warnings when limits are exceeded.
Out of Scope Changes check ✅ Passed All changes are directly related to the stated objectives: length checks and handling of large patches in review summaries and REST API comment limits.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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


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.

coderabbitai[bot]

This comment was marked as resolved.

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.42%. Comparing base (edd66db) to head (fe1d942).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #370      +/-   ##
==========================================
+ Coverage   92.35%   92.42%   +0.07%     
==========================================
  Files          23       23              
  Lines        3597     3631      +34     
==========================================
+ Hits         3322     3356      +34     
  Misses        275      275              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@2bndy5 2bndy5 merged commit 619e877 into main Jun 18, 2026
73 checks passed
@2bndy5 2bndy5 deleted the pr-summary-len-capped branch June 18, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

keep PR review summary from exceeding max 65535 length

1 participant