Skip to content

fix(predict): allow claims for pushed markets - #34513

Draft
ghgoodreau wants to merge 2 commits into
mainfrom
fix/pred-959-claim-pushed-markets
Draft

fix(predict): allow claims for pushed markets#34513
ghgoodreau wants to merge 2 commits into
mainfrom
fix/pred-959-claim-pushed-markets

Conversation

@ghgoodreau

@ghgoodreau ghgoodreau commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

Pushed prediction markets resolve without a winner and return the user's stake, producing a claimable position with zero cash P&L. These positions were previously classified as lost, so they were excluded from the claim flow and the confirmation UI failed before constructing a transaction.

This change classifies zero-P&L claimable positions as REDEEMABLE, distinct from both WON and LOST. Redeemable positions are included in claim amounts, claim confirmation, portfolio totals, and pending-claim history, while win-only selectors and labels continue to include only actual wins. Pending pushed positions are displayed as resolved rather than won.

Regression tests cover the status boundaries and verify that redeemable positions can be claimed without being presented as wins.

Changelog

CHANGELOG entry: Fixed claims for prediction markets that resolved as a push

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/PRED-959

Manual testing steps

Feature: Claim a pushed prediction market position

  Scenario: User claims a position from a market resolved as a push
    Given the user has a claimable prediction position with zero cash P&L
    And the market has resolved as a push

    When the user starts the claim flow
    Then the pushed position is included in the claimable amount
    And the claim confirmation is displayed without a no-won-positions error
    And the position is shown as resolved rather than won

    When the user confirms the claim
    Then the claim transaction is submitted

Automated verification completed:

  • Polymarket position status tests
  • Predict controller selector tests
  • Predict portfolio hook tests
  • Predict claim footer and claim amount tests
  • Predict positions header and transaction history tests
  • ESLint and Prettier checks for changed files

Screenshots/Recordings

N/A. This fixes claim eligibility and status classification without introducing a new visual design.

Before

N/A. The claim flow failed before rendering a usable confirmation for pushed positions.

After

N/A. Covered by focused unit and component tests.

Pre-merge author checklist

Performance checks (if applicable)

The performance checks below were assessed as not applicable because this is a small status-classification fix with no new rendering loop, network request, or performance-sensitive operation.

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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.

@metamask-ci metamask-ci Bot added the team-predict Predict team label Aug 7, 2026
@github-actions github-actions Bot added the size-M label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeConfirmations, SmokeWalletPlatform
  • Selected Performance tags: @PerformancePredict
  • Risk Level: medium
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
All 13 changed files are within the Predictions/Polymarket feature area. The core change is a bug fix that introduces a new REDEEMABLE position status for positions where cashPnl === 0 (previously classified as LOST). This affects:

  1. SmokePredictions: The position lifecycle is directly affected — claiming/cashing out positions now includes REDEEMABLE positions. PredictController.getTotalClaimableAmount(), usePredictPortfolio, PredictPositionsHeader, and PredictTransactionsView all updated to handle REDEEMABLE status alongside WON.

  2. SmokeConfirmations: The claim confirmation UI components (predict-claim-amount.tsx, predict-claim-footer.tsx) and metrics hook (usePredictClaimConfirmationMetrics.ts) are updated to use new selectors that include REDEEMABLE positions. This directly affects the confirmation flow for claiming prediction winnings.

  3. SmokeWalletPlatform: Required per SmokePredictions tag description — "When selecting SmokePredictions, also select SmokeWalletPlatform (Trending section)." Predictions is a section inside the Trending tab.

The changes are scoped entirely to the Predictions feature with no impact on other wallet flows (accounts, networks, swaps, browser, snaps, etc.). Risk is medium because the REDEEMABLE status change affects the claim flow logic in both the controller and UI layers.

Performance Test Selection:
The PredictController and selectors are changed to add a new REDEEMABLE position status and new selectors (selectPredictPayablePositions, selectPredictClaimFiat, selectPredictClaimPnl). These selectors are used in the claim confirmation flow and positions header. The @PerformancePredict tag covers prediction market list loading, position management, deposit flows, and balance display — all of which could be affected by the new position status filtering logic. While the changes are not expected to degrade performance significantly, running the performance test validates that the new selector logic (additional filter pass over claimable positions) doesn't introduce measurable regressions in the predict flow.

View GitHub Actions results

@ghgoodreau ghgoodreau changed the title Fix/pred 959 claim pushed markets fix(predict): allow claims for pushed markets Aug 7, 2026
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

⚠️ Performance Test Results

ℹ️ Performance test results are currently non-blocking and will not block this PR.

1 test failed · 3 tests · 1 device

📱 Devices tested (1)

Android: Google Pixel 8 Pro (v14.0)

❌ Failed Tests (1)

🔬 App profiling vs main is included under each failed scenario that has a prior baseline.

@team-predict

Predict Deposit - Complete Flow Performance

Platform Device Reason Recording
Android Google Pixel 8 Pro (v14.0) Quality gates exceeded 📹 Watch

🔬 App profiling check · Current run 31217286445 · Baseline (last green on main) run 30897750395 @ 67486d2

Summary: ⚠️ 1 metric over +10%: Slow frames (+15.74 (+200.5%))

ℹ️ API calls unavailable: Network logs API error: Bad Request

Full metric table (+10% variance rules)

Disclaimer — allowed variance: a +10% margin over the baseline is permitted.

  • If Current <= Baseline + 10%, treated as acceptable noise.
  • If Current > Baseline + 10%, Current and variance % are highlighted with ⚠️.
Metric Baseline Current Δ
CPU avg 10.95% 10.11% -0.84 (-7.7%)
CPU max 24.51% 21.69% -2.82 (-11.5%)
Memory avg 686.99 MB 654.81 MB -32.18 (-4.7%)
Memory max 821.45 MB 782.97 MB -38.48 (-4.7%)
Slow frames 7.85% 23.59% +15.74 (+200.5%) ⚠️
Frozen frames 0% 0% 0 (0%)
ANRs 0 0 0 (0%)
Issues 2 2 0 (0%)
Critical issues 2 2 0 (0%)
App size 328.67 MB 328.72 MB +0.05 (+0%)
✅ Passed Tests (2)
Test Platform Device Duration Team Recording
Predict Market Details - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) 3.11s @team-predict 📹 Watch
Predict Available Balance - Complete Flow Performance Android Google Pixel 8 Pro (v14.0) 1.02s @team-predict 📹 Watch

Branch: fix/pred-959-claim-pushed-markets · Build: E2E · Commit: 8cc2807 · View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant