Closed Bug 2039769 Opened 6 months ago Closed 6 months ago

[Homepage Sports Widget] - Enable pre-tournament sports widget pager with cached schedule fetch and Nimbus rollout

Categories

(Firefox for Android :: Homepage, task)

All
Android
task

Tracking

()

RESOLVED FIXED
152 Branch
Tracking Status
firefox151 --- fixed
firefox152 --- fixed

People

(Reporter: skhan, Assigned: skhan)

References

Details

(Whiteboard: [fxdroid][group3][world-cup-phase2])

Attachments

(8 external files)

When the user opens the homepage before World Cup kickoff (2026-06-11) and the
sports widget is showing the pre-tournament pager, we want to render a
"Follow your team" countdown card alongside a "view schedule" card backed by
real fixtures from the Merino WCS endpoint. The existing data flow had three
shortcomings:

  1. The repository fetched + shaped MatchCards per team selection, so toggling
    the followed team always triggered another network round-trip — including
    when the user just deselected a team or switched between two teams.
  2. The WCS endpoint only returns matches within +/-10 days of the requested
    date. With date defaulting to today and kickoff still ~30 days away,
    pre-tournament fetches returned no fixtures and the pager stayed empty.
  3. There was no way to enable the pre-tournament UI for a Nimbus experiment
    cohort independent of the device's calendar date, so QA and staggered
    rollouts had to wait until June 4, 2026 (one week to kickoff).

SportsRepository.fetchMatches no longer takes a countryCodes parameter or
shapes MatchCards; it now returns the bucketed TeamMatchesResult straight
from the mapper. SportsWidgetMiddleware caches the result in memory and
filters by team locally so toggling the followed team rebuilds the pager
without another network round-trip (with a fetch fallback on cold cache).
The middleware also reacts to the two debug-tool override actions so
flipping a switch in the SportsWidgetDebugTool triggers a fresh fetch
without requiring a HomeFragment.onResume.

Adds a force-one-week-to-world-cup Boolean to the homepage-sports-widget
Nimbus feature so the pre-tournament pager flow can be enabled for an
experiment cohort regardless of the device date. The flag is plumbed
through Settings into SportsWidgetState; the existing debug-tool override
still wins, and the natural date check still applies when neither is set.

Pins the WCS request date to the World Cup kickoff while the device date
is still before kickoff, since the endpoint only returns matches within
+/-10 days of the requested date. Otherwise sends today's date.

