Skip to content

feat: Add numpad quick-action A/B test and analytics#26343

Merged
bfullam merged 15 commits into
mainfrom
codex/quick-actions-ab-test
Mar 2, 2026
Merged

feat: Add numpad quick-action A/B test and analytics#26343
bfullam merged 15 commits into
mainfrom
codex/quick-actions-ab-test

Conversation

@bfullam

@bfullam bfullam commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Description

Implements SWAPS4135 for SwapBridge numpad quick actions with LaunchDarkly A/B treatment and analytics instrumentation updates.

Changes included:

  • Added numpad quick-action A/B config keyed by swapsSWAPS4135AbtestNumpadQuickAmounts.
  • Updated quick-action behavior:
    • Max allowed + control: 25% / 50% / 75% / Max
    • Max allowed + treatment: 50% / 75% / 90% / Max
    • Max not allowed + control: 25% / 50% / 75% / 90%
    • Max not allowed + treatment: 50% / 75% / 85% / 95%
  • Enriched relevant SwapBridge events with active_ab_tests using { key, value } entries and stopped using the legacy explicit ab_tests key for this experiment.

Changelog

CHANGELOG entry: null

Related issues

Fixes: SWAPS4135

Manual testing steps

Feature: SwapBridge numpad quick-action AB test

  Scenario: user sees quick actions for control treatment with max available
    Given the user is assigned to control or treatment for swapsSWAPS4135AbtestNumpadQuickAmounts
    And max is available for the selected source token
    When user opens SwapBridge input keypad
    Then control shows 25% / 50% / 75% / Max
    And treatment shows 50% / 75% / 90% / Max

  Scenario: user sees quick actions for control treatment without max
    Given the user is assigned to control or treatment for swapsSWAPS4135AbtestNumpadQuickAmounts
    And max is not available for the selected source token
    When user opens SwapBridge input keypad
    Then control shows 25% / 50% / 75% / 90%
    And treatment shows 50% / 75% / 85% / 95%

  Scenario: quick action click analytics include active_ab_tests
    Given the user is assigned to a valid AB variant
    When user taps a quick-action button
    Then SWAP_INPUT_QUICK_AMOUNT_CLICKED is emitted
    And payload includes active_ab_tests with key swapsSWAPS4135AbtestNumpadQuickAmounts and value control or treatment

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

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

Medium Risk
Changes SwapBridge keypad quick-pick amounts via a remote A/B test and updates analytics payloads, which can affect user input behavior and metrics. Risk is limited to UI presets/event instrumentation and is gated by feature flags.

Overview
Adds an A/B test (swapsSWAPS4135AbtestNumpadQuickAmounts) that changes which percentage quick-actions appear in the SwapBridge numpad, with separate variant sets depending on whether Max is allowed.

Refactors analytics instrumentation: quick-action presses now track UnifiedSwapBridgeEventName.InputChanged with string presets (e.g., "25%", "MAX") and include active_ab_tests when the experiment is active, and SWAP_PAGE_VIEWED tracking is moved out of BridgeView into a new useTrackSwapPageViewed hook (also emitting active_ab_tests). Tests for GaslessQuickPickOptions are updated to render with Redux context and to mock analytics.

Written by Cursor Bugbot for commit 09b9ce9. This will update automatically on new commits. Configure here.

@bfullam bfullam requested a review from a team as a code owner February 20, 2026 13:19
@github-actions

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.

@bfullam bfullam changed the title Track numpad quick-action AB test and analytics event SWAPS4135: Add numpad quick-action A/B test and analytics Feb 20, 2026
@bfullam bfullam changed the title SWAPS4135: Add numpad quick-action A/B test and analytics feat: Add numpad quick-action A/B test and analytics Feb 20, 2026
# Conflicts:
#	app/components/UI/Bridge/Views/BridgeView/index.tsx
#	app/components/UI/Bridge/components/GaslessQuickPickOptions/index.tsx

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread app/components/UI/Bridge/components/GaslessQuickPickOptions/index.tsx Outdated
@bfullam bfullam added the team-swaps-and-bridge Swaps and Bridge team label Mar 2, 2026
@bfullam bfullam enabled auto-merge March 2, 2026 16:00
Comment thread app/components/UI/Bridge/components/GaslessQuickPickOptions/index.tsx Outdated
Comment thread app/components/UI/Bridge/components/GaslessQuickPickOptions/abTestConfig.ts Outdated
Comment thread app/components/UI/Bridge/Views/BridgeView/index.tsx Outdated
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeTrade, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the Bridge/Swap functionality with the following modifications:

  1. A/B Testing for Quick Pick Options: New A/B test configuration (abTestConfig.ts) introduces control and treatment variants for numpad quick pick percentages (25/50/75/MAX vs 50/75/90/MAX for gasless, and 25/50/75/90 vs 50/75/85/95 for non-gasless).

  2. Analytics Tracking Refactoring:

    • Extracted useTrackSwapPageViewed hook from BridgeView to track swap page views with A/B test context
    • New useTrackInputAmountChange hook for tracking input amount changes with A/B test context
  3. GaslessQuickPickOptions Component Update: Refactored to use the new A/B test variants via useABTest hook instead of hardcoded percentage presets.

  4. Test Updates: Unit tests updated to use renderWithProvider and mock useAnalytics.

Why SmokeTrade: This tag covers token swaps and cross-chain bridging, which is exactly what these changes affect. The BridgeView component and GaslessQuickPickOptions are core parts of the swap/bridge flow.

Why SmokeConfirmations: Per the tag description, "When selecting SmokeTrade for swap or bridge flows, also select SmokeConfirmations" since transaction confirmations are part of the swap/bridge flow.

The changes are primarily refactoring and adding A/B testing capabilities without modifying core business logic, making this a medium risk change.

Performance Test Selection:
The changes are focused on A/B testing configuration and analytics tracking for the Bridge/Swap flow. They don't affect UI rendering performance, data loading, or critical user flow performance. The modifications are primarily: (1) adding A/B test variant selection logic, (2) refactoring analytics tracking into hooks, and (3) updating quick pick button labels based on A/B test variants. These are lightweight changes that don't impact render times, list performance, or app startup. No performance tests are needed.

View GitHub Actions results

@GeorgeGkas GeorgeGkas self-requested a review March 2, 2026 17:49
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 60
Missing keys 0
Type mismatches 0
Value mismatches 6 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@bfullam bfullam added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit 7d709ac Mar 2, 2026
170 of 172 checks passed
@bfullam bfullam deleted the codex/quick-actions-ab-test branch March 2, 2026 19:33
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-M team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants