Skip to content

fix: improve cancellation message when order expires#539

Closed
Deepak8858 wants to merge 1 commit intoMostroP2P:mainfrom
Deepak8858:fix/issue-532-misleading-cancel-message
Closed

fix: improve cancellation message when order expires#539
Deepak8858 wants to merge 1 commit intoMostroP2P:mainfrom
Deepak8858:fix/issue-532-misleading-cancel-message

Conversation

@Deepak8858
Copy link
Copy Markdown

@Deepak8858 Deepak8858 commented Mar 18, 2026

Improves the cancellation message shown to the user when an order expires due to counterparty inactivity. Instead of saying 'You have canceled the order', it now says 'The counterparty did not respond in time. The order has been canceled.' if the order status is expired.\n\nFixes #532

Summary by CodeRabbit

  • Bug Fixes
    • Improved order status handling: Orders now correctly display as "expired" when the counterparty fails to respond in time, rather than showing as canceled.
    • Enhanced user messaging: Added a specific timeout-related message to clarify when orders expire due to inactivity, now available in English and Spanish.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2e9aca1c-9486-447e-86c3-5ec2c5845581

📥 Commits

Reviewing files that changed from the base of the PR and between d693cfe and c0c8a56.

📒 Files selected for processing (4)
  • lib/features/order/models/order_state.dart
  • lib/features/trades/widgets/mostro_message_detail_widget.dart
  • lib/l10n/intl_en.arb
  • lib/l10n/intl_es.arb

Walkthrough

The PR modifies order state handling to distinguish timeout-based cancellations from user-initiated ones. When an order's status is marked as expired in the payload, it now returns Status.expired instead of Status.canceled. The UI displays a localized message indicating the counterparty didn't respond in time, rather than a generic cancellation message. Changes include order state mapping logic, message detail widget conditional check, and English and Spanish localizations.

Changes

Cohort / File(s) Summary
Order State Logic
lib/features/order/models/order_state.dart
Modified status mapping for canceled-related actions (canceled, cancel, adminCanceled, adminCancel, cooperativeCancelAccepted, holdInvoicePaymentCanceled) to conditionally return Status.expired when payload status is Status.expired, otherwise return Status.canceled.
Message Display Widget
lib/features/trades/widgets/mostro_message_detail_widget.dart
Added conditional check in canceled action branch to detect when tradeState.status equals Status.expired and return localized timeout message instead of standard canceled message.
Localization Strings
lib/l10n/intl_en.arb, lib/l10n/intl_es.arb
Added new localization key canceledByTimeout with English message "The counterparty did not respond in time. The order has been canceled." and Spanish equivalent "Tu contraparte no respondió a tiempo. La orden ha sido cancelada."

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested reviewers

  • Catrya
  • grunch
  • AndreaDiazCorreia

Poem

🐰 A timeout tale, now crystal clear,
No more confusion in the atmosphere,
When silence speaks and time runs out,
The message says what it's about—
The counterparty left you hanging there,
Not you, who played it fair!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: improving the cancellation message when an order expires due to counterparty inactivity.
Linked Issues check ✅ Passed The changes directly address issue #532 by detecting expired status and displaying a timeout-specific message instead of a generic cancellation message.
Out of Scope Changes check ✅ Passed All changes are scoped to addressing the timeout-cancellation messaging issue: status detection logic, UI message updates, and localization strings.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@grunch grunch requested a review from Catrya March 18, 2026 14:10
Copy link
Copy Markdown
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

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

Hey, thanks for working on this! I took a look at the PR and I think there's an issue with the approach.
The fix checks for payloadStatus == Status.expired when an Action.canceled is received, but when an order expires due to counterparty inactivity, Mostro sends
Action::Canceled with None as the payload, it never sends Status::Expired in the payload. So message.getPayload<Order>()?.status will always be null in this scenario, and the condition on line 300 will never be true.

The message will still always fall through to the regular "You have canceled the order" text, which is exactly the problem we're trying to fix.

Did you get a chance to test this locally against a running Mostro instance?

@Catrya
Copy link
Copy Markdown
Member

Catrya commented Mar 19, 2026

Hello @Deepak8858 this PR will be closed due to inactivity regarding the requested changes. Feel free to reopen it if you wish to continue working on it or to start a new one. Thank you for your interest in collaborating on the project.

@Catrya Catrya closed this Mar 19, 2026
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.

2 participants