Extracts the kickoff date into shared constants in CountdownCalculator
(WORLD_CUP_KICKOFF: LocalDate for date math and the API request; and
WORLD_CUP_KICKOFF_UTC: String for the countdown widget's ISO instant)
so the kickoff is sourced from one place instead of being duplicated
inline across CountdownCalculator, SportsWidget, and the client.

Assignee: nobody → skhan
Status: NEW → ASSIGNED
Pushed by skhan@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/30094d9a2c56 https://hg.mozilla.org/integration/autoland/rev/8746be6f2f6e Refactor SportsRepository to cache raw match data and filter teams client-side r=android-reviewers,pollymce https://github.com/mozilla-firefox/firefox/commit/e78c0b7d98e4 https://hg.mozilla.org/integration/autoland/rev/4726e75a8e25 Add Nimbus override, WCS date pinning, and shared kickoff constant r=android-reviewers,pollymce
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 152 Branch
Depends on: 2040711

SportsRepository.fetchMatches no longer takes a countryCodes parameter or
shapes MatchCards; it now returns the bucketed TeamMatchesResult straight
from the mapper. SportsWidgetMiddleware caches the result in memory and
filters by team locally so toggling the followed team rebuilds the pager
without another network round-trip (with a fetch fallback on cold cache).
The middleware also reacts to the two debug-tool override actions so
flipping a switch in the SportsWidgetDebugTool triggers a fresh fetch
without requiring a HomeFragment.onResume.

Original Revision: https://phabricator.services.mozilla.com/D300687

Adds a force-one-week-to-world-cup Boolean to the homepage-sports-widget
Nimbus feature so the pre-tournament pager flow can be enabled for an
experiment cohort regardless of the device date. The flag is plumbed
through Settings into SportsWidgetState; the existing debug-tool override
still wins, and the natural date check still applies when neither is set.

Pins the WCS request date to the World Cup kickoff while the device date
is still before kickoff, since the endpoint only returns matches within
+/-10 days of the requested date. Otherwise sends today's date.

Extracts the kickoff date into shared constants in CountdownCalculator
(WORLD_CUP_KICKOFF: LocalDate for date math and the API request; and
WORLD_CUP_KICKOFF_UTC: String for the countdown widget's ISO instant)
so the kickoff is sourced from one place instead of being duplicated
inline across CountdownCalculator, SportsWidget, and the client.

Original Revision: https://phabricator.services.mozilla.com/D300688

SportsRepository.fetchMatches no longer takes a countryCodes parameter or
shapes MatchCards; it now returns the bucketed TeamMatchesResult straight
from the mapper. SportsWidgetMiddleware caches the result in memory and
filters by team locally so toggling the followed team rebuilds the pager
without another network round-trip (with a fetch fallback on cold cache).
The middleware also reacts to the two debug-tool override actions so
flipping a switch in the SportsWidgetDebugTool triggers a fresh fetch
without requiring a HomeFragment.onResume.

Original Revision: https://phabricator.services.mozilla.com/D300687

Adds a force-one-week-to-world-cup Boolean to the homepage-sports-widget
Nimbus feature so the pre-tournament pager flow can be enabled for an
experiment cohort regardless of the device date. The flag is plumbed
through Settings into SportsWidgetState; the existing debug-tool override
still wins, and the natural date check still applies when neither is set.

Pins the WCS request date to the World Cup kickoff while the device date
is still before kickoff, since the endpoint only returns matches within
+/-10 days of the requested date. Otherwise sends today's date.

Extracts the kickoff date into shared constants in CountdownCalculator
(WORLD_CUP_KICKOFF: LocalDate for date math and the API request; and
WORLD_CUP_KICKOFF_UTC: String for the countdown widget's ISO instant)
so the kickoff is sourced from one place instead of being duplicated
inline across CountdownCalculator, SportsWidget, and the client.

Original Revision: https://phabricator.services.mozilla.com/D300688

SportsRepository.fetchMatches no longer takes a countryCodes parameter or
shapes MatchCards; it now returns the bucketed TeamMatchesResult straight
from the mapper. SportsWidgetMiddleware caches the result in memory and
filters by team locally so toggling the followed team rebuilds the pager
without another network round-trip (with a fetch fallback on cold cache).
The middleware also reacts to the two debug-tool override actions so
flipping a switch in the SportsWidgetDebugTool triggers a fresh fetch
without requiring a HomeFragment.onResume.

Original Revision: https://phabricator.services.mozilla.com/D300687

Adds a force-one-week-to-world-cup Boolean to the homepage-sports-widget
Nimbus feature so the pre-tournament pager flow can be enabled for an
experiment cohort regardless of the device date. The flag is plumbed
through Settings into SportsWidgetState; the existing debug-tool override
still wins, and the natural date check still applies when neither is set.

Pins the WCS request date to the World Cup kickoff while the device date
is still before kickoff, since the endpoint only returns matches within
+/-10 days of the requested date. Otherwise sends today's date.

Extracts the kickoff date into shared constants in CountdownCalculator
(WORLD_CUP_KICKOFF: LocalDate for date math and the API request; and
WORLD_CUP_KICKOFF_UTC: String for the countdown widget's ISO instant)
so the kickoff is sourced from one place instead of being duplicated
inline across CountdownCalculator, SportsWidget, and the client.

Original Revision: https://phabricator.services.mozilla.com/D300688

Attachment #9591756 - Attachment description: WIP: Bug 2039769 - Add Nimbus override, WCS date pinning, and shared kickoff constant → Bug 2039769 - Add Nimbus override, WCS date pinning, and shared kickoff constant
Attachment #9591755 - Attachment description: WIP: Bug 2039769 - Refactor SportsRepository to cache raw match data and filter teams client-side → Bug 2039769 - Refactor SportsRepository to cache raw match data and filter teams client-side
Attachment #9591756 - Flags: approval-mozilla-release+
Attachment #9591755 - Flags: approval-mozilla-release+

A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)

QA Whiteboard: [qa-triage-done-c153/b152]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: