feat: add Request Revisions action to submission approval panel#262
Conversation
|
@xJeffx23 is attempting to deploy a commit to the Threadflow Team on Vercel. A member of the Team first needs to authorize it. |
|
@xJeffx23 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
📝 WalkthroughWalkthroughThis PR implements a complete "Request Revisions" workflow for milestone-based bounties. Reviewers can now submit revision feedback through an interactive form, which triggers a GraphQL mutation with optimistic cache updates. Contributors receive the feedback in a styled warning block on the submission panel, allowing them to resubmit their work. E2E tests verify both reviewer and contributor flows. ChangesRequest Revisions for Bounty Submissions
Sequence DiagramsequenceDiagram
participant Reviewer as SubmissionApprovalPanel
participant useMutation as useRequestRevisions
participant GraphQL as ReviewSubmission Mutation
participant ReactQuery as React Query Cache
participant Contributor as ApplicationSubmitWorkPanel
Reviewer->>useMutation: submitRevision(bountyId, submissionId, feedback)
useMutation->>ReactQuery: optimistic update (status→UNDER_REVIEW)
useMutation->>GraphQL: ReviewSubmission mutation
alt success
GraphQL-->>useMutation: mutation succeeds
useMutation->>ReactQuery: invalidate bounty queries
ReactQuery-->>Contributor: refetch shows REVISION_REQUESTED + reviewComments
else error
GraphQL-->>useMutation: mutation fails
useMutation->>ReactQuery: rollback to previous state
end
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly Related PRs
Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Benjtalkshow
left a comment
There was a problem hiding this comment.
The hook follows the approve pattern, the dialog flow works, and the contributor side shows the revision banner as expected.
Two things to fix. pnpm tsc --noEmit fails at e2e/request-revisions.spec.ts:288 and :308 because MOCK_BOUNTY_UNDER_REVIEW.submissions[0].reviewComments: null is inferred as the literal null type, so MOCK_BOUNTY_WITH_REVISION can't override with a string. Fix by typing it as reviewComments: null as string | null.
Also, bounty-detail-client.tsx:243-269 chains an IIFE inside JSX and calls bounty.submissions?.find(...) twice. Extract mySubmission, hasRevision, and showSubmitPanel to local variables above the return so each lookup happens once and the JSX reads cleanly.
|
Hi! Thanks for the feedback. I'll work on both requested changes and push the updates shortly.🚀 |
|
Hi! The requested changes are now complete and ready for review. 🫡 Thanks! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@components/bounty-detail/bounty-detail-client.tsx`:
- Around line 174-176: The current hasRevision boolean (used to compute
showSubmitPanel) includes a check for mySubmission?.reviewComments which can
block showing ApplicationSubmitWorkPanel when a revision was requested but
reviewComments is empty; remove the "&& !!mySubmission?.reviewComments"
condition so hasRevision is simply mySubmission?.status ===
"REVISION_REQUESTED", and let ApplicationSubmitWorkPanel (and the
revisionFeedback prop/logic) handle undefined/empty feedback gracefully; update
any references that compute revisionFeedback to tolerate undefined
reviewComments.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 32a6ae45-8e02-405b-9836-b2de6fafece2
📒 Files selected for processing (2)
components/bounty-detail/bounty-detail-client.tsxe2e/request-revisions.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- e2e/request-revisions.spec.ts
| const hasRevision = | ||
| mySubmission?.status === "REVISION_REQUESTED" && | ||
| !!mySubmission?.reviewComments; |
There was a problem hiding this comment.
Potential stuck state if revision requested without feedback.
The check for non-empty reviewComments on line 176 prevents showSubmitPanel from being true when bounty.status === "UNDER_REVIEW" unless feedback is present. If a revision is somehow requested with empty or missing reviewComments, the contributor would be unable to see the submission panel to resubmit their work, creating a stuck state.
While the UI validation should prevent this (per the PR description, "Send is disabled when textarea is empty"), relying solely on client-side validation is fragile if the backend doesn't enforce the same constraint.
Consider removing the && !!mySubmission?.reviewComments check and allowing the ApplicationSubmitWorkPanel component to handle empty feedback gracefully (e.g., showing the form without a feedback banner).
🛡️ Proposed fix to prevent stuck state
const hasRevision =
- mySubmission?.status === "REVISION_REQUESTED" &&
- !!mySubmission?.reviewComments;
+ mySubmission?.status === "REVISION_REQUESTED";With this change, revisionFeedback at line 260-263 would be undefined when comments are missing, and the panel would still allow resubmission.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const hasRevision = | |
| mySubmission?.status === "REVISION_REQUESTED" && | |
| !!mySubmission?.reviewComments; | |
| const hasRevision = | |
| mySubmission?.status === "REVISION_REQUESTED"; |
🤖 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 `@components/bounty-detail/bounty-detail-client.tsx` around lines 174 - 176,
The current hasRevision boolean (used to compute showSubmitPanel) includes a
check for mySubmission?.reviewComments which can block showing
ApplicationSubmitWorkPanel when a revision was requested but reviewComments is
empty; remove the "&& !!mySubmission?.reviewComments" condition so hasRevision
is simply mySubmission?.status === "REVISION_REQUESTED", and let
ApplicationSubmitWorkPanel (and the revisionFeedback prop/logic) handle
undefined/empty feedback gracefully; update any references that compute
revisionFeedback to tolerate undefined reviewComments.
Benjtalkshow
left a comment
There was a problem hiding this comment.
Both items are in. The mock typing is fixed and the conditional render extracts cleanly into named variables so the find call only happens once. Typecheck and lint clean.
Merging this in. Thanks.
|
Thanks for the review and for the helpful feedback! I appreciate it. Looking forward to contributing more. 🚀 |
Closes #202
Summary
useRequestRevisionsmutation following same shape asuseApproveApplicationSubmission(optimistic update →UNDER_REVIEW, rollback on error)SubmissionApprovalPanel; clicking reveals a textarea for feedback wired to the new mutation with success toast and panel resetreviewCommentsas a revision feedback banner inApplicationSubmitWorkPanelso contributors see what needs changing before resubmittingbounty-detail-client.tsxto passsubmissionIdandrevisionFeedbackprops (required to wire the new behavior end-to-end)Test plan
useRequestRevisionsacceptsbountyId,submissionId,feedbackUNDER_REVIEW; rolls back on errorSummary by CodeRabbit
New Features
Tests