Skip to content

Open restricted payment card flow over Subscription - #107023

Merged
inimaga merged 4 commits into
mainfrom
claude-restrictedSubscription
Nov 20, 2026
Merged

inimaga merged 4 commits into
mainfrom
claude-restrictedSubscription

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Pass Subscription as the explicit base route when opening Add payment card from the web Restricted screen. This prevents modal dismissal from making the underlying chat or Search page the card form's background. Keep the existing transition ordering and leave native navigation and other payment-card entry points unchanged.

Add regression coverage for report and Search backgrounds, including waiting for modal dismissal before navigating.

Open Subscription explicitly before the card form only when another Settings page is active, including Profile and the narrow Account list. From other tabs, open the form directly so navigation switches its background without pushing an extra tab navigator. If Subscription is already active, also open the form directly to avoid waiting for a transition that never starts. Keep the existing closing-screen deferral and native behavior unchanged.

Branch ownership

This draft uses an upstream branch because MelvinBot does not have push access to the requester's fork. To copy the branch into that fork:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-restrictedSubscription
git checkout -b claude-restrictedSubscription upstream/claude-restrictedSubscription
git push -u origin claude-restrictedSubscription

You can then close this draft and open a replacement from your fork if needed.

AI Tests

Follow-up: Settings-only Subscription navigation (2026-11-20)

  • Passed: 13 focused tests across the restricted-action component and closing-screen helper. Direct card navigation is covered from report routes with and without a leading slash, Search, Home, and Subscription. Subscription-first navigation is covered from Profile with and without a leading slash, Wallet with a query, and the bare Settings list. Native tests remain passing.
  • Regression check: the four non-Settings direct-opening cases failed against the previous implementation and passed with this change.
  • Passed: full lint, typecheck, targeted spelling, direct React Compiler check, Storybook smoke tests, Oxfmt commit hook, and code standards review with no violations.
  • Incomplete: full Jest run exceeded 180 seconds with passing suites reported; no full-suite pass is claimed. Changed-files lint could not resolve the shallow merge base, and the changed-files React Compiler wrapper timed out after 120 seconds. Full lint and the direct compiler check passed.
  • Unavailable: the matrix's prettier script does not exist; Oxfmt passed on both changed files.
  • Browser verification blocked: the web session was suspended and rendered a blank page. Chat, Profile, narrow Account, and closing the form remain unverified in-browser; no payment card details were entered or submitted.

Follow-up: Subscription-first navigation (2026-11-19)

  • Passed: eight focused tests across the restricted-action component and closing-screen helper. Report, Search, and Profile cases verify Subscription opens first and the form waits for its transition; already-active Subscription opens the form directly. The three non-Subscription cases failed before this fix and passed afterward. Existing native tests remain passing.
  • Passed: targeted lint, typecheck, targeted spelling, direct component React Compiler check, Storybook smoke test, and the Oxfmt commit hook on both changed files. Code standards review returned no violations.
  • Incomplete: full lint timed out after 300 seconds; changed-files lint and React Compiler checks timed out after 120 seconds. Targeted equivalents passed.
  • Incomplete: full Jest run reached 16 passing suites before the 180-second limit; no full-suite pass is claimed.
  • Unavailable: the matrix's prettier script does not exist; the repository's Oxfmt commit hook passed.
  • Browser verification blocked: the pinned web session rendered no UI and remained suspended after retry. Profile, report, Search, and already-active Subscription flows remain unverified in-browser. No payment card was entered or submitted.

Follow-up: closing-screen deferral (2026-11-18)

  • Passed: six focused tests across the restricted-action component and the existing closing-screen helper, including deferred navigation from report and Search backgrounds and unchanged native navigation.
  • Passed: full lint (on retry), targeted lint, typecheck, targeted spelling, direct component React Compiler check, Storybook smoke test, and the commit hook's Oxfmt check.
  • Code standards review returned no violations.
  • Incomplete: full Jest run reached 16 passing suites before the 180-second execution limit; no full-suite pass is claimed.
  • Blocked: changed-files lint/spelling wrappers could not resolve the shallow checkout's merge base; targeted checks passed. History-deepening attempts timed out. The changed-files React Compiler wrapper also timed out; the direct check passed.
  • Unavailable: the matrix's prettier script does not exist in this checkout; the repository's Oxfmt commit hook passed on both changed files.
  • Browser verification blocked: the web session was suspended with no accessible UI. The transition and return navigation remain unverified in-browser; no payment card was entered or submitted.

