feat: platform-specific code suggestion rendering (#42) - #50
Conversation
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughChangesReview submission changes
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Reviewer
participant GitLabClient
participant GitLabAPI
Reviewer->>GitLabClient: Submit review with cleanup mode and comments
GitLabClient->>GitLabAPI: List prior MR discussions
GitLabAPI-->>GitLabClient: Return bot-authored discussions
GitLabClient->>GitLabAPI: Resolve discussions when cleanup mode is resolve
GitLabClient->>GitLabAPI: Post notes with platform-specific suggestions
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ 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.
Actionable comments posted: 2
🧹 Nitpick comments (2)
internal/config/config_test.go (1)
707-726: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd coverage for YAML and invalid cleanup modes.
These cases cover flag and environment loading, but the change also adds
.code-reviewer.yamlparsing andvalidate()rejection. Add table cases forcleanup_mode: resolve, an invalid value, and flag-over-environment precedence.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/config/config_test.go` around lines 707 - 726, Add table-driven cases in the config tests around the existing cleanup_mode_flag and cleanup_mode_env cases covering YAML cleanup_mode: resolve, rejection of an invalid cleanup mode during validate(), and flag-over-environment precedence. Reuse the existing Config parsing test setup and assert the resolved CleanupMode or validation error as appropriate.internal/reviewer/output_test.go (1)
205-205: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winReplace the deleted suggestion test with a submission-contract test.
Add a table-driven test that captures
SubmitReviewRequestand verifies both rawSuggestionandCleanupModesurvivePostReview; the current deletion removes the only suggestion-specific assertion.As per path instructions,
**/*_test.gochanges should prefer table-driven tests and verify proper cleanup and race-condition safety.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/reviewer/output_test.go` at line 205, Add a table-driven submission-contract test in the review output tests that intercepts SubmitReviewRequest, calls PostReview with representative suggestion and cleanup-mode values, and asserts both fields are preserved unchanged. Include cleanup of any captured resources and structure the test to remain safe under race detection.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/gitlab/client.go`:
- Around line 253-254: Replace the time.Sleep call after resolved++ in the
resolution flow with a cancellable timer/select that waits for apiRateDelay or
returns when ctx.Done() is signaled. Ensure the timer is stopped or cleaned up
appropriately while preserving the existing rate-limit delay after successful
resolution.
- Around line 334-335: Update the CreateDraftNoteRequest construction in the
draft inline-note flow to include the configured botMarker in Note, matching the
marker used by ResolvePreviousReviews. Preserve the existing note body while
ensuring every bot-generated draft inline note is identifiable for
discussion-level resolution in “resolve” mode.
---
Nitpick comments:
In `@internal/config/config_test.go`:
- Around line 707-726: Add table-driven cases in the config tests around the
existing cleanup_mode_flag and cleanup_mode_env cases covering YAML
cleanup_mode: resolve, rejection of an invalid cleanup mode during validate(),
and flag-over-environment precedence. Reuse the existing Config parsing test
setup and assert the resolved CleanupMode or validation error as appropriate.
In `@internal/reviewer/output_test.go`:
- Line 205: Add a table-driven submission-contract test in the review output
tests that intercepts SubmitReviewRequest, calls PostReview with representative
suggestion and cleanup-mode values, and asserts both fields are preserved
unchanged. Include cleanup of any captured resources and structure the test to
remain safe under race detection.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 561f4130-66dd-4e86-8bf5-0d075187d9e7
📒 Files selected for processing (8)
.code-reviewer.example.yamlinternal/config/config.gointernal/config/config_test.gointernal/github/client.gointernal/gitlab/client.gointernal/reviewer/output.gointernal/reviewer/output_test.gointernal/vcs/types.go
dbead20 to
8a31cf2
Compare
1. Make rate-limit wait cancellable in ResolvePreviousReviews — use select on ctx.Done() instead of time.Sleep 2. Tag draft inline notes with botMarker — ensures resolve mode can identify bot discussions created via the draft notes path 3. Add submission-contract test verifying Suggestion and CleanupMode survive PostReview passthrough (table-driven) 4. Add config tests: invalid cleanup-mode validation, flag-over-env precedence
Closes #42
Moves suggestion markdown rendering from
formatInlineComment()into each platform client, enabling platform-specific syntax:suggestion(standard)suggestion:-0+0(single-line syntax)Changes
vcs/types.go: AddedSuggestionfield toReviewCommentreviewer/output.go: Passes raw suggestion through; removed rendering fromformatInlineComment()github/client.go: Renders GitHub suggestion syntax inSubmitReview()gitlab/client.go: Renders GitLab suggestion syntax in both draft notes and individual comment pathsSummary by CodeRabbit
New Features
Bug Fixes