Commit 60a0da0
authored
chore(homepage): scaffold Hub Page Discovery Tabs A/B test (#29069)
## **Description**
Scaffolds the LaunchDarkly A/B test for the Hub Page Navigational
Discovery
Tabs experiment
([MCU-589](https://consensyssoftware.atlassian.net/browse/TMCU-590)).
This PR wires up the flag config, Redux selector,
and analytics enrichment; **no UI behaviour is changed yet**
Changes:
- Added `HUB_PAGE_DISCOVERY_TABS_AB_KEY`, `HubPageDiscoveryTabsVariant`
enum,
`HUB_PAGE_DISCOVERY_TABS_VARIANTS`, and analytics mapping to
`app/components/Views/Homepage/abTestConfig.ts`
- Added `selectHubPageDiscoveryTabsABTest` selector to
`app/selectors/featureFlagController/homepage/index.ts` — resolves
`{ variantName, isActive }` from remote feature flags via
`resolveABTestAssignment`
- Registered `HUB_PAGE_DISCOVERY_TABS_AB_TEST_ANALYTICS_MAPPING` in
`app/util/analytics/abTestAnalyticsRegistry.ts` so `Home Viewed` events
are auto-enriched with `active_ab_tests` when the flag is active
## **Changelog**
CHANGELOG entry:null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-590
## **Manual testing steps**
```gherkin
Feature: Hub Page Discovery Tabs A/B test flag
Scenario: user opens the homepage with the flag active
Given the LaunchDarkly flag coreMCU589AbtestHubPageDiscoveryTabs is enabled
And the user is assigned to the treatment variant
When user navigates to the Homepage
Then the Home Viewed analytics event includes
active_ab_tests: [{ key: 'coreMCU589AbtestHubPageDiscoveryTabs', value: 'treatment' }]
Scenario: user opens the homepage with the flag inactive
Given the LaunchDarkly flag coreMCU589AbtestHubPageDiscoveryTabs is off
When user navigates to the Homepage
Then the Home Viewed analytics event has no active_ab_tests entry
for coreMCU589AbtestHubPageDiscoveryTabs
```
## **Screenshots/Recordings**
Feature flag logging correctly based on Launch Darkly configurations
<img width="750" alt="Screenshot 2026-04-20 at 1 31 57 PM"
src="https://github.com/user-attachments/assets/9755d531-a74f-412e-827f-3fc5572b73c9"
/>
### **Before**
`~`
### **After**
`~`
## **Pre-merge author checklist**
- [x] 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).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] 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**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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**
> Low risk: adds new A/B test constants/selector/analytics registration
without changing UI behavior or core data flows; main risk is
misconfigured flag/variant names affecting analytics enrichment.
>
> **Overview**
> Adds scaffolding for the `coreMCU589AbtestHubPageDiscoveryTabs`
LaunchDarkly A/B test, including variant definitions
(`control`/`treatment`) and a config mapping indicating whether
discovery tabs are enabled.
>
> Wires the experiment into state and analytics: introduces
`selectHubPageDiscoveryTabsABTest` (via `resolveABTestAssignment`) and
registers the test in `AB_TEST_ANALYTICS_MAPPINGS` so `Home Viewed`
events are enriched with the experiment’s `active_ab_tests` entry when
the assignment is active, with new unit tests covering selector
resolution and analytics enrichment.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0d37144. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent c47ffad commit 60a0da0
5 files changed
Lines changed: 108 additions & 2 deletions
File tree
- app
- components/Views/Homepage
- selectors/featureFlagController/homepage
- util/analytics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
5 | 40 | | |
6 | 41 | | |
7 | 42 | | |
| |||
Lines changed: 39 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
3 | 6 | | |
4 | 7 | | |
| |||
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
72 | 110 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
| 21 | + | |
| 22 | + | |
18 | 23 | | |
19 | 24 | | |
20 | 25 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
123 | 136 | | |
124 | 137 | | |
125 | 138 | | |
| |||
0 commit comments