Skip to content

Skip members pending deletion when building approval workflows - #99988

Merged
jasperhuangg merged 8 commits into
mainfrom
claude-phantomApprovalWorkflowOnDeletedMember
Oct 14, 2026
Merged

jasperhuangg merged 8 commits into
mainfrom
claude-phantomApprovalWorkflowOnDeletedMember

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

When a member is removed while offline, the app first reassigns the default workflow's approver, which stamps submitsTo on the member being removed, and then marks that member with pendingAction: DELETE. The stale submitsTo survives until the backend confirms the removal.

convertPolicyEmployeesToApprovalWorkflows created a workflow bucket for any employee with a resolvable submitsTo, but only pushed the employee into that bucket when their pendingAction was not DELETE. So the member pending deletion produced a workflow with members: [] — the extra row showing "Approver: Admin, Expenses from: (nothing)". It also added that stale approver to usedApproverEmails, so the approver picker treated them as already in use by a workflow that no longer renders. Both disappear once online because the backend drops the removed employee entirely.

This change skips employees with pendingAction: DELETE at the top of the loop in both conversion functions, so they can't create a workflow they will never be a member of. A member pending deletion was already excluded from availableMembers, from workflow members, and from the workflow's pendingAction, so skipping them removes only the phantom workflow. The now-unreachable DELETE checks further down each loop are removed as dead code.

The same fix is applied to convertApprovalWorkflowRulesToWorkflows (the MULTIPLE_APPROVERS beta counterpart), which groups employees the same way and had the same defect.

One edge case is deliberately left alone: if no live employee has a resolvable submitsTo, the workflows list is now empty rather than showing the phantom row. That already matches existing behavior for a workspace where nobody submits to anyone (covered by the existing Should return an empty list if there are no employees and Should not include users that submit to non-employee user tests), so it's not changed here.

Fixed Issues

$ #99357
PROPOSAL: #99357 (comment)

Tests

Precondition: a workspace with an Admin, Employee 1 set as the default approver, and Employee 2

  1. Go offline.
  2. As the Admin, remove Employee 1 from the members list.
  3. Verify the approver is automatically switched to the Admin.
  4. Open Workflows > Edit approval workflow > Approver.
  5. Set the approver to Employee 2 and save.
  6. Verify the default workflow now shows Employee 2 as the approver, and that no extra workflow row appears with "Approver: Admin" and an empty "Expenses from".
  • 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 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 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 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.
  • 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.

A member removed while offline keeps a stale submitsTo, which built an extra approval workflow with no members and marked their old approver as used. Skip pending-DELETE members in both the employeeList and rules based conversions.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team September 1, 2026 03:48
@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 Sep 1, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Android test run failed — no test steps could be executed. The app never reached Home, so none of the 8 PR test steps were verified.

The emulator build crashed right after sign-in with a React Native Fabric mounting error, and did not recover:

  1. The prestarted session was sitting on the post-magic-code "Join" welcome screen.
  2. Tapping Join threw a redbox: addViewAt: failed to insert view [540] into parent [482] at index 1 / index=1 count=0 (SurfaceMountingManager.kt / MountItemDispatcher.kt).
  3. Dismissing the redbox left a blank screen; the ReactNativeJS log stream went silent.
  4. A JS reload restarted the app but it hung at the same startup point ([OnyxUpdateManager] Done applying HTTPS update, lastUpdateID:0).
  5. The Dev Menu showed "Fast Refresh disconnected" — Metro had died mid-run.
  6. Restarting Metro brought the bundler back and the app rebundled, but hung at the exact same startup point a second time.

Two independent hangs at the identical spot point at a build/environment problem on this branch's dev build, not at the workflows change itself. I can't tell from here whether the Fabric crash is related to this PR — it happens during sign-in, well before any approval-workflow code runs.