Original implementation

  • Passed: all four focused component tests (two web cases and two existing native-navigation unit tests). Both web cases fail without the production fix and pass with it.
  • Passed: npm run lint, npm run lint-changed, npm run typecheck, npm run spell-changed, Storybook smoke tests, and the focused React Compiler check.
  • Passed: the commit hook's Oxfmt check on both changed files, with no additional diff. The matrix's prettier script no longer exists in this checkout.
  • Incomplete: the full Jest suite exceeded the 180-second execution limit after 16 passing suites; no full-suite pass is claimed.
  • Incomplete: the changed-files React Compiler wrapper timed out and also encountered an empty base-ref error (origin/). The direct component compiler check passed.
  • Code standards review returned no violations.
  • Browser verification blocked: the supplied web session was suspended and exposed no UI. The offline billing fixture and end-to-end flow could not be verified; no payment card was submitted.

Fixed Issues

$ #105225
PROPOSAL: #105225 (comment)

Tests

Precondition: Account has free trial

  • If you account has free trial expired
  1. Log in to ND
  2. Disable the internet connection
  3. Go to the Workspace chat, click "+" - Create expense
  4. On the “Restricted” screen click “Add payment card”
  • If you account has free trial but not expired yet
  1. Log in to ND with the account that has a free trial
  2. Disable the internet connection
  3. Open console and enter the snippet: Onyx.merge('nvp_private_lastDayFreeTrial', '<today's date time>');
    E.g: if today's date is 8/26/2024 it would look like: Onyx.merge('nvp_private_lastDayFreeTrial', '2024-08-26 01:01:00');
  4. Then run the following snippet: "Onyx.merge('nvp_private_amountOwed', 1000);"
  5. Then run the following snippet: "Onyx.merge('nvp_private_billingGracePeriodEnd', 1719792000);"
  6. Go to the Workspace chat, click "+" - Create expense
  7. On the “Restricted” screen click “Add payment card”
  • Verify that no errors appear in the JS console

Offline tests

Same as Test

QA Steps

Web: Profile background regression

  1. Sign in as an owner whose only eligible workspace is billing-restricted.
  2. Open Account → Profile.
  3. Select + → Create report and verify the Restricted panel appears.
  4. Select Add payment card. Verify Restricted closes without flashing, Subscription becomes the underlying page, and the card form opens after the Subscription transition.
  5. Close the card form and verify Subscription remains visible, not Profile. Do not submit a payment card.
  6. Repeat from a report and Search, verifying the same Subscription background.
  7. Repeat with Subscription already active. Verify the form opens directly after dismissal without an extra delay for a redundant Subscription transition.
  8. In a narrow web layout, open the Account tab so the Settings list is visible, then select + → Create report → Add payment card. Verify Subscription is underneath the form and remains visible when the form is closed.
  9. From a workspace chat, select composer + → Create expense → Add payment card. Verify the form opens smoothly over Subscription without an extra tab navigator transition or stutter.

Same as Test

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Settings-only navigation verification blocker (not evidence of the corrected flow):

Blank app page blocking all requested verification

Subscription-first verification blocker (not evidence of the corrected flow):

Blocked web session with no rendered application UI

Follow-up browser verification blocker (not evidence of the corrected flow):

Blocked web app state

Web verification blocker (not evidence of the corrected flow):

Blocked browser state

Android: Native
Android: mWeb Chrome
Screen.Recording.2026-11-19.at.01.02.20.mov
iOS: Native
iOS: mWeb Safari
Screen.Recording.2026-11-19.at.00.58.14.mov
MacOS: Chrome / Safari
Screen.Recording.2026-11-19.at.00.56.42.mov

Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team November 16, 2026 17:39
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Nov 16, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

Run details

@MelvinBot

MelvinBot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ⚠️ partial

Verified workspace ownership and an active free trial on standalone Android NewDot. Tester permissions blocked offline/Onyx fixture setup, leaving restricted-subscription navigation unverified; no payment card was submitted.

Android account screen showing the active free trial

Step Status
1. Log in as a workspace owner with a free trialMembers showed Owner and Workspace admin; Account displayed 30 days left.
Android account screen showing the active free trial
✅
2. Disable internetBlocked: airplane-mode command was denied by tester permissions. Offline state was not established.
❌
3. Set lastDayFreeTrial to today's date/timeBlocked: no supported Onyx setter was available, and runtime evaluation was denied.
❌
4. Set amountOwed to 1000Blocked: required Onyx access was unavailable.
❌
5. Set billingGracePeriodEnd to 1719792000Blocked: required Onyx access was unavailable.
❌
6. Workspace chat → + → Create expense → RestrictedNot attempted because the required offline billing fixture could not be established.
❌
7. Restricted → Add payment card opens over SubscriptionBlocked by the unavailable Restricted-screen fixture; navigation was not verified.
❌
8. Close/back returns to SubscriptionNot reached because the prescribed card-form flow was blocked.
❌
9. Verify no JS errorsNo error overlay appeared during setup, but log inspection was denied and the requested flow was not exercised. Absence of JS errors remains unverified.
❌

view run · view recording

@MelvinBot

MelvinBot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

Testing on dev NewDot web was blocked by missing fixture and unsupported offline/Onyx controls. No payment card was submitted.

Workspaces page showing no workspaces

Step Status
1. Log in with a workspace-owner account having a free trialSession was signed in with onboarding complete, but Workspaces showed “No workspaces yet”; ownership and free trial were not established.
Workspaces page showing no workspaces
⚠️
2. Disable internet connectionNetwork disabling was unavailable through the supported testing tools.
⚠️
3. Set lastDayFreeTrial to today's date/timeNo supported Onyx read/write tool was available.
⚠️
4. Set amountOwed to 1000No supported Onyx read/write tool was available.
⚠️
5. Set billingGracePeriodEnd to 1719792000No supported Onyx read/write tool was available.
⚠️
6. Workspace chat → + → Create expense shows RestrictedBlocked by the missing workspace and required billing fixture.
⚠️
7. Add payment card opens the RHP over SubscriptionRestricted screen could not be reached; background navigation remains unverified.
⚠️
8. Closing the card RHP returns to SubscriptionNot reached because the card-form flow was blocked.
⚠️
9. Verify no JS console errorsConsole access was unavailable through the supported testing interface; absence of errors remains unverified.
⚠️

view run · view recording

@gijoe0295

Copy link
Copy Markdown
Contributor

@MelvinBot please set the PR body to the content in the details section above

Details

Explanation of Change

Pass Subscription as the explicit base route when opening Add payment card from the web Restricted screen. This prevents modal dismissal from making the underlying chat or Search page the card form's background. Keep the existing transition ordering and leave native navigation and other payment-card entry points unchanged.

Add regression coverage for report and Search backgrounds, including waiting for modal dismissal before navigating.

Branch ownership

This draft uses an upstream branch because MelvinBot does not have push access to the requester's fork. To copy the branch into that fork:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-restrictedSubscription
git checkout -b claude-restrictedSubscription upstream/claude-restrictedSubscription
git push -u origin claude-restrictedSubscription

You can then close this draft and open a replacement from your fork if needed.

AI Tests

  • Passed: all four focused component tests (two web cases and two existing native-navigation unit tests). Both web cases fail without the production fix and pass with it.
  • Passed: npm run lint, npm run lint-changed, npm run typecheck, npm run spell-changed, Storybook smoke tests, and the focused React Compiler check.
  • Passed: the commit hook's Oxfmt check on both changed files, with no additional diff. The matrix's prettier script no longer exists in this checkout.
  • Incomplete: the full Jest suite exceeded the 180-second execution limit after 16 passing suites; no full-suite pass is claimed.
  • Incomplete: the changed-files React Compiler wrapper timed out and also encountered an empty base-ref error (origin/). The direct component compiler check passed.
  • Code standards review returned no violations.
  • Browser verification blocked: the supplied web session was suspended and exposed no UI. The offline billing fixture and end-to-end flow could not be verified; no payment card was submitted.

Fixed Issues

$ #105225
PROPOSAL: #105225 (comment)

Tests

Precondition: Account has free trial

  • If you account has free trial expired
  1. Log in to ND
  2. Disable the internet connection
  3. Go to the Workspace chat, click "+" - Create expense
  4. On the “Restricted” screen click “Add payment card”
  • If you account has free trial but not expired yet
  1. Log in to ND with the account that has a free trial
  2. Disable the internet connection
  3. Open console and enter the snippet: Onyx.merge('nvp_private_lastDayFreeTrial', '<today's date time>');
    E.g: if today's date is 8/26/2024 it would look like: Onyx.merge('nvp_private_lastDayFreeTrial', '2024-08-26 01:01:00');
  4. Then run the following snippet: "Onyx.merge('nvp_private_amountOwed', 1000);"
  5. Then run the following snippet: "Onyx.merge('nvp_private_billingGracePeriodEnd', 1719792000);"
  6. Go to the Workspace chat, click "+" - Create expense
  7. On the “Restricted” screen click “Add payment card”
  • Verify that no errors appear in the JS console

Offline tests

Pending human verification; the browser session blocker prevented establishing the issue's offline fixture.

Same as Test

QA Steps

Same as Test

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Web verification blocker (not evidence of the corrected flow):

Blocked browser state
Android: Native
Android: mWeb Chrome
Screen.Recording.2026-11-19.at.01.02.20.mov
iOS: Native
iOS: mWeb Safari
Screen.Recording.2026-11-19.at.00.58.14.mov
MacOS: Chrome / Safari
Screen.Recording.2026-11-19.at.00.56.42.mov

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Updated the PR body with the content from your details section, preserving the nested sections, checklist, and video links.


view run

@gijoe0295

Copy link
Copy Markdown
Contributor

@MelvinBot remove "Pending human verification; the browser session blocker prevented establishing the issue's offline fixture." from Test section on PR body

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Removed that sentence from the PR body’s “Offline tests” section.


view run

@gijoe0295

Copy link
Copy Markdown
Contributor

@MelvinBot mark PR ready for review

@gijoe0295

Copy link
Copy Markdown
Contributor

@MelvinBot please make this change:

When testing on web, the Restricted panel doesn't close smoothly: the card form opens the moment the close animation ends, before React has removed the closed screen, so the Restricted panel shows again for a frame. Please wait for the closed screen to unmount before opening the card form.

In src/pages/RestrictedAction/Workspace/WorkspaceOwnerRestrictedAction/index.tsx:

import runAfterClosingScreenUnmount from '@libs/Navigation/helpers/runAfterClosingScreenUnmount';

const addPaymentCard = () => {
    Navigation.dismissModal({
        // The transition ends a moment before React removes this screen. Opening the card form in that gap shows
        // this screen again for a frame, so wait until it is gone.
        afterTransition: () =>
            runAfterClosingScreenUnmount(() => Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.ADD_PAYMENT_CARD.path, ROUTES.SETTINGS_SUBSCRIPTION.route))),
    });
};

