fix: surface InvalidOrderId to clients as CantDo(NotFound)#752
fix: surface InvalidOrderId to clients as CantDo(NotFound)#752AndreaDiazCorreia wants to merge 2 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 7 minutes and 53 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ 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 |
|
Summary
Closes #751.
Admin actions (
AdminSettle,AdminCancel) — and any handler that calledget_order— used to returnMostroInternalErr(ServiceError::InvalidOrderId)when the message lacked anidor the order was not present in the database. That error was routed tomanage_errors, which only callswarning_msgand never enqueues a DM back to the sender. The client therefore never learned the action failed and timed out.This change promotes the user-facing path of
InvalidOrderIdtoMostroCantDo(CantDoReason::NotFound), so the sender receives aCantDoDM. It matches the existingCantDopattern already used inlast_trade_index_actionandorders_action, and is the option recommended in the issue.Changes
util.rs::get_order: returnCantDo(NotFound)when the message lacks anidand when the order is not present in the database.app/dispute.rs::dispute_action: returnCantDo(NotFound)when the message lacks anorder_id.app/admin_take_dispute.rs::admin_take_dispute_action:DbAccessErrorsemantics on real database failures (previously silently mapped toInvalidOrderId).CantDo(NotFound)when the dispute's referenced order is missing, so the admin gets feedback.get_orderbranches: missing id, order not found, order found.Affected actions
AdminSettle,AdminCancel,Dispute,AdminTakeDispute, and any other handler that resolves an order throughget_order(FiatSent,TakeBuy,TakeSell,AddInvoice,Cancel,Release,RateUser,TradePubkey).Test plan
cargo build --tests -p mostro— clean.cargo test -p mostro --bin mostrod— 334 passed, 0 failed (3 new tests added).cargo clippy -p mostro --bin mostrod --tests— no new warnings.AdminSettlewith a non-existentorder_idand verify the admin receives aCantDo(NotFound)DM instead of a timeout.Related