Skip to content

[CP Staging] Add production guard for selfDM splits - #91932

Merged
lakchote merged 17 commits into
Expensify:mainfrom
ZhenjaHorbach:add-isProduction-guard-for-selfDM-splits
May 28, 2026
Merged

lakchote merged 17 commits into
Expensify:mainfrom
ZhenjaHorbach:add-isProduction-guard-for-selfDM-splits

Conversation

@ZhenjaHorbach

@ZhenjaHorbach ZhenjaHorbach commented May 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #72125
PROPOSAL:

Tests

  1. Open App with prod env
  2. Create an expense in the selfDM
  3. Click 'More'
  4. Verify that the user shouldn't see Split
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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 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 a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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-05-28.15.55.19.mov

@lakchote lakchote changed the title Add production guard for selfDM splits [CP Staging] Add production guard for selfDM splits May 28, 2026
@codecov

codecov Bot commented May 28, 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 Δ
...c/components/ReportActionItem/MoneyRequestView.tsx 75.61% <100.00%> (ø)
src/hooks/useSelectedTransactionsActions.ts 76.44% <100.00%> (+0.09%) ⬆️
src/hooks/useSelectionModeReportActions.ts 85.79% <100.00%> (+0.08%) ⬆️
src/hooks/useShowNotFoundPageInIOUStep.ts 92.85% <100.00%> (+0.54%) ⬆️
src/libs/ReportSecondaryActionUtils.ts 94.63% <100.00%> (ø)
src/libs/TransactionUtils/index.ts 87.53% <100.00%> (-0.91%) ⬇️
src/libs/actions/IOU/SplitTransactionUpdate.ts 84.85% <100.00%> (+0.02%) ⬆️
...eaderActions/MoneyReportHeaderSecondaryActions.tsx 0.00% <0.00%> (ø)
...aderActions/MoneyReportHeaderSelectionDropdown.tsx 0.60% <0.00%> (-0.01%) ⬇️
.../components/MoneyRequestHeaderSecondaryActions.tsx 0.52% <0.00%> (-0.01%) ⬇️
... and 9 more
... and 54 files with indirect coverage changes

@ZhenjaHorbach
ZhenjaHorbach marked this pull request as ready for review May 28, 2026 08:47
@ZhenjaHorbach
ZhenjaHorbach requested review from a team as code owners May 28, 2026 08:47
@melvin-bot
melvin-bot Bot requested review from flaviadefaria and linhvovan29546 and removed request for a team May 28, 2026 08:47
@melvin-bot

melvin-bot Bot commented May 28, 2026

Copy link
Copy Markdown

@linhvovan29546 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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d26984be66

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/ReportSecondaryActionUtils.ts Resolved
@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

@linhvovan29546 I will review this PR since I reviewed the offending one. Thanks.

@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 120ffb69a4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/ReportSecondaryActionUtils.ts Resolved
@lakchote
lakchote requested review from dmkt9 and removed request for linhvovan29546 May 28, 2026 09:28
@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Should we add a guard to prevent changes to unreported split transactions on the Edit page?

image

@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Unreported per-diem split transactions still show the "Edit splits" option:

image

@ZhenjaHorbach

ZhenjaHorbach commented May 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Should we add a guard to prevent changes to unreported split transactions on the Edit page?

image

But how are you opening this flow if you won't be able to create a split in selfDM in prod?

@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Should we add a guard to prevent changes to unreported split transactions on the Edit page?
image

But how are you opening this flow if you won't be able to create a split in selfDM in prod?

Ah, I just moved one split transaction from the workspace to the selfDM report.

@ZhenjaHorbach

ZhenjaHorbach commented May 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Unreported per-diem split transactions still show the "Edit splits" option:

image

And did you test with already created splits before?
If so, then I don't see the point in wasting time on something that doesn't exist in prod yet 😅

@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

Unreported per-diem split transactions still show the "Edit splits" option:
image

And did you test with already created splits before? If so, then I don't see the point in wasting time on something that doesn't exist in prod yet 😅

Same here #91932 (comment) 😅

@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

@ZhenjaHorbach I think we need to add a guard for the updateSplitTransactions function as well.

2026-05-28.17-03-06.mp4

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor Author

@ZhenjaHorbach I think we need to add a guard for the updateSplitTransactions function as well.

