Skip to content

refactor(ramps/vba): adds onboarding route coordinator - #36764

Merged
georgeweiler merged 1 commit into
mainfrom
refactor/vba-onboarding-coordinator
Sep 24, 2026
Merged

georgeweiler merged 1 commit into
mainfrom
refactor/vba-onboarding-coordinator

Conversation

@georgeweiler

@georgeweiler georgeweiler commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Description

Stack position: 1 of 4 remaining VBA onboarding PRs.

This PR has no UI. It is the coordinator that decides where a Virtual Bank Account user should be in onboarding.

Previously, each screen knew what came next. Resume was guesswork, and inserting or reordering steps required changing every screen.

Now one snapshot from hydrateVbaOnboarding is the source of truth. getVbaDestinationForSnapshot walks three client-owned modules — vendor terms, email, identity verification — and returns the first incomplete one. If all are complete, it maps controller status to pending, rejected, complete, or a provisioning error.

Everything goes through useOpenVbaOnboarding: entry, retry, and module completion all re-read facts and open the first incomplete destination. VBA screens live behind one feature-local navigator.

Changelog

CHANGELOG entry: null

Related issues

Refs: MetaMask/core#10354

Manual testing steps

Feature: Modular VBA onboarding coordination

  Scenario: onboarding resumes from persisted facts
    Given a hydrated VBA onboarding snapshot
    When the coordinator resolves the first incomplete module
    Then it selects the corresponding feature-local route

Screenshots/Recordings

N/A — architecture-only stack layer covered by unit tests.

Before

N/A

After

N/A

Pre-merge author checklist

  • I've followed MetaMask contributor and mobile coding standards.
  • I've completed the PR template to the best of my ability.
  • I've included tests if applicable.
  • I've documented the code where applicable.
  • I've applied the appropriate labels.

Performance checks (if applicable)

  • Android testing assessed — N/A for this architecture-only stack layer.
  • Power-user testing assessed — N/A for this architecture-only stack layer.
  • Performance tracing assessed — N/A; no performance-sensitive operation was added.

Pre-merge reviewer checklist

  • I've manually tested the PR.
  • I confirm that this PR addresses its stated scope and includes appropriate testing evidence.

Made with Cursor

@georgeweiler georgeweiler self-assigned this Sep 24, 2026
@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.

@metamask-ci metamask-ci Bot added the team-money-movement issues related to Money Movement features label Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Smart E2E Test Selection

Selected E2E tags: SmokeMoney

AI Confidence: 85

E2E reasoning

Expand to read

The PR modifies the Virtual Bank Account (VBA) onboarding flow within the Ramp/Card feature area:

  1. New route file (routes.ts): Defines VbaOnboardingParamList and VbaOnboardingRoutes constants for the VBA onboarding navigator stack.
  2. New types file (modules/types.ts): Adds completion interfaces for VBA email and identity verification modules.
  3. Funnel refactor (vbaOnboardingFunnel.ts): Renames VbaOnboardingRoute → VbaOnboardingDestinationId, VBA_FUNNEL → VBA_ONBOARDING_MODULES, and getVbaRouteForSnapshot → getVbaDestinationForSnapshot. Changes return values from direct route strings to abstract destination IDs. This is a behavioral refactor of VBA onboarding routing logic.
  4. Hook update (useVbaOnboardingRouting.ts): Adapts to use new destination IDs and VbaOnboardingRoutes.
  5. NavigationService/types.ts (CRITICAL): Adds RampVbaOnboarding: NavigatorScreenParams<VbaOnboardingParamList> to RootStackParamList — a new nested navigator entry.
  6. Routes.ts: Adds VBA_ONBOARDING: 'RampVbaOnboarding' route constant.
  7. Test files: Updated unit tests reflecting the refactored API.
  8. vbaOnboardingSnapshot.ts: Cosmetic comment change only.

All changes are scoped to the Ramp/VBA/Card onboarding flow, which maps directly to SmokeMoney. The open PR review comment flags a potential bug where approved KYC with in-progress account provisioning could incorrectly route to the error screen — this makes running SmokeMoney smoke tests important to validate the routing behavior.