Step Status Observation
1. Go offline not run App never reached Home
2. Remove Employee 1 as Admin not run App never reached Home
3. Approver auto-switches to Admin not run App never reached Home
4. Open Workflows > Edit approval workflow > Approver not run App never reached Home
5. Set approver to Employee 2 and save not run App never reached Home
6. No phantom "Approver: Admin" row with empty "Expenses from" not run App never reached Home
7. Admin not marked as already used in approver picker not run App never reached Home
8. Back online, workflows list unchanged not run App never reached Home
Evidence (3)

React Native redbox: addViewAt failed to insert view into parent (Fabric mounting error) shown right after tapping Join

React Native redbox: addViewAt failed to insert view into parent (Fabric mounting error) shown right after tapping Join

RN Dev Menu showing Fast Refresh disconnected banner, confirming Metro had died mid-run

RN Dev Menu showing Fast Refresh disconnected banner, confirming Metro had died mid-run

App stuck on a blank dark screen after Metro restart and reload

App stuck on a blank dark screen after Metro restart and reload

Reply with @MelvinBot retry the Android test to try again on a fresh emulator session.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Web: partial pass — 8 of 9 steps verified, including the key regression check. Removing the pending-deletion default approver while offline correctly falls back to the Admin with no phantom workflow row, and setting Employee 2 as approver persists unchanged after going back online. Step 7 could not be run: this Collect-plan workspace paywalls every route to a second approver picker behind a Control-plan upgrade.

Step Status Observation
1. Go offline pass Troubleshoot > Force offline toggled on; "You appear to be offline." banner appeared
2. Admin removes Employee 1 pass Employee 1's row rendered with strikethrough (pending deletion) while offline
3. Approver auto-switches to Admin pass Approver field changed from Employee 1 to the Admin, with only one Approvals section
4. Open Workflows > Edit approval workflow > Approver pass Edit approval workflow screen opened showing Admin; approver row opened the picker
5. Set approver to Employee 2 and save pass Selected Employee 2 — Employee 1 was correctly excluded from the list as pending-deleted
6. No phantom "Approver: Admin" row with empty "Expenses from" pass Accessibility snapshot shows exactly one "Expenses from, Everyone" button, one Approver section, one Edit button — no duplicate row
7. Admin not marked as already used in a new workflow's approver picker not run Both "Add approval workflow" and "Additional approver" redirect to an Upgrade-to-Control paywall on this Collect workspace; upgrading is a billing action, out of scope for verify-only testing
8. Back online, workflows list unchanged pass Offline toggle off, banner gone; Workflows still shows the single default workflow with Employee 2 as approver
9. No JS console errors pass (indirect) No console verb exists for web sessions in the tooling — based on absence of error banners, toasts, or broken UI across the flow, not on direct console output

Step 6 is the regression this PR fixes, and it passed. Step 7 (the usedApproverEmails half of the fix) still needs a human check on a Control-plan workspace.

Evidence (9)

Workspace with Employee 1 set as default approver (precondition)

Workspace with Employee 1 set as default approver (precondition)

Force offline toggle enabled, offline banner visible

Force offline toggle enabled, offline banner visible

Employee 1 shown strikethrough as pending removal while offline

Employee 1 shown strikethrough as pending removal while offline

Approver automatically switched to Admin, single workflow row

Approver automatically switched to Admin, single workflow row

Approver detail screen opened from Edit approval workflow

Approver detail screen opened from Edit approval workflow

Default workflow shows Employee 2 as approver with no phantom duplicate row (key regression check)

Default workflow shows Employee 2 as approver with no phantom duplicate row (key regression check)

Force offline toggled back off, no offline banner

Force offline toggled back off, no offline banner

Workflows list unchanged after returning online

Workflows list unchanged after returning online

Add approval workflow blocked by Control-plan upgrade paywall

Add approval workflow blocked by Control-plan upgrade paywall

view run

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot pull main and fix conflict

…lWorkflowOnDeletedMember

# Conflicts:
#	src/libs/WorkflowUtils.ts
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Merged main into this branch and resolved the conflict — the PR is MERGEABLE again (e7ab95db08e).

