Skip to content

fix(order-progress): show cancelling screen from unfillable step - #7889

Merged
kernelwhisperer merged 2 commits into
cowprotocol:developfrom
tenderdeve:fix/6881-cancelling-screen
Jul 24, 2026
Merged

kernelwhisperer merged 2 commits into
cowprotocol:developfrom
tenderdeve:fix/6881-cancelling-screen

Conversation

@tenderdeve

@tenderdeve tenderdeve commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #6881

When an order is showing the unfillable / price out of market screen and the user cancels it, the cancelling screen was never shown — the progress bar jumped straight from unfillable to cancelled.

Cause: the minimum step-display debounce delays a step change if the previous step was shown for less than the minimum time. CANCELLING was not in the list of steps exempt from this debounce, so the delayed update was still pending when the order reached the cancelled state, and it got cleared before firing.

Fix: show CANCELLING immediately, alongside the other terminal user-facing steps (finished, cancelled, expired, cancellation failed).

Summary by CodeRabbit

  • Bug Fixes
    • Updated the order progress bar so cancellation/terminal and early step transitions render immediately, rather than waiting for the minimum-display debounce.
    • Preserved debounce behavior for normal intermediate steps until the minimum display time has elapsed.
  • Tests
    • Added/expanded unit tests covering immediate vs debounced step updates, including recent changes, elapsed minimum time, and first-step rendering when no prior timestamp exists.

@vercel

vercel Bot commented Jul 23, 2026

Copy link
Copy Markdown

@tenderdeve is attempting to deploy a commit to the cow-dev Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fdef8d72-39ed-4742-963d-3c32aa7daf92

📥 Commits

Reviewing files that changed from the base of the PR and between b7c16da and 5fd7492.

📒 Files selected for processing (2)
  • apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.test.ts
  • apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts
  • apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.test.ts

Walkthrough

The order progress bar centralizes immediate step decisions in an exported helper, uses it during updates, and adds tests for cancellation, terminal, timestamp, and debounce behavior.

Changes

Order progress bar

Layer / File(s) Summary
Centralize immediate step handling
apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts
Defines IMMEDIATE_STEP_NAMES, adds shouldUpdateStepImmediately, and replaces inline step comparisons in the updater while preserving timer behavior.
Validate debounce decisions
apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.test.ts
Tests immediate cancellation and terminal updates, recent normal-step debouncing, elapsed display time, and missing timestamps.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: elena-zh, kernelwhisperer

Poem

I’m a rabbit hopping past delay,
Helping key progress steps show the way.
Cancellations now appear on cue,
With tested timing hopping through.
🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix, but it omits the template's To Test section and any Background details. Add a To Test section with verification steps; include Background and screenshots if helpful.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: showing the cancelling screen immediately from the unfillable flow.
Linked Issues check ✅ Passed The change makes CANCELLING display immediately, matching the #6881 requirement for the cancelling screen to appear.
Out of Scope Changes check ✅ Passed The diff stays focused on progress-bar debounce behavior and regression tests, with no obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

@elena-zh

Copy link
Copy Markdown
Contributor

@tenderdeve , please rebase the PR to develop

@kernelwhisperer
kernelwhisperer changed the base branch from main to develop July 23, 2026 11:12
@kernelwhisperer
kernelwhisperer force-pushed the fix/6881-cancelling-screen branch from 6de8136 to 1cb7594 Compare July 23, 2026 11:14
@vercel

vercel Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swap-dev Ready Ready Preview Jul 23, 2026 11:18am

Request Review

@kernelwhisperer
kernelwhisperer requested a review from a team July 23, 2026 11:20

@elena-zh elena-zh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thank you!

@elena-zh
elena-zh enabled auto-merge (squash) July 23, 2026 12:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts (1)

467-471: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for the centralized immediate-step contract.

Test that cancellation and terminal steps bypass the minimum display delay while a normal step remains debounced. This protects the cancellation-flow behavior introduced by this change.

🤖 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
`@apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts`
around lines 467 - 471, Add regression tests around the immediate-step condition
in useOrderProgressBarProps, covering cancellation and terminal step names
bypassing MINIMUM_STEP_DISPLAY_TIME while a normal step remains debounced. Reuse
the existing hook test setup and IMMEDIATE_STEP_NAMES contract, and assert the
resulting transition behavior for each case.
🤖 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.

Nitpick comments:
In
`@apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts`:
- Around line 467-471: Add regression tests around the immediate-step condition
in useOrderProgressBarProps, covering cancellation and terminal step names
bypassing MINIMUM_STEP_DISPLAY_TIME while a normal step remains debounced. Reuse
the existing hook test setup and IMMEDIATE_STEP_NAMES contract, and assert the
resulting transition behavior for each case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0631633a-a3e9-4847-a7be-ab75c09c9fad

📥 Commits

Reviewing files that changed from the base of the PR and between 4d8111e and 47f2967.

📒 Files selected for processing (1)
  • apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts

auto-merge was automatically disabled July 23, 2026 13:04

Head branch was pushed to by a user without write access

@tenderdeve

Copy link
Copy Markdown
Contributor Author

@coderabbitai updated in b7c16da — extracted the immediate-step decision into shouldUpdateStepImmediately and added regression tests asserting cancellation/terminal steps bypass the minimum display time while a normal step stays debounced.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git show --stat --oneline --decorate --no-renames b7c16dad9
git show --format=fuller --no-ext-diff --unified=80 --no-renames b7c16dad9 -- \
  apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts \
  'apps/cowswap-frontend/src/modules/orderProgressBar/**'

printf '\n--- candidate tests ---\n'
fd -a -t f . apps/cowswap-frontend/src/modules/orderProgressBar | rg '(/|^)(useOrderProgressBarProps|.*[Tt]est.*|.*[Ss]pec.*)\.(ts|tsx)$' || true

printf '\n--- hook outline ---\n'
ast-grep outline apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts --items all --view expanded || true

Length of output: 22654


@tenderdeve Reviewed b7c16dad9: the extracted shouldUpdateStepImmediately is wired into the scheduling path, includes CANCELLING, and the focused tests cover immediate cancellation/terminal transitions plus the normal debounce behavior. This addresses the concern. Nice coverage addition. 🐇


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

The minimum step-display debounce delayed the CANCELLING step when the
previous step (e.g. unfillable / price out of market) had been shown for
less than the minimum time. The order reached the cancelled state before
the delayed update fired, so the cancelling screen was skipped entirely.
Show CANCELLING immediately, like the other terminal user-facing steps.
Extract the immediate-step decision into shouldUpdateStepImmediately and
add regression tests asserting cancellation and terminal steps bypass the
minimum display time while a normal step stays debounced.

Addresses @coderabbitai's review suggestion.
@tenderdeve
tenderdeve force-pushed the fix/6881-cancelling-screen branch from 53415e3 to 5fd7492 Compare July 24, 2026 05:09
@tenderdeve

Copy link
Copy Markdown
Contributor Author

@elena-zh rebased onto latest develop (dropped the merge commit) and force-pushed — 5fd7492be. The per-chain countdown from #7888 that landed in develop meant PROGRESS_BAR_TIMER_DURATION moved out to constants.ts, so I dropped the stale local copy while resolving; the debounce fix + tests are unchanged. Green on my end.

@kernelwhisperer
kernelwhisperer enabled auto-merge (squash) July 24, 2026 07:47
@kernelwhisperer
kernelwhisperer merged commit 39861d3 into cowprotocol:develop Jul 24, 2026
13 of 19 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No 'cancelling' screen on the progress bar when 'price out of market' screen is displayed

3 participants