Skip to content

feat: MUSD-1278 Wire up A/B Test for Money Token Details Footer CTA - #34501

Open
Matt561 wants to merge 7 commits into
mainfrom
feat/musd-1278-wire-up-ab-test-for-money-token-details-footer-cta
Open

feat: MUSD-1278 Wire up A/B Test for Money Token Details Footer CTA#34501
Matt561 wants to merge 7 commits into
mainfrom
feat/musd-1278-wire-up-ab-test-for-money-token-details-footer-cta

Conversation

@Matt561

@Matt561 Matt561 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Description

Adds the MUSD-1278 control/treatment experiment for the Money deposit CTA in the Token Details footer. The existing Money eligibility flag remains the prerequisite, while analytics attribution for Money Button Clicked is limited to this footer CTA.

Changelog

CHANGELOG entry: Added an A/B test for the Money deposit CTA on token details.

Related issues

Fixes: MUSD-1278: Wire up A/B Test for Money Token Details Footer CTA

Manual testing steps

Feature: Money deposit CTA experiment on token details

  Scenario: user sees the Money deposit CTA in the treatment group
    Given the Money footer CTA feature flag is enabled
    And the user is assigned to the treatment variant
    When the user opens an eligible token details screen
    Then the Money deposit CTA is visible in the footer
    And the Money Button Clicked event attributes the active experiment

Screenshots/Recordings

Before

N/A

After

N/A

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

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
Experiment gating and analytics scoping on Token Details footer; no auth or payment flow changes. Splitting Money event constants is a structural refactor with preserved barrel exports.

Overview
Adds the MUSD-1278 control/treatment experiment so the Token Details sticky footer only shows the Money deposit/earn CTA when the user is in treatment (showMoneyDepositFooterCta: true). Eligibility from useMoneyAssetOverviewCtas is unchanged; the footer now also requires the experiment variant before switching to the earn-focused swap/buy layout and hiding quick buy.

Registers EARN_MONEY_DEPOSIT_FOOTER_CTA_VISIBILITY_AB_TEST_ANALYTICS_MAPPING so TOKEN_DETAILS_OPENED, TOKEN_DETAILS_CTA_CLICKED, and MONEY_BUTTON_CLICKED (scoped to MONEY_ASSET_OVERVIEW_FOOTER_CTA) carry experiment attribution.

moneyEvents.ts is split into dependency-light modules (moneyButtonEvents, moneyEventLocations, moneyUrls, etc.) re-exported from the barrel so enum-only consumers avoid pulling AppConstants/URL config.

TokenDetails always mounts quickBuySheet (no longer suppressed when the Money footer path is active at the parent), aligning quick buy with control users who fall back to the standard footer.

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

@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.

@github-actions github-actions Bot added the size-M label Aug 7, 2026
@Matt561
Matt561 marked this pull request as ready for review August 7, 2026 17:22
@Matt561
Matt561 requested review from a team as code owners August 7, 2026 17:22
@github-actions github-actions Bot added the risk:low AI analysis: low risk label Aug 7, 2026
@Matt561
Matt561 force-pushed the feat/musd-1278-wire-up-ab-test-for-money-token-details-footer-cta branch from bfa8f58 to 01593b4 Compare August 7, 2026 17:49
@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:low AI analysis: low risk labels Aug 7, 2026

@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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3de096b. Configure here.

@github-actions github-actions Bot added risk:high AI analysis: high risk and removed risk:medium AI analysis: medium risk labels Aug 7, 2026
@Matt561
Matt561 requested a review from a team as a code owner August 7, 2026 21:34
@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:high AI analysis: high risk labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🧪 Flaky unit test detection

Run history flaky detection

View recent run history

Historical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow.

Failures / runs sampled per window:

File 7d 15d 30d
app/components/UI/TokenDetails/components/TokenDetailsStickyFooter.test.tsx 0/86 0/218 0/359

AI-detected flaky patterns

