Skip to content

Part 3 - Audit usage of Str.removeSMSDomain - #100056

Merged
mountiny merged 3 commits into
Expensify:mainfrom
FitseTLT:fix-audit-removeSMSDomain-part-3
Sep 8, 2026
Merged

mountiny merged 3 commits into
Expensify:mainfrom
FitseTLT:fix-audit-removeSMSDomain-part-3

Conversation

@FitseTLT

@FitseTLT FitseTLT commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

The approval workflow surfaces displayed member and approver names through Str.removeSMSDomain, which only strips the @expensify.sms suffix. A phone-login user with no display name therefore rendered as a raw +15551234567 in the workflows list, the workflow editor, the approval limit page, and the "Expenses from" member selector, instead of the national format for the viewer's country.

This replaces those calls with formatPhoneNumber from useLocalize(), so the values react to the viewer's country code. Display names are guarded with Str.isSMSLogin first, because formatPhoneNumber substitutes non-breaking spaces and would break wrapping on ordinary names; logins are formatted directly, since it leaves non-phone strings unchanged. getApprovalLimitDescription takes formatPhoneNumber as an injected parameter, matching how it already receives translate and convertToDisplayString. The workflow search is left additive rather than swapped, so typing raw digits still matches alongside the newly displayed format.

Fixed Issues

$ #97957
PROPOSAL: N/A — issue owner

Tests

Setup: a workspace on a Control policy with at least four approval workflows (the search field only appears above three), at least two members whose login is a phone number and who have no display name set, so the login is what renders, plus one member with an ordinary display name.

  1. Go to Workspace settings > Workflows and enable Add approvals.
  2. Verify each workflow row shows the phone member formatted for your region rather than as a raw +15551234567, on both the "Expenses from" line and the approver line.
  3. Verify the member with an ordinary display name still shows that name unchanged.
  4. Tap a workflow to open the editor. Verify the members line and each approver row show the same formatted number.
  5. On an approver row, set an approval limit and an over-limit forward-to approver.
  6. Verify the helper text reads "Reports above $1,000 forward to ..." with the approver's number formatted rather than raw.
  7. Open the approval limit page for that approver and verify the selected approver's name is formatted there too.
  8. Go back to the workflows list. With more than three workflows present, verify the search field is shown, and use it.
  9. Search the raw digits of the phone member's login and verify the workflow still matches.
  10. Search the number exactly as it now appears in the row and verify the workflow matches.
  11. Search the email/login form and verify the workflow matches.
  12. Search part of the ordinary display name and verify that workflow still matches.
  13. Open a workflow and tap Expenses from to open the member selection list.
  14. Verify each selected and unselected member row shows a formatted number, and that the avatar tooltip/name matches.
  15. Verify the row's secondary line still shows the raw email/login.
  16. Select a member who already belongs to another workflow, so the "member already in workflow" confirmation appears.
  17. Verify the prompt names both the member and the existing approver with formatted numbers.

[x] Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests

  • 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 followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 followed the guidelines as stated in the Review Guidelines
  • 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 a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • 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.
  • 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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
2026-09-01.19-46-05.mp4

@FitseTLT
FitseTLT requested review from a team as code owners September 1, 2026 15:11
@melvin-bot
melvin-bot Bot requested review from shubham1206agra and removed request for a team September 1, 2026 15:11
@melvin-bot

melvin-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

@shubham1206agra 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]

@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team September 1, 2026 15:11
@shubham1206agra

Copy link
Copy Markdown
Contributor

@FitseTLT Fix CI checks please

@codecov

codecov Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/components/ApprovalWorkflowSection.tsx 80.43% <100.00%> (+0.43%) ⬆️
src/libs/WorkflowUtils.ts 91.82% <100.00%> (+0.01%) ⬆️
...workspace/workflows/tabs/WorkflowsApprovalsTab.tsx 78.37% <100.00%> (+0.29%) ⬆️
...ace/workflows/approvals/ApprovalWorkflowEditor.tsx 79.01% <57.14%> (-1.76%) ⬇️
...s/WorkspaceWorkflowsApprovalsApprovalLimitPage.tsx 0.00% <0.00%> (ø)
...micWorkspaceWorkflowsApprovalsExpensesFromPage.tsx 0.00% <0.00%> (ø)
... and 45 files with indirect coverage changes

Comment thread tests/unit/WorkflowUtilsTest.ts Resolved
@shubham1206agra

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 proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and 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 that this PR follows the guidelines as stated in the Review Guidelines
  • 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 and each prop has a /** comment above it */
    • The file is named correctly
    • 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
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • 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.
  • 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

Screen.Recording.2026-09-03.at.9.28.01.PM.mov

@melvin-bot
melvin-bot Bot requested a review from mountiny September 3, 2026 15:59
@mountiny
mountiny merged commit 33b43d9 into Expensify:main Sep 8, 2026
35 of 37 checks passed
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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

@OSBotify

OSBotify commented Sep 8, 2026

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.

@OSBotify OSBotify mentioned this pull request Sep 8, 2026
69 tasks done
@OSBotify

OSBotify commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.74-0 🚀

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

@MelvinBot

MelvinBot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🤖 No help site changes are required for this PR — no docs PR created.

This PR is a display-formatting fix. It swaps Str.removeSMSDomain for formatPhoneNumber so a phone-login member with no display name renders as a nationally formatted number instead of a raw +15551234567. Nothing a help article documents changes.

How I checked

What the PR changes: the rendered value of member and approver names in the workflows list, the workflow editor, the approval limit page, and the Expenses from selector — plus additive search matching on the new format. No new feature, no new or renamed setting, no changed toggle or button label, no changed navigation path.

Articles reviewed:

  • Add Approvals — documents enabling approvals and configuring default, custom, over-limit, and Category/Tag approvers. Every step is a click path; none describes how a member's name is rendered.
  • Workspace Workflows — covers the Workflows tab sections and the authorized payer. Same conclusion.

Specific things I looked for and did not find:

  • No article shows a raw phone number example (+1555…, (555)…) anywhere under docs/articles/new-expensify/.
  • No article documents the workflows search field or what it matches on, so the additive search behavior has nothing to update.
  • No article states how phone-login members appear in member or approver lists.

Because the rendered number is now correct rather than different-by-design, this is a bug fix bringing the UI in line with what the docs already imply.

If you think a help article should call out how phone-login members appear in approval workflows, reply with @MelvinBot and the article you want it added to, and I'll open the draft PR.


view run · view recording

@OSBotify

OSBotify commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.4.74-2 🚀

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants