feat: Fluent review workflow API#36
Conversation
Implements comprehensive review builder and query patterns for PR reviews.
## Changes
### New Classes
- ReviewBuilder: Fluent interface for creating PR reviews
- approve(), requestChanges(), comment() event types
- addInlineComment() for line-level feedback
- addSuggestion() for code suggestions
- submit() to finalize and create review
- ReviewQuery: Query builder for filtering/retrieving reviews
- whereApproved(), whereChangesRequested(), whereCommented()
- byUser() to filter by reviewer
- latest(), first(), count() helpers
- get() to retrieve all reviews
- ReviewBuilderInterface: Contract for review builder implementations
### Updated Classes
- Reviewable interface: Updated to reflect new fluent API
- reviews() now returns ReviewQuery instead of array
- approve()/requestChanges() return ReviewBuilder
- Added review() method for custom review builders
- Kept submitReview() for backward compatibility
- PullRequest: Implements new review methods
- approve(?string) returns ReviewBuilder
- requestChanges(?string) returns ReviewBuilder
- review() returns new ReviewBuilder instance
- reviews() returns ReviewQuery for filtering
### Tests
- ReviewBuilderTest: 12 tests covering all builder functionality
- ReviewQueryTest: 11 tests for query filtering and retrieval
- Updated existing tests to use new API patterns
- 100% code coverage maintained
## Usage Examples
```php
// Simple approval
$pr->approve('LGTM!')->submit();
// Request changes with inline comments
$pr->requestChanges('Please address concerns')
->addInlineComment('src/File.php', 42, 'Race condition here')
->submit();
// Query reviews
$approvals = $pr->reviews()->whereApproved();
$latest = $pr->reviews()->latest();
```
Closes #22
|
Warning Rate limit exceeded@jordanpartridge has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 39 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📒 Files selected for processing (9)
✨ 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 |
Closes #22
Summary
Features
ReviewBuilder
ReviewQuery
Usage Examples
Simple Approval
Request Changes with Inline Comments
Code Suggestions
Query Reviews
Test Coverage
Breaking Changes
reviews()method now returnsReviewQueryinstead ofarray$pr->reviews()to$pr->reviews()->get()approve()andrequestChanges()now returnReviewBuilderinstead ofstatic->submit()call to execute the review