Skip to content

chore(runway): cherry-pick fix(predict): handle missing sports market labels cp-7.80.0#30955

Merged
tommasini merged 1 commit into
release/7.80.0from
runway-cherry-pick-7.80.0-1780427276
Jun 2, 2026
Merged

chore(runway): cherry-pick fix(predict): handle missing sports market labels cp-7.80.0#30955
tommasini merged 1 commit into
release/7.80.0from
runway-cherry-pick-7.80.0-1780427276

Conversation

@runway-github

@runway-github runway-github Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes missing and unsafe sports market labels in Predict game
details.

It adds a runtime safeguard for sports market type translations so cards
no longer render i18n missing markers when Polymarket ships a new market
type before the locale file is updated. When a translation is missing,
the UI falls back to the outcome title; for line markets, it uses the
currently selected line outcome title. Missing sports market translation
keys are logged once per app session with the full i18n key so locale
gaps can be discovered without spamming repeated renders.

It also adds English labels for known basketball and tennis market
types:

  • basketball_total_points: Totals
  • basketball_odd_even: Odd/Even Score
  • basketball_team_to_score_first: Team to Score First
  • tennis_set_handicap: Set Handicap

Finally, it hardens the Polymarket parser for search/feed responses
where spread markets may omit groupItemTitle. In that case, parsing
now falls back to market.question before formatting the spread title,
preventing replace from being called on undefined.

Automated validation:

yarn jest app/components/UI/Predict/components/PredictGameDetailsContent/PredictGameOutcomesTab.test.tsx app/components/UI/Predict/providers/polymarket/utils.test.ts

Result: 2 test suites passed, 88 tests passed.

Changelog

CHANGELOG entry: Fixed missing Predict sports market labels and
prevented a search result parsing error for some sports markets

Related issues

Fixes: PRED-944

Manual testing steps

Feature: Predict sports market labels

  Scenario: user views a known basketball sports market
    Given the user opens a Predict basketball game details screen
    When the game contains Total Points, Odd/Even Score, or Team to Score First markets
    Then the market card titles show the localized English labels

  Scenario: user views a sports market missing a translation
    Given the user opens a Predict game details screen with an untranslated sports market type
    When the card renders
    Then the card title falls back to the outcome title instead of showing an i18n missing marker
    And the missing translation key is logged only once per app session

  Scenario: user changes lines on an untranslated line market
    Given the user opens an untranslated line market in Predict game details
    When the user selects a different line
    Then the card title updates to the selected line outcome title

  Scenario: user searches Predict markets
    Given the user is searching Predict markets
    When a spread market response is missing groupItemTitle
    Then the market parses without a runtime error
    And the spread title falls back to the market question

Screenshots/Recordings

Before

Observed missing translation markers in Predict sports market cards and
a runtime parser error while searching sports markets.

After

Sports market cards render translated labels or outcome-title fallbacks,
missing translation keys are logged once, and search parsing handles
missing spread group titles without throwing.

Pre-merge author checklist

Performance checks (if applicable)

  • 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
  • See trace() for usage and
    addToken
    for an example

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.

Note

Low Risk
UI/i18n and defensive parsing in Predict sports flows; no auth,
payments, or trading logic changes.

Overview
Improves Predict sports game details when Polymarket exposes
market types or API fields before locales and parsers are fully aligned.

