fix(order-progress): preserve solver ranking when deduplicating competition entries - #7901
fix(order-progress): preserve solver ranking when deduplicating competition entries#7901tenderdeve wants to merge 7 commits into
Conversation
…tition entries Deduplicate solver-competition entries by merged solverId while traversing from highest to lowest rank, so the highest-ranked occurrence per solver is retained and the winner stays at index 0. The previous object-keyed dedup kept each key's original insertion slot, so reversing could sink the winner below another solver, and duplicate legacy aliases (e.g. naive / naive-solve) were not collapsed.
|
@tenderdeve is attempting to deploy a commit to the cow-dev Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe order progress bar now builds solver competition results with rank-preserving traversal and canonical solver deduplication. New tests cover repeated solvers, legacy aliases, invalid entries, and missing competition data. ChangesSolver competition ranking
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@tenderdeve , the build failed with these errors |
mergeSolverData always assigns a string solverId at runtime, but the SolverCompetition type keeps it optional, so passing it to a Set<string> failed typecheck (TS2345). Narrow it explicitly and keep entries without a solverId instead of deduplicating them.
|
@elena-zh fixed in |
|
Will be reviewed after #7947 is merged |
|
@tenderdeve , could you pls resolve conflicts here? |
…dedup-ranking # Conflicts: # apps/cowswap-frontend/src/modules/orderProgressBar/hooks/useOrderProgressBarProps.ts
|
@elena-zh conflicts resolved in The only conflict was in
Changed files lint clean. I couldn't run the jest suite locally — the test's import graph pulls in |
|
@tenderdeve , could you please clarify what to test here? |
|
@elena-zh it's a display-only fix — it changes how the solver competition list in the order progress bar is deduplicated so the winning solver always ends up at index 0. What broke: the old code keyed dedup on the raw Automated (primary): the logic lives in the extracted Manual smoke: open any filled order's progress bar and confirm the solver list shows the winning solver at the top with no duplicate solver rows. For ordinary orders (no repeated or aliased solver in the competition) there's no visible change — this only corrects that edge case. Forcing the bug in the UI needs a competition payload where the winner's solver appears twice (or two addresses mapping to one |

Closes #7879
The solver-competition list was deduplicated through an object keyed by the raw
entry.solver, then reversed. Updating an existing key keeps its original insertion slot, so a repeated winner could end up below another solver after the reverse, and legacy aliases (naive/naive-solve) were not collapsed.Now the list is built with
reduceRight— traversing highest to lowest rank, merging viamergeSolverData, and keeping the first occurrence per mergedsolverId. The highest-ranked entry per solver is retained and the winner stays at index 0. Dedup extracted into an exportedbuildSolverCompetitionhelper.Tests cover repeated raw solver names, aliases that normalize to the same
solverId, invalid-entry exclusion, and empty input.Summary by CodeRabbit