Skip to content

fix (batch 1): isNewManualExpenseFlowEnabled beta flag regressions#96717

Open
thelullabyy wants to merge 8 commits into
Expensify:mainfrom
thelullabyy:fix/93854-regressions
Open

fix (batch 1): isNewManualExpenseFlowEnabled beta flag regressions#96717
thelullabyy wants to merge 8 commits into
Expensify:mainfrom
thelullabyy:fix/93854-regressions

Conversation

@thelullabyy

@thelullabyy thelullabyy commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #93854
$ #96550
$ #96609
$ #96576
$ #96668
$ #96578
PROPOSAL:

Tests

Verify that these bugs are not reproducible when new manual expense flow beta flag is enabled

#96550
#96609
#96576
#96668
#96578

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Verify that these bugs are not reproducible when new manual expense flow beta flag is enabled

#96550
#96609
#96576
#96668
#96578

  • 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
issue-96609.mov
issue-96550.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
issue-96576.mov
issue-96668.mov
issue-96578.mov

@codecov

codecov Bot commented Jul 22, 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/libs/IOUUtils.ts 75.90% <100.00%> (-2.64%) ⬇️
src/pages/iou/request/IOURequestStartPage.tsx 83.78% <0.00%> (ø)
.../request/step/DynamicIOURequestStepTaxRatePage.tsx 0.00% <0.00%> (ø)
.../pages/iou/request/step/IOURequestStepCategory.tsx 0.00% <0.00%> (ø)
src/pages/iou/request/step/IOURequestStepTag.tsx 0.00% <0.00%> (ø)
.../iou/request/step/IOURequestStepCategoryCreate.tsx 0.00% <0.00%> (ø)
...es/iou/request/step/IOURequestStepConfirmation.tsx 63.74% <22.22%> (-2.00%) ⬇️
src/components/ParticipantPicker.tsx 0.00% <0.00%> (-95.24%) ⬇️
... and 17 files with indirect coverage changes

@thelullabyy
thelullabyy marked this pull request as ready for review July 23, 2026 04:03
@thelullabyy
thelullabyy requested review from a team as code owners July 23, 2026 04:03
@melvin-bot
melvin-bot Bot requested review from JmillsExpensify and ikevin127 and removed request for a team July 23, 2026 04:03
@melvin-bot

melvin-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

@ikevin127 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 removed the request for review from a team July 23, 2026 04:03
@thelullabyy thelullabyy changed the title fix: isNewManualExpenseFlowEnabled beta flag regressions fix (batch 1): isNewManualExpenseFlowEnabled beta flag regressions Jul 23, 2026
Comment thread src/components/ParticipantPicker.tsx
Comment thread src/components/ParticipantPicker.tsx

@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: 1516076ba6

ℹ️ 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/pages/iou/request/step/IOURequestStepConfirmation.tsx
@ikevin127

ikevin127 commented Jul 23, 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 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

iOS: Native
96550 96609
96550.mov
96609.mov
MacOS: Chrome / Safari
96576 96578 96668
96576.mov
96578.mov
96668.mov

Comment thread src/pages/iou/request/step/IOURequestStepConfirmation.tsx Outdated
Comment thread src/libs/IOUUtils.ts
const policyIdReal = getIOURequestPolicyID(transaction, reportReal ?? transactionReport ?? participantReport);
// The self-DM a submissions-disabled workspace flow is seeded onto carries the placeholder '_FAKE_' policy;
// don't let that shadow the selected workspace chat's real policy, or this page's categories never load. See #96576.
const policyIdReal = getIOURequestPolicyID(transaction, reportHasRealPolicy(reportReal) ? reportReal : (transactionReport ?? participantReport ?? reportReal));

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.

🟢 Divergent fallback chains for the same reportHasRealPolicy guard

The helper is applied with a slightly different fallback in each file:

  • IOURequestStepCategory.tsx:77 -> reportHasRealPolicy(reportReal) ? reportReal : (transactionReport ?? participantReport ?? reportReal)
  • IOURequestStepCategoryCreate.tsx:64 / IOURequestStepConfirmation.tsx:170 -> ... : (participantReport ?? reportReal)
  • IOURequestStepTag.tsx:68 / IOURequestStepTaxRatePage.tsx:64 -> ... : participantReport

Each variant matches that file's pre-existing fallback set, so this is not a regression. But five subtly different expressions for one conceptual rule ("prefer a report with a real policy, else the participant report") is a maintenance hazard: the next person fixing this area has to diff five call sites to know they are equivalent.

Why it matters: reviewer/maintainer cognitive load, and the risk that a future edit "fixes" one site and forgets the others.