2026-05-28.17-03-06.mp4

I think it's better to just filter selfDM transactions inside getChildTransactions( as before main changes)
It should cover all places
Will merge soon

@dmkt9

dmkt9 commented May 28, 2026

Copy link
Copy Markdown
Contributor

@ZhenjaHorbach Here are some points where a guard can be added, which codex pointed out to me:

  • src/hooks/useDeleteTransactions.ts:98: block redirect Delete -> Edit splits when isProduction && isSelfDMSplit. This is the main remaining loophole: the Delete action can still be changed to “Edit splits” and open the split flow in production.
  • src/hooks/useDeleteTransactions.ts:144: when calling initSplitExpense(..., {navigateToEditSplitExpense: true}), {isProduction} must also be passed. But the more important guard is still at getSplitExpenseEditTransactionOnDelete, so that the UI does not mistakenly show “Edit splits”.
  • src/pages/iou/SplitExpensePage.tsx:139: pass isProduction into isSplitAction in isSplitExpenseEditable.
  • src/pages/iou/SplitExpensePage.tsx:154: pass isProduction into isSplitAvailable, otherwise direct route/deep link will still render Split overview in production.
  • src/pages/iou/SplitExpenseEditPage.tsx:134: pass isProduction into isSplitAvailable, so that Edit split page returns NotFound for self-DM production.
  • src/pages/iou/SplitExpenseCreateDateRagePage.tsx:69: pass isProduction into isSplitAvailable; currently the date-range page still allows entry because undefined is interpreted as non-production.
  • src/hooks/useShowNotFoundPageInIOUStep.ts:55: add a general guard for SPLIT_EXPENSE edit sub-steps such as description/category/tag/date/distance/rate. Currently the hook only checks isSplitExpense && !!transaction, so if the user has already entered SplitExpenseEditPage, the sub-screens still edit the draft in production.
  • src/libs/ReportSecondaryActionUtils.ts:110: should make isProduction a required parameter or avoid default undefined => non-production. This is not a UI point, but it will help TypeScript catch all callsites missing the guard.

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

lakchote added a commit that referenced this pull request May 28, 2026
…or-selfDM-splits

[CP Staging] Add production guard for selfDM splits

(cherry picked from commit f20b3d5)

(cherry-picked to staging by lakchote)
lakchote added a commit that referenced this pull request May 28, 2026
…587539527-1

🍒 Cherry pick PR #91932 to staging 🍒
@OSBotify OSBotify mentioned this pull request May 28, 2026
75 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/lakchote in version: 9.3.88-2 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Help site review for PR #91932

No help site changes are required.

This PR adds an isProduction guard to hide the Split option for selfDM (personal/unreported) expenses in production while the feature continues to roll out in staging. The user-facing behavior in production remains unchanged — Split is still not available for selfDM expenses in production, which is what end users see today.

The current article at Split-Expenses.md covers how to split, edit, and revert expenses generally and does not document Split availability for selfDM/unreported expenses. It accurately reflects the current production behavior, so no updates are needed.

If/when the Split-for-selfDM feature is rolled out to production, a separate docs update can be made at that time to describe the new flow.

@OSBotify

Copy link
Copy Markdown
Contributor

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

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/lakchote in version: 9.3.89-1 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 I reviewed this PR and no help site changes are required.

Summary of the change: This PR adds an isProduction guard so the Split secondary action is hidden for selfDM (unreported) expenses in production, while leaving it available in staging/dev for continued development of the unreported-expense splits feature.

Why no docs update is needed:

  • The production user-visible behavior is unchanged — Split remains hidden for selfDM/unreported expenses in prod.
  • Split-Expenses.md currently describes Split for "posted, editable expense" and does not promise/document Split for selfDM or unreported expenses.
  • No other help articles under App/docs/articles reference selfDM or unreported-expense splitting.

Once the unreported-expense splits feature is enabled in production (issue #72125), a follow-up PR should update Split-Expenses.md to cover the selfDM/unreported flow at that time.

@ZhenjaHorbach, please confirm this assessment — if you believe a help site update is still warranted (for example, to clarify the current selfDM behavior), let me know and I'll draft one.

@OSBotify

OSBotify commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.3.89-7 🚀

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

CP Staging marks PRs that have been CP'd to staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants