Skip to content

feat: add Request Revisions action to submission approval panel#262

Merged
Benjtalkshow merged 2 commits into
boundlessfi:mainfrom
xJeffx23:feature/request-revisions
May 30, 2026
Merged

feat: add Request Revisions action to submission approval panel#262
Benjtalkshow merged 2 commits into
boundlessfi:mainfrom
xJeffx23:feature/request-revisions

Conversation

@xJeffx23
Copy link
Copy Markdown
Contributor

@xJeffx23 xJeffx23 commented May 29, 2026

Closes #202

Summary

  • Adds useRequestRevisions mutation following same shape as useApproveApplicationSubmission (optimistic update → UNDER_REVIEW, rollback on error)
  • Re-enables the Request Revisions button in SubmissionApprovalPanel; clicking reveals a textarea for feedback wired to the new mutation with success toast and panel reset
  • Surfaces reviewComments as a revision feedback banner in ApplicationSubmitWorkPanel so contributors see what needs changing before resubmitting
  • Updates bounty-detail-client.tsx to pass submissionId and revisionFeedback props (required to wire the new behavior end-to-end)

Test plan

  • useRequestRevisions accepts bountyId, submissionId, feedback
  • Optimistic update sets bounty status to UNDER_REVIEW; rolls back on error
  • Reviewer clicks Request Revisions → textarea reveals → submits feedback → success toast → panel resets
  • Cancel button hides textarea without submitting
  • Send Request disabled when textarea empty
  • Contributor sees "Revision Requested" banner with feedback text
  • Contributor submit form visible when revision pending (7 E2E tests, all passing)

Summary by CodeRabbit

  • New Features

    • Reviewers can request revisions on submissions with detailed feedback; creators can send revision requests from the approval panel.
    • Contributors receive visible revision feedback (a “Revision Requested” notice) and can resubmit work while preserving the submit form.
  • Tests

    • Added end-to-end tests covering the full request-revisions flow and contributor/creator UI behavior.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

@xJeffx23 is attempting to deploy a commit to the Threadflow Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@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! 🚀

Learn more about application limits

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

📝 Walkthrough

Walkthrough

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

Changes

Request Revisions for Bounty Submissions

Layer / File(s) Summary
Request Revisions GraphQL Mutation Hook
hooks/use-bounty-application.ts
The new useRequestRevisions hook executes a ReviewSubmission mutation to set submission status to REVISION_REQUESTED with feedback, applies an optimistic bounty status update to UNDER_REVIEW, rolls back on error, and invalidates bounty queries on settle.
Reviewer-Facing Revision Request Interface
components/bounty/submission-approval-panel.tsx
SubmissionApprovalPanel adds a "Request Revisions" workflow: toggled textarea for feedback, validation, useRequestRevisions mutation call, loading/error handling, success toast, and form reset/cancel behavior.
Contributor-Facing Revision Feedback Display
components/bounty/application-submit-work-panel.tsx
ApplicationSubmitWorkPanel accepts optional revisionFeedback?: string and renders a styled "Revision Requested" warning card with the feedback above the submission form when present.
Bounty Detail Integration and Conditional Rendering
components/bounty-detail/bounty-detail-client.tsx
BountyDetailClient computes mySubmission, shows the submit panel during UNDER_REVIEW when a REVISION_REQUESTED submission with comments exists, passes revisionFeedback to submit panel, and forwards submissionId to SubmissionApprovalPanel.
End-to-End Tests for Request Revisions Flow
e2e/request-revisions.spec.ts
Playwright tests mock auth and GraphQL responses to validate reviewer-side revision request interactions and contributor-side visibility of revision feedback while keeping the submit form available for resubmission.

Sequence Diagram

sequenceDiagram
  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
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

Suggested Reviewers

  • Benjtalkshow

Poem

🐰 I nibbled on the diff today,

"Please tweak this part," the reviewer did say.
Feedback wrapped in carrot-sweet lines,
Contributors hop back, fix the designs.
A tiny thump — resubmitted, good as new!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly summarizes the main feature addition: implementing the Request Revisions action in the submission approval panel, directly matching the PR's primary objective.
Linked Issues check ✅ Passed All coding requirements from issue #202 are met: useRequestRevisions hook created with optimistic updates [#202], Request Revisions UI wired in SubmissionApprovalPanel [#202], revision feedback surfaced in ApplicationSubmitWorkPanel [#202], and all acceptance criteria fulfilled.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #202: modifications to three specified files (use-bounty-application.ts, submission-approval-panel.tsx, application-submit-work-panel.tsx), bounty-detail-client.tsx wiring, and E2E tests validating the feature.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown
Contributor

@Benjtalkshow Benjtalkshow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@xJeffx23
Copy link
Copy Markdown
Contributor Author

Hi! Thanks for the feedback. I'll work on both requested changes and push the updates shortly.🚀

@xJeffx23 xJeffx23 requested a review from Benjtalkshow May 30, 2026 20:59
@xJeffx23
Copy link
Copy Markdown
Contributor Author

Hi! The requested changes are now complete and ready for review. 🫡

Thanks!

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 77f7d7e and d17daec.

📒 Files selected for processing (2)
  • components/bounty-detail/bounty-detail-client.tsx
  • e2e/request-revisions.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e/request-revisions.spec.ts

Comment on lines +174 to +176
const hasRevision =
mySubmission?.status === "REVISION_REQUESTED" &&
!!mySubmission?.reviewComments;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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.

Suggested change
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.

Copy link
Copy Markdown
Contributor

@Benjtalkshow Benjtalkshow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Benjtalkshow Benjtalkshow merged commit d7e79e6 into boundlessfi:main May 30, 2026
1 of 2 checks passed
@xJeffx23
Copy link
Copy Markdown
Contributor Author

Thanks for the review and for the helpful feedback!

I appreciate it. Looking forward to contributing more. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the Request Revisions flow on the submission approval panel

2 participants