No changes affect swap execution, transaction confirmations, accounts, networks, or other flows, so no other tags are warranted. The SmokeMoney description covers Card and Ramps flows including onboarding paths.

Performance reasoning

Expand to read

No performance-sensitive code paths are modified. The changes are purely routing/navigation type definitions and a refactor of the VBA onboarding funnel logic (renaming types and abstracting destination IDs). No rendering, state management, asset loading, or app launch paths are affected.

View run

@georgeweiler
georgeweiler force-pushed the feat/vba-terms-one-email-handoff branch from 7520038 to a4e5741 Compare September 24, 2026 10:03
@georgeweiler
georgeweiler force-pushed the refactor/vba-onboarding-coordinator branch from 35c95df to e064d12 Compare September 24, 2026 10:03
Base automatically changed from feat/vba-terms-one-email-handoff to main September 24, 2026 10:48
@georgeweiler
georgeweiler force-pushed the refactor/vba-onboarding-coordinator branch from e064d12 to 5c975ba Compare September 24, 2026 10:57
@github-actions github-actions Bot added size-L and removed size-M labels Sep 24, 2026
@georgeweiler
georgeweiler force-pushed the refactor/vba-onboarding-coordinator branch from 5c975ba to 25e4cfe Compare September 24, 2026 11:07
@georgeweiler
georgeweiler changed the base branch from main to refactor/vba-vendor-terms-naming September 24, 2026 11:07
@github-actions github-actions Bot added size-M and removed size-L labels Sep 24, 2026
Base automatically changed from refactor/vba-vendor-terms-naming to main September 24, 2026 11:40
@github-actions github-actions Bot added size-L and removed size-M labels Sep 24, 2026
@georgeweiler
georgeweiler force-pushed the refactor/vba-onboarding-coordinator branch from 25e4cfe to b617f00 Compare September 24, 2026 11:41
@github-actions github-actions Bot added size-M and removed size-L labels Sep 24, 2026
@georgeweiler
georgeweiler marked this pull request as ready for review September 24, 2026 11:43
@georgeweiler
georgeweiler requested review from a team as code owners September 24, 2026 11:43
@github-actions github-actions Bot added the risk:high AI analysis: high risk label Sep 24, 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 b617f00. Configure here.

if (snapshot.kycStatus === 'approved') {
return snapshot.autorampStatus === 'ready'
? 'complete'
: 'accountProvisioningError';

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.

Approved KYC treats in-progress as error

Medium Severity

When kycStatus is approved, any autorampStatus other than ready maps to accountProvisioningError. That includes the default not_ready in-progress value, not just retryable_failure. Users whose KYC just cleared while account provisioning is still running can land on the error screen instead of a waiting state.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b617f00. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed. Approved KYC now maps ready to complete, retryable_failure to the provisioning error, and both not_ready and in_progress to the pending destination. Added coverage for both non-terminal statuses.

@georgeweiler
georgeweiler force-pushed the refactor/vba-onboarding-coordinator branch from b617f00 to faa82ea Compare September 24, 2026 11:49
Co-authored-by: Cursor <cursoragent@cursor.com>
@georgeweiler
georgeweiler force-pushed the refactor/vba-onboarding-coordinator branch from faa82ea to 06b732e Compare September 24, 2026 12:03
@georgeweiler georgeweiler changed the title refactor(ramps/vba): add onboarding coordinator refactor(ramps/vba): adds onboarding route coordinator Sep 24, 2026

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

navigation files LGTM

@sonarqubecloud

Copy link
Copy Markdown

@georgeweiler
georgeweiler added this pull request to the merge queue Sep 24, 2026
Merged via the queue into main with commit eae9ef8 Sep 24, 2026
80 checks passed
@georgeweiler
georgeweiler deleted the refactor/vba-onboarding-coordinator branch September 24, 2026 12:41
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 24, 2026
@metamask-ci metamask-ci Bot added the release-8.14.0 Issue or pull request that will be included in release 8.14.0 label Sep 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-8.14.0 Issue or pull request that will be included in release 8.14.0 risk:high AI analysis: high risk size-M team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants