fix(predict): filter stale markets from discovery feeds#30405
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f08d88c. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
No other feature areas (accounts, swaps, network, browser, snaps, etc.) are affected by these changes. Performance Test Selection: |
|




Description
This PR prevents stale or effectively settled Predict markets from occupying discovery feed surfaces.
marketStalenessutility for probability thresholds, formal market status, daily/game expiry, time penalties, ranking penalties, and highlighted-market exceptions.PredictController.getMarkets, keeping open highlighted markets pinned first while still excluding closed/resolved highlighted markets.PredictMarketMultipleexact0/1outcome filter so display components render the outcomes already prepared by the shared feed model.Branch review summary:
mainpredict/PRED-747-filter-dead-resolved-markets-from-predict-feed-4-layer-staleness-systemAutomated coverage added/updated:
PredictMarketMultipleno longer owns price-based stale filtering.Changelog
CHANGELOG entry: Fixed stale Predict markets appearing in discovery feeds and search results.
Related issues
Fixes: PRED-747
Related: PRED-707, PRED-533, PRED-744
Manual testing steps
Screenshots/Recordings
N/A - this is feed data filtering/ranking behavior covered by automated tests, with no intended layout or visual styling change.
Before Left / After Right
after-github.mov
before-github.mov
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Verification
yarn jest app/components/UI/Predict/utils/marketStaleness.test.ts app/components/UI/Predict/hooks/usePredictMarketData.test.tsx app/components/UI/Predict/hooks/usePredictSearchMarketData.test.tsx app/components/UI/Predict/hooks/useFeaturedCarouselData.test.ts app/components/UI/Predict/hooks/usePredictWorldCup.test.ts app/components/UI/Predict/components/PredictMarketMultiple/PredictMarketMultiple.test.tsx --runInBand --coverage=false yarn jest app/components/UI/Predict/controllers/PredictController.test.ts -t "getMarkets with market highlights" --runInBand --coverage=falseNote
Medium Risk
Changes Predict discovery data shaping by filtering/reshaping outcomes and re-ranking markets (including a new
isHighlightedflag), which can affect what users see and pagination behavior across multiple surfaces.Overview
Prevents stale/settled Predict markets from appearing in discovery surfaces by introducing a shared
marketStalenesspolicy (getVisiblePredictMarkets) that drops closed/expired markets and prunes “dead” outcomes (probability near 0/1), while re-ranking remaining markets.Applies this visibility filter in
usePredictMarketData,useFeaturedCarouselData,usePredictWorldCupMarkets, and the empty-query fallback path inusePredictSearchMarketData, with tests asserting pagination/cursors remain unchanged.Updates
PredictController.getMarketsto tag fetched highlight markets withisHighlighted(kept pinned and exempt from staleness filtering), and removesPredictMarketMultiple’s old price-based outcome filtering so the UI renders outcomes as provided by the feed model.Reviewed by Cursor Bugbot for commit 443cd36. Bugbot is set up for automated code reviews on this repo. Configure here.