PredictGameOutcomesTab now resolves sports market type labels
via translation, then an optional outcome title fallback, then
title-cased type keys. Missing i18n (raw key or [missing markers) is
logged once per key through Logger.error instead of showing broken
copy on cards. Line cards use the selected line’s formatted
outcome title when the market type has no translation; subgroup and flat
moneyline paths pass the same fallbacks.

en.json adds English strings for basketball
(basketball_total_points, basketball_odd_even,
basketball_team_to_score_first) and tennis_set_handicap.

Polymarket formatMarketGroupItemTitle uses groupItemTitle ?? question ?? '' so spread markets without groupItemTitle no longer
throw during search/parse; spread formatting still strips the dash
before the line number.

Tests cover label fallbacks, deduped logging, UI titles for unknown
types/lines, and spread parsing without groupItemTitle.

Reviewed by Cursor Bugbot for commit
f242305. Bugbot is set up for automated
code reviews on this repo. Configure
here.


Co-authored-by: Luis Taniça matallui@gmail.com a6175b9

… labels cp-7.80.0 (#30946)

## **Description**

This PR fixes missing and unsafe sports market labels in Predict game
details.

It adds a runtime safeguard for sports market type translations so cards
no longer render i18n missing markers when Polymarket ships a new market
type before the locale file is updated. When a translation is missing,
the UI falls back to the outcome title; for line markets, it uses the
currently selected line outcome title. Missing sports market translation
keys are logged once per app session with the full i18n key so locale
gaps can be discovered without spamming repeated renders.

It also adds English labels for known basketball and tennis market
types:

- `basketball_total_points`: `Totals`
- `basketball_odd_even`: `Odd/Even Score`
- `basketball_team_to_score_first`: `Team to Score First`
- `tennis_set_handicap`: `Set Handicap`

Finally, it hardens the Polymarket parser for search/feed responses
where spread markets may omit `groupItemTitle`. In that case, parsing
now falls back to `market.question` before formatting the spread title,
preventing `replace` from being called on `undefined`.

Automated validation:

```bash
yarn jest app/components/UI/Predict/components/PredictGameDetailsContent/PredictGameOutcomesTab.test.tsx app/components/UI/Predict/providers/polymarket/utils.test.ts
```

Result: 2 test suites passed, 88 tests passed.

## **Changelog**

CHANGELOG entry: Fixed missing Predict sports market labels and
prevented a search result parsing error for some sports markets

## **Related issues**

Fixes: PRED-944

## **Manual testing steps**

```gherkin
Feature: Predict sports market labels

  Scenario: user views a known basketball sports market
    Given the user opens a Predict basketball game details screen
    When the game contains Total Points, Odd/Even Score, or Team to Score First markets
    Then the market card titles show the localized English labels

  Scenario: user views a sports market missing a translation
    Given the user opens a Predict game details screen with an untranslated sports market type
    When the card renders
    Then the card title falls back to the outcome title instead of showing an i18n missing marker
    And the missing translation key is logged only once per app session

  Scenario: user changes lines on an untranslated line market
    Given the user opens an untranslated line market in Predict game details
    When the user selects a different line
    Then the card title updates to the selected line outcome title

  Scenario: user searches Predict markets
    Given the user is searching Predict markets
    When a spread market response is missing groupItemTitle
    Then the market parses without a runtime error
    And the spread title falls back to the market question
```

## **Screenshots/Recordings**

### **Before**

Observed missing translation markers in Predict sports market cards and
a runtime parser error while searching sports markets.

### **After**

Sports market cards render translated labels or outcome-title fallbacks,
missing translation keys are logged once, and search parsing handles
missing spread group titles without throwing.

## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I've included tests if applicable
- [ ] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [ ] 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](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [ ] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> UI/i18n and defensive parsing in Predict sports flows; no auth,
payments, or trading logic changes.
> 
> **Overview**
> Improves **Predict** sports game details when Polymarket exposes
market types or API fields before locales and parsers are fully aligned.
> 
> **`PredictGameOutcomesTab`** now resolves sports market type labels
via translation, then an optional **outcome title** fallback, then
title-cased type keys. Missing i18n (raw key or `[missing` markers) is
**logged once per key** through `Logger.error` instead of showing broken
copy on cards. **Line** cards use the **selected line’s** formatted
outcome title when the market type has no translation; subgroup and flat
moneyline paths pass the same fallbacks.
> 
> **`en.json`** adds English strings for basketball
(`basketball_total_points`, `basketball_odd_even`,
`basketball_team_to_score_first`) and **`tennis_set_handicap`**.
> 
> **Polymarket `formatMarketGroupItemTitle`** uses `groupItemTitle ??
question ?? ''` so spread markets without `groupItemTitle` no longer
throw during search/parse; spread formatting still strips the dash
before the line number.
> 
> Tests cover label fallbacks, deduped logging, UI titles for unknown
types/lines, and spread parsing without `groupItemTitle`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f242305. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Luis Taniça <matallui@gmail.com>
@runway-github runway-github Bot requested a review from a team as a code owner June 2, 2026 19:08
@github-actions

github-actions Bot commented Jun 2, 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.

@mm-token-exchange-service mm-token-exchange-service Bot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Jun 2, 2026
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - PR targets a release or stable branch (release/* or stable)

All E2E tests pre-selected.

View GitHub Actions results

@github-actions github-actions Bot added the size-M label Jun 2, 2026
@tommasini tommasini merged commit bb5fc83 into release/7.80.0 Jun 2, 2026
204 of 210 checks passed
@tommasini tommasini deleted the runway-cherry-pick-7.80.0-1780427276 branch June 2, 2026 23:17
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-M team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants