feat: Issue #34 — Structured review decisions and findings#95
feat: Issue #34 — Structured review decisions and findings#95Chukwuebuka-2003 wants to merge 3 commits into
Conversation
Add Review + ReviewFinding models with DB-level CheckConstraints enforcing decision values (accept/needs_revision/reject) and severity levels. - models.py: Review and ReviewFinding SQLAlchemy models with FK relationships - schemas.py: Pydantic request/response schemas with pattern validation - service.py: ReviewService enforcing 3 business rules + AuditEvent creation - router.py: FastAPI routes (POST/GET /api/v1/reviews) - 0015_review_models.py: Alembic migration for reviews and review_findings tables - test_review.py: 9 test cases covering all 5 acceptance criteria Registered in db/models.py and wired via api/router.py.
|
Warning Review limit reached
Next review available in: 17 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: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds structured review decision and finding persistence, validation rules, audit events, FastAPI endpoints, router registration, and end-to-end tests for accept, reject, and needs-revision workflows. ChangesStructured review decisions and findings
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ReviewAPI
participant ReviewService
participant Database
participant AuditEvent
Client->>ReviewAPI: POST /api/v1/reviews
ReviewAPI->>ReviewService: create_review(payload, actor_id)
ReviewService->>Database: validate submission and checker results
ReviewService->>Database: save Review and ReviewFinding records
ReviewService->>AuditEvent: record review_decision_created
ReviewService-->>ReviewAPI: ReviewSchema
ReviewAPI-->>Client: review response
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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
🤖 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 `@backend/app/modules/review/service.py`:
- Around line 105-107: Update create_review, get_review, and
get_reviews_for_submission to eager-load the Review.findings relationship before
calling ReviewSchema.model_validate. Reuse the existing async query/loading
patterns where available, ensuring each returned Review has findings populated
while preserving the current serialization behavior.
In `@backend/tests/test_review.py`:
- Around line 201-214: Update the test setup around the seeded CheckerResult to
create and persist a CheckerRun first, then assign its generated id to
CheckerResult.checker_run_id instead of using a random UUID. Keep the blocking
result’s existing task, submission, and review-blocking fields unchanged so the
commit succeeds with a valid foreign-key relationship.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f6f7f1fd-e0db-40ba-b190-09938b52b6b2
📒 Files selected for processing (8)
backend/alembic/versions/0015_review_models.pybackend/app/api/router.pybackend/app/db/models.pybackend/app/modules/review/models.pybackend/app/modules/review/router.pybackend/app/modules/review/schemas.pybackend/app/modules/review/service.pybackend/tests/test_review.py
1. Eager-load Review.findings via selectinload in create_review, get_review, and get_reviews_for_submission to prevent MissingGreenlet during Pydantic serialization. 2. Seed a real CheckerRun before CheckerResult in test_accept_blocked_by_checker_result to satisfy the FK constraint on checker_run_id.
Workstream PR Trust Bundle
Chunk
issue-34 - Structured review decisions and findings
Goal
Add persistent, auditable human review decisions (accept/needs_revision/reject) with structured findings.
What Changed
Created backend/app/modules/review/ module with:
Acceptance Criteria Proof
Test Delta
Human Merge Ownership