app/components/UI/TokenDetails/components/TokenDetailsStickyFooter.test.tsx

  • J3 — Missing jest.clearAllMocks()/resetAllMocks() between tests (high)
    • beforeEach uses jest.clearAllMocks() but does not reset mock implementations (e.g. mockIsStockToken.mockReturnValue(true) in later RWA tests, mockUseABTest.mockReturnValue in AB tests). clearAllMocks only clears call history; without resetAllMocks the changed return values persist across tests, making results order-dependent and flaky under --randomize or CI variance. Matches J3 exactly (see skill for 124 similar files). Historical signal was false but pattern is present independently.
    • Suggested fix in app/components/UI/TokenDetails/components/TokenDetailsStickyFooter.test.tsx:
      -  beforeEach(() => {
      -    jest.clearAllMocks();
      -    mockIsBuyable.mockReturnValue(true);
      -    mockIsTokenTradingOpen.mockReturnValue(true);
      -    mockHasEligibleSwapTokens = true;
      -    setupSelectorMock();
      -    mockUseABTest.mockReturnValue({
      -      variant: { showMoneyDepositFooterCta: true },
      -      variantName: 'treatment',
      -      isActive: true,
      -    });
      -  });
      +  beforeEach(() => {
      +    jest.clearAllMocks();
      +    mockIsBuyable.mockReturnValue(true);
      +    mockIsTokenTradingOpen.mockReturnValue(true);
      +    mockHasEligibleSwapTokens = true;
      +    setupSelectorMock();
      +    mockUseABTest.mockReturnValue({
      +      variant: { showMoneyDepositFooterCta: true },
      +      variantName: 'treatment',
      +      isActive: true,
      +    });
      +  });
      +
      +  afterEach(() => {
      +    jest.resetAllMocks();
      +  });

This check is informational only and does not block merging.

@github-actions github-actions Bot added risk:low AI analysis: low risk and removed risk:medium AI analysis: medium risk labels Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

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

E2E Test Selection:

Changes analyzed:

  1. Money constants refactoring (moneyEvents.ts → 5 leaf modules + barrel re-export): Pure structural refactor. All enum values are identical, just split into dependency-light leaf modules. No functional change. Does not independently trigger test selection.

  2. TokenDetails.tsx (functional change): Removes the !isMoneyFooterCtaActive condition gating quickBuySheet. Previously, the quick buy sheet was hidden when the Money footer CTA was active. Now it's always rendered. This affects the token detail/asset overview screen's quick buy entry point — relevant to SmokeMoney (Add Funds/Deposit paths from token details) and SmokeSwap (quick buy/swap flows).

  3. TokenDetailsStickyFooter.tsx (functional change): Adds A/B test (useABTest) to gate the Money Earn CTA visibility. isMoneyEarnCtaActive now also requires moneyEarnCtaVisibilityVariant.showMoneyDepositFooterCta to be true. This directly affects the Money Earn CTA in the sticky footer — core SmokeMoney territory.

  4. abTestConfig.ts: New A/B test config EARN_MONEY_DEPOSIT_FOOTER_CTA_VISIBILITY with control/treatment variants. Analytics mapping for TOKEN_DETAILS_OPENED, TOKEN_DETAILS_CTA_CLICKED, MONEY_BUTTON_CLICKED events.

  5. abTestAnalyticsRegistry.ts: Registers the new A/B test mapping.

  6. TokenDetailsStickyFooter.test.tsx: Unit test updates (no E2E impact).

Tag selection rationale:

  • SmokeMoney: Primary tag — the Money Earn CTA A/B test directly affects Money deposit/earn flows from token details. The quickBuySheet ungating also affects Add Funds paths.
  • SmokeWalletPlatform: Token details is a core wallet platform screen. The quickBuySheet always being shown changes behavior in the asset overview/token detail view.
  • SmokeSwap: The quickBuySheet in token details is a swap/buy entry point. Removing the conditional gate means it's always rendered, potentially affecting swap flows initiated from token details.
  • SmokeConfirmations: Per tag descriptions, when selecting SmokeMoney for flows that execute swaps/deposits, also select SmokeConfirmations.

Performance Test Selection:
The changes are focused on: (1) a structural refactor of Money constants (no functional change), (2) an A/B test gate on the Money Earn CTA in the sticky footer, and (3) always rendering the quickBuySheet in TokenDetails. None of these changes affect app launch, login, onboarding, account list rendering, or asset loading performance in a measurable way. The A/B test hook adds negligible overhead. No performance test tags are warranted.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

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

Labels

risk:low AI analysis: low risk size-M team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant