Skip to content

fix(disputes): restore useRaiseDispute hook lost in merge#268

Merged
Benjtalkshow merged 1 commit into
boundlessfi:mainfrom
Benjtalkshow:fix/restore-use-raise-dispute
Jun 1, 2026
Merged

fix(disputes): restore useRaiseDispute hook lost in merge#268
Benjtalkshow merged 1 commit into
boundlessfi:mainfrom
Benjtalkshow:fix/restore-use-raise-dispute

Conversation

@Benjtalkshow

@Benjtalkshow Benjtalkshow commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

PR #256 introduced components/bounty-detail/raise-dispute-dialog.tsx which imports useRaiseDispute from hooks/use-bounty-application.ts, but a merge with main during that PR dropped the hook itself.

pnpm tsc --noEmit failed on main after merge:

raise-dispute-dialog.tsx:28: error TS2305: Module '@/hooks/use-bounty-application' has no exported member 'useRaiseDispute'.

Re-adding the hook with the same shape as the original commit in #256. It POSTs to /api/disputes with bountyId, reason, and description, and invalidates the bounty detail and list queries on success.

pnpm tsc --noEmit and pnpm lint both clean.

Summary by CodeRabbit

  • New Features
    • Users can now raise disputes on bounties through a structured workflow. To initiate a dispute, users specify the reason and provide a detailed description of the issue. Submitted disputes are processed by the system and automatically refresh all related bounty information across the application, ensuring data remains synchronized and current.

PR boundlessfi#256 introduced raise-dispute-dialog.tsx which imports useRaiseDispute
from hooks/use-bounty-application.ts, but a merge with main during that
PR dropped the hook itself. tsc --noEmit failed on main after merge:

  raise-dispute-dialog.tsx:28: error TS2305: Module
  '@/hooks/use-bounty-application' has no exported member 'useRaiseDispute'.

Re-adding the hook with the same shape as the original commit.
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added dispute raising capability to the bounty application with new useRaiseDispute() hook that posts dispute details to /api/disputes and invalidates cached bounty queries. Updated dependencies to import DisputeReasonEnum and the REST post client. Minor formatting adjustments to existing utilities and message recording.

Changes

Dispute Raising and Bounty Application Hooks

Layer / File(s) Summary
Import setup and dependencies
hooks/use-bounty-application.ts
Added DisputeReasonEnum from GraphQL types and post REST client import. Reformatted delay helper utility without changing behavior.
In-memory message storage type
hooks/use-bounty-application.ts
Reformatted recordedMessages type annotation to multi-line generic structure without changing runtime behavior.
Existing hook formatting adjustments
hooks/use-bounty-application.ts
Minor formatting in useRemoveContributor slot calculation and useSendMessage whitespace; logic unchanged.
Raise dispute feature implementation
hooks/use-bounty-application.ts
RaiseDisputeInput and RaiseDisputeResult types define the dispute workflow. useRaiseDispute() posts to /api/disputes with bounty ID and dispute details, invalidates bounty detail and list queries on success. useSendMessage now logs when recording messages.

Sequence Diagram

sequenceDiagram
  participant Caller as Component
  participant Hook as useRaiseDispute
  participant Client as post client
  participant API as /api/disputes
  participant Cache as Query Cache

  Caller->>Hook: invoke with RaiseDisputeInput
  Hook->>Client: post(bountyId, reason, description)
  Client->>API: POST request
  API-->>Client: success response
  Hook->>Cache: invalidate bounty detail query
  Hook->>Cache: invalidate bounty lists query
  Hook-->>Caller: return RaiseDisputeResult
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • 0xdevcollins

Poem

🐰 A bounty dispute now takes flight,
With hooks that post and queries right,
Fresh types and flows, so clean and keen,
The finest dispute system seen! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% 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 The title clearly and specifically identifies the main change: restoring a previously lost hook that caused a build failure on the main branch.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@hooks/use-bounty-application.ts`:
- Around line 615-618: The console.log in useSendMessage currently prints raw
user content (message) and contributorId; remove or redact the message payload
and avoid emitting contributorId in production logs—either gate the detailed log
behind a debug flag (e.g., process.env.DEBUG or a provided isDebug variable) or
log only non-sensitive metadata such as bountyId and message length or a
redaction token; update the console.log call in useSendMessage to output safe
info (e.g., `bountyId=${bountyId}, messageLength=${message?.length}`) or wrap
the detailed message output in a debug-only branch.
🪄 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: d4abc8c7-a1cf-4086-975f-be4c77b74c81

📥 Commits

Reviewing files that changed from the base of the PR and between 9b49665 and 8e521b5.

📒 Files selected for processing (1)
  • hooks/use-bounty-application.ts

Comment on lines +615 to +618

console.log(
`[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}, message="${message}"`,
);

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

Avoid logging raw user message content.

This logs the full message body and contributorId on every send. Message text is user-generated data, and emitting it verbatim risks leaking sensitive content into production logs (and adds noise). Consider gating behind a debug flag or dropping the message payload from the log.

🔒 Proposed adjustment
-      console.log(
-        `[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}, message="${message}"`,
-      );
+      if (process.env.NODE_ENV !== "production") {
+        console.log(
+          `[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}`,
+        );
+      }
📝 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
console.log(
`[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}, message="${message}"`,
);
if (process.env.NODE_ENV !== "production") {
console.log(
`[useSendMessage] Recorded message for bountyId ${bountyId}: contributorId=${contributorId}`,
);
}
🤖 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 `@hooks/use-bounty-application.ts` around lines 615 - 618, The console.log in
useSendMessage currently prints raw user content (message) and contributorId;
remove or redact the message payload and avoid emitting contributorId in
production logs—either gate the detailed log behind a debug flag (e.g.,
process.env.DEBUG or a provided isDebug variable) or log only non-sensitive
metadata such as bountyId and message length or a redaction token; update the
console.log call in useSendMessage to output safe info (e.g.,
`bountyId=${bountyId}, messageLength=${message?.length}`) or wrap the detailed
message output in a debug-only branch.

@Benjtalkshow Benjtalkshow merged commit ffabea2 into boundlessfi:main Jun 1, 2026
3 of 4 checks passed
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.

1 participant