Suggestion (optional): consider a small resolver that encapsulates the preference order, e.g. pickReportForPolicy(reportReal, transactionReport, participantReport), returning the first with a real policy.

ℹ️ Not blocking.

// On iOS, presenting this picker as a native <Modal> while it is embedded inside the create-expense RHP
// (itself a modal presentation) deadlocks the main thread - opening the picker and then interacting with the
// confirmation freezes the whole app (#96609 / #96550)
if (Platform.OS === 'ios') {

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.

Agree with the AI reviewer here:

🟢 iOS overlay uses an inline zIndex literal and direct Platform fork

Two small style-guide points:

  • The inline {zIndex: 10} object is a magic number and a fresh literal on each render. Since this is a full-screen sibling that already paints on top by JSX order, verify the zIndex is actually needed; if it is, prefer a named style/StyleUtils value so the stacking intent is documented and reused.
  • Forking render output on Platform.OS === 'ios' inline works, but the established pattern for platform-divergent rendering is generally a .ios.tsx split. Inline is acceptable here given how small the fork is; flagging only for consistency. Since the fork is driven by a constant, there is no hooks-ordering risk (both useLocalize and useThemeStyles run before any early return), which is correct.

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

✅ Completed checklist and review, found ⚠️ 1 regression that needs to be resolved before merging, the other comments are NAB but would be recommended before merge.

@thelullabyy

Copy link
Copy Markdown
Contributor Author

Checking...

@thelullabyy

Copy link
Copy Markdown
Contributor Author

@ikevin127 It is ready for second round review

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

The latest fix works, just a refactoring request since I noticed we're now double-going against the "platform-specific code MUST be placed in dedicated files and folders ... reject any PR that attempts to put platform-specific code anywhere else" rule 👇

{isNewManualExpenseFlowEnabled && isParticipantPickerVisible && (
{/* On iOS the picker is a plain overlay we mount only when visible; on web/Android it is a self-animating
react-native-modal that must stay mounted while hidden so it can animate out and fire onModalHide. */}
{isNewManualExpenseFlowEnabled && (getPlatform() !== CONST.PLATFORM.IOS || isParticipantPickerVisible) && (

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.

🟠 Two inline platform checks now, both should move into dedicated platform files (incl. src/components/ParticipantPicker.tsx, the if (Platform.OS === 'ios') block)

First off, the fix itself works, the iOS overlay dodges the nested-modal deadlock, and the follow-up commit correctly restored the web/Android Modal animation. No complaints on the behavior 🟢

The concern is structural. As of the latest commit there are now two inline platform branches, so this goes against CROSS-PLATFORM.md twice over:

  1. ParticipantPicker.tsx -> if (Platform.OS === 'ios') picks overlay vs Modal.
  2. IOURequestStepConfirmation.tsx:978 -> getPlatform() !== CONST.PLATFORM.IOS gates the mount.

The doc is explicit: "platform-specific code MUST be placed in dedicated files and folders ... reject any PR that attempts to put platform-specific code anywhere else." A comment explains the intent but doesn't grant the exception, that's reserved for a sign-off from multiple internal engineers.

And the second check is really a symptom of the first: because the picker forks on platform internally, the parent had to add its own platform gate to keep the hidden Modal mounted on web. That's platform awareness leaking up into the business logic, which is exactly what this rule exists to stop.

Both checks disappear if we push the split into platform files:

src/components/ParticipantPicker/
  BaseParticipantPicker.tsx   // shared ScreenWrapper + MoneyRequestParticipantsSelector body
  index.tsx                   // web/Android: RIGHT_DOCKED Modal, stays mounted while hidden, animates via isVisible
  index.ios.tsx               // iOS: absolute-fill View overlay, returns null when !isVisible

Then the parent goes back to a plain render with zero platform awareness:

{isNewManualExpenseFlowEnabled && (
    <ParticipantPicker ... isVisible={isParticipantPickerVisible} ... />
)}

Mount-while-hidden vs mount-when-visible becomes each platform file's own business, and the confirmation step no longer needs to know what platform it's running on. If we'd rather keep the inline version, can we get an explicit sign-off from another engineer on the issue per the doc, instead of leaving it in a comment ?

Anchor on the if (Platform.OS === 'ios', ⚠️ using plain string instead of constant) line in ParticipantPicker.tsx (line 116) as the root cause; the IOURequestStepConfirmation.tsx:978 gate can just get a one-line reply pointing back here.

▎ Reviewed with AI assistance; the call and wording are mine.

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

No product review required since we're fixing regressions.

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.

3 participants