The conflict: one hunk in src/libs/WorkflowUtils.ts:1667. main renamed groupedByFingerprint/fingerprint to groupedByWorkflowKey/workflowKey and added rule-based default detection (isDefaultWorkflowChain), while this branch deleted the now-dead DELETE checks in the same lines.

Resolution: kept main's workflowKey + isDefaultWorkflowChain and applied this PR's simplification on top — members: [member] and a plain pendingAction, since employees pending deletion already continue at src/libs/WorkflowUtils.ts:1606. No behavior change to the fix, and no main logic dropped. tests/unit/WorkflowUtilsTest.ts auto-merged cleanly.

Verification run locally on the merged branch
Check Result
npm test -- tests/unit/WorkflowUtilsTest.ts Passed (107 tests, including both new ones)
npm test -- tests/actions/WorkflowTest.ts tests/unit/ApprovalWorkflowSectionTest.tsx Passed (32 tests)
npm run lint-changed Passed
npm run typecheck Passed

The React Compiler check was skipped — no components or hooks were touched.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Nothing to fix — every code check passes on the merged branch (e7ab95db08e). The single red X is Check independent approval, which is a human review gate, not a code failure.

That job runs one step, Verify peer review, and it fails because the PR has zero reviews (reviewDecision: REVIEW_REQUIRED). It clears once a reviewer other than the author approves. The PR is also still a draft.

Full check results at e7ab95db08e
Check Result
typecheck, ESLint check, Oxfmt check, spellcheck Pass
test (jobs 1–8), Bun tests, Storybook tests Pass
React Compiler Compliance, Check for unused styles, Compare knip issues against main Pass
baseline-perf-tests, branch-perf-tests Pass
Android + iOS builds (build (Debug, true), build (developmentDebug, false), and the two Dev builds) Pass
Check independent approval Fail — no approving review yet

The same was true before the main merge: at f314fb7c9c0 every check passed except Verify peer review. So the merge introduced no regressions. I also re-ran npx tsc --noEmit locally on the merged branch — clean.

I didn't push anything, since there's no failure a code change could address.