@MelvinBot
MelvinBot marked this pull request as ready for review November 18, 2026 18:56
@MelvinBot
MelvinBot requested a review from a team as a code owner November 18, 2026 18:56
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Marked the PR as ready for review.


view run

@expensify-chore-bot
expensify-chore-bot Bot removed the request for review from a team November 18, 2026 18:57
@expensify-chore-bot

Copy link
Copy Markdown

@gijoe0295 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T19:02:03.446732Z 95f54a4 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@expensify-chore-bot
expensify-chore-bot Bot removed the request for review from a team November 18, 2026 18:57
@gijoe0295

Copy link
Copy Markdown
Contributor

@inimaga quick question on native. #107023 only fixes web. On native, the Restricted button is "Go to subscription" and only opens Subscription, and Subscription has no way to add a card (card actions are disabled on mobile). So native owners have to switch to web to add a card.

Is that intended? If so, I'll mark native as not affected and keep this issue web-only.

Screen.Recording.2026-11-19.at.01.55.01.mov

Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner November 18, 2026 19:20
@expensify-chore-bot
expensify-chore-bot Bot requested review from inimaga and removed request for a team November 18, 2026 19:21
@expensify-chore-bot

Copy link
Copy Markdown

@inimaga Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot

MelvinBot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ❌ fail

