Skip to content

Fix for #526#527

Merged
grunch merged 1 commit into
mainfrom
fix-#526
Oct 2, 2025
Merged

Fix for #526#527
grunch merged 1 commit into
mainfrom
fix-#526

Conversation

@arkanoider

@arkanoider arkanoider commented Oct 1, 2025

Copy link
Copy Markdown
Collaborator

@grunch @Catrya ,

this is the fix for #526 , now initiator of dispute is correctly sent to admin( solver ) when the dispute is taken, previously, my bad, I was sending the pubkey of order creator.

Summary by CodeRabbit

  • Bug Fixes

    • Correctly attributes dispute initiator and counterpart based on buyer/seller dispute state.
    • Adds early validation to block unsupported dispute state combinations with clearer errors.
    • Ensures consistent display of initiator information in admin dispute handling.
  • Refactor

    • Minor formatting cleanup in database logic with no user-visible or functional changes.

@coderabbitai

coderabbitai Bot commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Consolidates dispute initiator/counterpart selection in admin_take_dispute_action to a three-way match on seller_dispute/buyer_dispute, with early error on invalid combinations. Replaces order_creator_tradekey usage with dispute_initiator in SolverDisputeInfo. Minor formatting-only refactor in db::is_dispute_taken_by_admin without logic changes.

Changes

Cohort / File(s) Summary
Admin dispute flow logic
src/app/admin_take_dispute.rs
Replaced buy/sell-based inference with match on (seller_dispute, buyer_dispute); selects initiator/counterpart accordingly; adds early error for unsupported states; SolverDisputeInfo now uses dispute_initiator.to_string().
DB helper formatting
src/db.rs
Reformatted closure in is_dispute_taken_by_admin; no behavioral change.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Admin
  participant App as App (admin_take_dispute_action)
  participant DB

  Admin->>App: Take dispute request
  App->>DB: (Optional) is_dispute_taken_by_admin(order_id)
  DB-->>App: Boolean/Option

  App->>App: Read order.seller_dispute, order.buyer_dispute
  alt seller_dispute = true && buyer_dispute = false
    Note right of App: Initiator = seller<br/>Counterpart = buyer
    App->>App: Build SolverDisputeInfo(dispute_initiator)
    App-->>Admin: Proceed with dispute handling
  else buyer_dispute = true && seller_dispute = false
    Note right of App: Initiator = buyer<br/>Counterpart = seller
    App->>App: Build SolverDisputeInfo(dispute_initiator)
    App-->>Admin: Proceed with dispute handling
  else invalid combination
    Note right of App: Early return error
    App-->>Admin: DisputeEventError
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Catrya
  • grunch

Poem

I thump my paws—disputes in line,
Two flags decide whose claim to sign.
If seller squeaks, or buyer squeals,
I pick the path, no wobbly wheels.
Early hop when states don’t match—
Clean tracks laid down—dispatch! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title “Fix for #526” is too generic because it only references the issue number and does not describe the actual change, which is about correctly sending the dispute initiator’s pubkey to the admin when a dispute is taken. Because it fails to convey the main purpose of the PR without opening the issue, it does not meet the clarity criteria. Please update the title to briefly summarize the key change, for example: “Ensure dispute initiator pubkey is sent to admin (fixes #526)”.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-#526

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.

@arkanoider arkanoider requested review from Catrya and grunch October 1, 2025 20:11

@Catrya Catrya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tACK

@grunch grunch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

plomo al hampa plo plo plo!

@grunch grunch merged commit d700909 into main Oct 2, 2025
1 check passed
@grunch grunch deleted the fix-#526 branch October 2, 2025 17:27
@arkanoider

Copy link
Copy Markdown
Collaborator Author

plomo al hampa plo plo plo!

Don't know what that means, but sounds gooood!!

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.

3 participants