Comment thread src/libs/WorkflowUtils.ts Outdated
@@ -198,10 +198,15 @@ function convertPolicyEmployeesToApprovalWorkflows({policy, personalDetails, fir

const member = buildMemberFromEmployee(employee, personalDetailsByEmail, email);

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 move this line below early return to avoid redundant computation

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.

Done in b51b544edb0 — buildMemberFromEmployee now runs after the pendingAction === DELETE early return, so members pending deletion no longer build a Member that gets thrown away. Applied the same change in convertApprovalWorkflowRulesToWorkflows.

WorkflowUtilsTest.ts + WorkflowTest.ts + ApprovalWorkflowSectionTest.tsx (139 tests), lint-changed, and typecheck all pass.

Comment thread src/libs/WorkflowUtils.ts Outdated
@@ -1608,10 +1603,14 @@ function convertApprovalWorkflowRulesToWorkflows({

const member = buildMemberFromEmployee(employee, personalDetailsByEmail, email);

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 move this line below early return to avoid redundant computation

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.

Done in b51b544edb0 — buildMemberFromEmployee now runs after the pendingAction === DELETE early return here too, matching the same change in convertPolicyEmployeesToApprovalWorkflows.

WorkflowUtilsTest.ts + WorkflowTest.ts + ApprovalWorkflowSectionTest.tsx (139 tests), lint-changed, and typecheck all pass.

@mkhutornyi

Copy link
Copy Markdown
Contributor
Details

Explanation of Change

When a member is removed while offline, the app first reassigns the default workflow's approver, which stamps submitsTo on the member being removed, and then marks that member with pendingAction: DELETE. The stale submitsTo survives until the backend confirms the removal.

convertPolicyEmployeesToApprovalWorkflows created a workflow bucket for any employee with a resolvable submitsTo, but only pushed the employee into that bucket when their pendingAction was not DELETE. So the member pending deletion produced a workflow with members: [] — the extra row showing "Approver: Admin, Expenses from: (nothing)". It also added that stale approver to usedApproverEmails, so the approver picker treated them as already in use by a workflow that no longer renders. Both disappear once online because the backend drops the removed employee entirely.

This change skips employees with pendingAction: DELETE at the top of the loop in both conversion functions, so they can't create a workflow they will never be a member of. A member pending deletion was already excluded from availableMembers, from workflow members, and from the workflow's pendingAction, so skipping them removes only the phantom workflow. The now-unreachable DELETE checks further down each loop are removed as dead code.

The same fix is applied to convertApprovalWorkflowRulesToWorkflows (the MULTIPLE_APPROVERS beta counterpart), which groups employees the same way and had the same defect.

One edge case is deliberately left alone: if no live employee has a resolvable submitsTo, the workflows list is now empty rather than showing the phantom row. That already matches existing behavior for a workspace where nobody submits to anyone (covered by the existing Should return an empty list if there are no employees and Should not include users that submit to non-employee user tests), so it's not changed here.

Fixed Issues

$ #99357
PROPOSAL: #99357 (comment)

Tests

Precondition: a workspace with an Admin, Employee 1 set as the default approver, and Employee 2

  1. Go offline.
  2. As the Admin, remove Employee 1 from the members list.
  3. Verify the approver is automatically switched to the Admin.
  4. Open Workflows > Edit approval workflow > Approver.
  5. Set the approver to Employee 2 and save.
  6. Verify the default workflow now shows Employee 2 as the approver, and that no extra workflow row appears with "Approver: Admin" and an empty "Expenses from".
  • 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 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 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 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.
  • 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.

@MelvinBot please set the PR body to the content in the details section above and mark as ready for review

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Still nothing to fix — every code check passes on the latest commit (b51b544edb0). The two red X's are both human gates, not code failures:

  • Check independent approval — its Verify peer review step fails because the PR has no approving review yet (reviewDecision: REVIEW_REQUIRED). Clears when a reviewer other than the author approves.
  • checklist — reviewerChecklist.js logs No PR Reviewer Checklist was found after scanning all 10 comments. Clears when a reviewer posts the PR Reviewer Checklist comment.

The PR is also still a draft.

Full check results at b51b544edb0

All passing: typecheck, ESLint check, Oxfmt check, spellcheck, test (jobs 1–8), Bun tests, Storybook tests, React Compiler Compliance, Check for unused styles, Compare knip issues against main, baseline-perf-tests, branch-perf-tests, validate-perf-tests, codecov/patch, codecov/project, verifySignedCommits, and all four Android/iOS builds.

I also re-ran the relevant checks locally on b51b544edb0 after the Build the member only after the pending-deletion early return commit landed:

Check Result
npm test -- tests/unit/WorkflowUtilsTest.ts tests/actions/WorkflowTest.ts tests/unit/ApprovalWorkflowSectionTest.tsx Passed (139 tests, 3 suites)
npx tsc --noEmit Passed
npx eslint src/libs/WorkflowUtils.ts tests/unit/WorkflowUtilsTest.ts Passed

I didn't push anything — no code change would clear either of these.

@MelvinBot
MelvinBot marked this pull request as ready for review September 6, 2026 19:55
@MelvinBot
MelvinBot requested a review from a team as a code owner September 6, 2026 19:55
@melvin-bot
melvin-bot Bot requested review from flaviadefaria and mkhutornyi and removed request for a team September 6, 2026 19:55
@melvin-bot

melvin-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Contributor Author

Done — the PR body is now set to the content you provided, and the PR is marked ready for review.

Two sections from the previous body are gone because they weren't in the content you gave me: the ### AI Tests table (the local test, lint, and typecheck results) and the empty ### Screenshots/Videos block. Let me know if you want either added back.

@mkhutornyi

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

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
ios.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov

@melvin-bot
melvin-bot Bot requested a review from youssef-lr September 6, 2026 19:56
@youssef-lr

Copy link
Copy Markdown
Contributor

cc @flaviadefaria

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The failing typecheck check is unrelated to this PR. main is currently broken, so I didn't push a fix here.

Analysis: The error is TS2741: Property 'getReportByID' is missing ... in type 'SearchOptionsConfig' at src/components/Search/SearchAutocompleteList.tsx:322. This PR only changes src/libs/WorkflowUtils.ts and tests/unit/WorkflowUtilsTest.ts.

Evidence

Next step: Someone needs to fix main by adding getReportByID to the getSearchOptions() call at line 322. After that lands, re-run typecheck on this PR. The test jobs were still pending when I checked.


view run

…lWorkflowOnDeletedMember

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged the latest main into this branch again and pushed it in merge commit 1a5a0f07f03. There were no conflicts. CI will run again on the new commit, which should show whether the fix for the typecheck failure on main is in.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

@flaviadefaria

Copy link
Copy Markdown
Contributor

Only engineers should be merging code. @jasperhuangg @youssef-lr, can one of you merge?

@youssef-lr

Copy link
Copy Markdown
Contributor

cc @jasperhuangg

@jasperhuangg

Copy link
Copy Markdown
Contributor

@mkhutornyi sorry there are conflicts now? @youssef-lr I think your internal engineer review on here should be enough, I'm going to unassign myself

@jasperhuangg
jasperhuangg removed their request for review October 1, 2026 22:16
@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot pull main and fix conflict

…lWorkflowOnDeletedMember

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>

# Conflicts:
#	src/libs/WorkflowUtils.ts
#	tests/unit/WorkflowUtilsTest.ts
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged main into this branch and fixed the conflicts. The merge commit is c3a1d5a.

I resolved conflicts in these two files:

  • src/libs/WorkflowUtils.ts: I kept the new hasRuleBasedChain field from main. I also kept this PR's plain pendingAction, since members pending deletion are now skipped earlier in the loop.
  • tests/unit/WorkflowUtilsTest.ts: I kept this PR's pending-deletion test and the three new default-workflow tests from main.

WorkflowUtilsTest.ts passes (146 tests). npm run typecheck and npm run lint-changed pass too.

@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot pull main and fix conflict

…lWorkflowOnDeletedMember

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>

# Conflicts:
#	src/libs/WorkflowUtils.ts
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged main into this branch and fixed the conflict in src/libs/WorkflowUtils.ts (commit 1eae24a). Both conflicts were in convertPolicyEmployeesToApprovalWorkflows and convertApprovalWorkflowRulesToWorkflows.

How I resolved them:

  • This PR's change, kept: members pending deletion are still skipped before they're built or added to availableMembers.
  • Change from main, adopted: the looser !submitsTo check and its comments, so members whose approver left the workspace still show up, flagged.

All 148 tests in tests/unit/WorkflowUtilsTest.ts pass. Typecheck and lint fail locally, but only in files that main changed for a newer react-native-gesture-handler than the version installed here. None of those failures are in this PR's files.

@melvin-bot
melvin-bot Bot requested a review from jasperhuangg October 9, 2026 10:30
@mkhutornyi

Copy link
Copy Markdown
Contributor

@MelvinBot pull main

…lWorkflowOnDeletedMember

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Merged the latest main into this branch (1,354 new commits). There were no conflicts. The merge commit is e135414.


view run

@jasperhuangg
jasperhuangg merged commit 26cd2cd into main Oct 14, 2026
42 of 43 checks passed
@jasperhuangg
jasperhuangg deleted the claude-phantomApprovalWorkflowOnDeletedMember branch October 14, 2026 05:43
@github-actions

Copy link
Copy Markdown
Contributor

🚧 jasperhuangg 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.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/jasperhuangg in version: 9.5.9-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 No help site update is needed. This PR fixes a bug where an empty, phantom approval workflow row appeared after removing a member while offline, so the app now behaves as users would expect and no article sentence becomes incorrect.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/cristipaval in version: 9.5.9-4 🚀

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

Bundle Size Analysis (Sentry):

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.

6 participants