Implemented and pushed the requested deferral, preserving native navigation; six focused tests passed. Browser verification was blocked by a suspended session, not a confirmed regression.

Blocked web app state

Step Status
Open Add payment card from Restricted without flashingUnverified from report and Search backgrounds: the app was unavailable.
Blocked web app state
❌
Close the card form and return to SubscriptionUnverified: the card form could not be reached. No card was submitted.
❌

view run · no recording available

afterTransition: () => Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.ADD_PAYMENT_CARD.path)),
// The transition ends a moment before React removes this screen. Opening the card form in that gap shows
// this screen again for a frame, so wait until it is gone.
afterTransition: () => runAfterClosingScreenUnmount(() => Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.ADD_PAYMENT_CARD.path, ROUTES.SETTINGS_SUBSCRIPTION.route))),

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.

On web, an owner can reach Restricted from Account → Profile by selecting Create report when their only eligible workspace is billing-restricted. Clicking Add payment card then opens the form over Profile because the navigator keeps the current page when Settings is already active. Navigation code

Could we switch to Subscription before opening the card form when the user is already on another Settings page?

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.

@inimaga it's good catch

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.

@MelvinBot please fix it by opening Subscription first when it isn't already the active page.

In src/pages/RestrictedAction/Workspace/WorkspaceOwnerRestrictedAction/index.tsx:

const openPaymentCardForm = () => Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.ADD_PAYMENT_CARD.path, ROUTES.SETTINGS_SUBSCRIPTION.route));

const addPaymentCard = () => {
    Navigation.dismissModal({
        // The transition ends a moment before React removes this screen. Opening the card form in that gap shows
        // this screen again for a frame, so wait until it is gone.
        afterTransition: () =>
            runAfterClosingScreenUnmount(() => {
                if (Navigation.isActiveRoute(ROUTES.SETTINGS_SUBSCRIPTION.route)) {
                    openPaymentCardForm();
                    return;
                }

                // Opening the form only swaps the page underneath when it is in another tab. From another Settings
                // page, such as Profile, that page would stay under the form, so open Subscription first.
                Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION.route, {afterTransition: openPaymentCardForm});
            }),
    });
};

The isActiveRoute check is needed because navigating to Subscription while it's already active does nothing, and its afterTransition would then wait up to 1s for a transition that never starts.

In tests/unit/pages/RestrictedAction/WorkspaceOwnerRestrictedActionTest.tsx:

  • Add isActiveRoute: (route: string) => mockGetActiveRoute() === route to the Navigation mock.
  • Run the web test over r/123, search?q=type:expense and settings/profile. For each, assert that the first navigate call goes to settings/subscription, and that running its afterTransition opens settings/subscription/add-payment-card.
  • Add a case where the active route is settings/subscription, asserting the form opens directly with a single navigate call.

Please also add the Profile → + → Create report → Add payment card flow to the PR's QA steps.

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.

@MelvinBot implement request

@MelvinBot MelvinBot Nov 19, 2026 •

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.

🤖 Web test steps verification results: ❌ fail

Implemented and pushed Subscription-first navigation, added Profile QA steps, and passed eight focused tests. Browser verification was blocked by a suspended session with no rendered UI; no card was submitted.

Blocked web session with no rendered application UI

Step Status
Profile → Create report reaches RestrictedUnverified: no application UI was available.
Blocked web session with no rendered application UI
❌
Profile, report, and Search open the form over Subscription without flashingBrowser verification blocked; regression unit tests passed.
❌
Closing reveals Subscription; already-active Subscription avoids redundant delayBrowser verification blocked; direct-opening unit test passed.
❌

view run · no recording available

@inimaga

inimaga commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Also, regarding your question on the native behaviour, yes, that is intentional. We switched to that button in #73257 so let’s keep this fix web-only.

@melvin-bot

melvin-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

@gijoe0295 I sent you a Slack DM to connect GitHub. I will continue the original request once you are connected.

@gijoe0295

Copy link
Copy Markdown
Contributor

@MelvinBot please send me a new request

@melvin-bot

melvin-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

@gijoe0295 I sent you a Slack DM to connect GitHub. I will continue the original request once you are connected.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The bot confirmed sending a fresh GitHub connection request. Please check your Slack DMs for the latest message.


view run

@gijoe0295

gijoe0295 commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
Screen.Recording.2026-11-19.at.22.49.32.mov
iOS: HybridApp
iOS: mWeb Safari
Screen.Recording.2026-11-19.at.22.46.23.mov
MacOS: Chrome / Safari
Screen.Recording.2026-11-19.at.22.42.48.mov

Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

Run details

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

LGTM!

@melvin-bot
melvin-bot Bot requested a review from inimaga November 20, 2026 07:16
@gijoe0295
gijoe0295 self-requested a review November 20, 2026 07:20
@gijoe0295

Copy link
Copy Markdown
Contributor

@inimaga withdraw approving, a problem need to check

@gijoe0295

Copy link
Copy Markdown
Contributor

@inimaga tested. Profile is fixed, but opening Subscription first from the workspace chat (composer + → Create expense → Add payment card) makes the card form stutter. From another tab, settings/subscription is a deep leaf, so linkTo pushes a second tab navigator and the form slides in while that mounts. Opening the form directly from other tabs switches to Subscription underneath on its own, which is what 4bc390c did and was smooth. So Subscription should only be opened first when the focused tab is already Settings.

@gijoe0295

Copy link
Copy Markdown
Contributor

@MelvinBot please make this change.

In src/pages/RestrictedAction/Workspace/WorkspaceOwnerRestrictedAction/index.tsx, add these imports:

import getActiveTabName from '@libs/Navigation/helpers/getActiveTabName';
import getTopmostFullScreenRoute from '@libs/Navigation/helpers/getTopmostFullScreenRoute';
import NAVIGATORS from '@src/NAVIGATORS';

and replace the body of the runAfterClosingScreenUnmount callback with:

// Opening the form from another tab switches to Subscription underneath it on its own. Opening
// Subscription first from there would push a second tab navigator and make the form stutter.
// Only another Settings page, such as Profile, would stay under the form, so open Subscription first there.
const isOnSettingsTab = getActiveTabName(getTopmostFullScreenRoute()) === NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR;
const shouldOpenSubscriptionFirst = isOnSettingsTab && !Navigation.isActiveRoute(ROUTES.SETTINGS_SUBSCRIPTION.route);
if (!shouldOpenSubscriptionFirst) {
    openPaymentCardForm();
    return;
}

Navigation.navigate(ROUTES.SETTINGS_SUBSCRIPTION.route, {afterTransition: openPaymentCardForm});

In tests/unit/pages/RestrictedAction/WorkspaceOwnerRestrictedActionTest.tsx:

  • Mock @libs/Navigation/helpers/getTopmostFullScreenRoute to return {key: 'tab', name: NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR} when the mocked active route starts with settings, and NAVIGATORS.REPORTS_SPLIT_NAVIGATOR otherwise (use jest.requireActual('@src/NAVIGATORS') inside the factory).
  • Opens the form directly (single navigate call to settings/subscription/add-payment-card) from r/123, /r/123, search?q=type:expense, home and settings/subscription.
  • Opens Subscription first, then the form after its afterTransition, from settings/profile, /settings/profile, settings/wallet?foo=bar and bare settings (the Settings list on narrow).

In the QA steps, keep the Profile flow and add: narrow layout, Account tab → + → Create report → Add payment card, verify Subscription is underneath.

Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
@MelvinBot

MelvinBot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ❌ fail

Pushed the Settings-tab guard, updated the requested route tests, and added narrow Account QA steps while preserving Profile coverage. All 13 focused tests passed, but browser verification was blocked by a suspended, blank session.

Blank app page blocking all requested verification

Step Status
Workspace chat → Create expense → Add payment cardBlocked: no application UI was available.
Blank app page blocking all requested verification
❌
Profile → Create report → Add payment cardUnverified due to the same infrastructure blocker.
❌
Narrow Account → Create report → Add payment cardUnverified due to the same infrastructure blocker.
❌
Closing the form leaves SubscriptionUnverified: the form could not be reached. No card details were entered or submitted.
❌

view run · no recording available

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ Something went wrong. This may be a transient issue. Try again. If it persists, check status.openai.com.

Run details

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

LGTM!

@inimaga
inimaga merged commit 8a1943b into main Nov 20, 2026
46 of 48 checks passed
@inimaga
inimaga deleted the claude-restrictedSubscription branch November 20, 2026 12:17
@github-actions

Copy link
Copy Markdown
Contributor

🚧 inimaga has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

Copy link
Copy Markdown
Contributor

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/inimaga in version: 9.5.52-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed — this PR only fixes navigation and transition behavior in an existing payment-card flow, without adding a feature or making any existing article sentence incorrect.


view run

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants