Skip to content

[Payment due @thelullabyy] Allow setting and displaying approval workflows with the new structure - #94825

Merged
Gonals merged 79 commits into
mainfrom
alberto-moreApprovers
Aug 26, 2026
Merged

Gonals merged 79 commits into
mainfrom
alberto-moreApprovers

Conversation

@Gonals

@Gonals Gonals commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/651010
PROPOSAL:

Tests

This is where all the testing happens. Get ready because it is fun!

  1. Enable approval workflows:
Screenshot 2026-07-30 at 16 42 31
  1. Create a new workflow for a couple of users. Make it simple for now (a first approver and a second one, no overLimit)
  2. Confirm it displays properly
  3. Confirm it still displays properly after logout-login
  4. Dev only: Check the DB with select * from rules where scopeID='<POLICYID>';. Confirm the rules are in the right shape
  5. Add someone to the workflow. Confirm it gets added properly and gets added to the existing rules in the DB (no new rules)
  6. Change one of the approvers. Confirm it does so and the rules in the DB reflect it properly.
  7. Create a new workflow for a different user, with the same approvers. Confirm the user gets added to the existing flow and rules instead.
  8. Try to create a new workflow for users already in one. You should see this, but be allowed to do so:
Screenshot 2026-07-30 at 16 48 22
  1. Create a new workflow for new users with the same first approver, but a different second one.
  2. Confirm it displays as a different workflow. In the DB, it should share the first approver rule with the other users, but have a new rule for the second approver
  3. Confirm removing users from workflows works properly.
  4. Try adding over limit approvers and try similar things to the ones above. Confirm the behavior and display is the one you'd expect.
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

Same as tests, but no DB checks

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

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@Gonals Gonals self-assigned this Jun 29, 2026
@codecov

codecov Bot commented Jun 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/CONST/index.ts 94.16% <ø> (ø)
src/ONYXKEYS.ts 100.00% <ø> (ø)
src/libs/API/types.ts 100.00% <ø> (ø)
src/libs/ExportOnyxState/common.ts 80.95% <ø> (ø)
...ace/workflows/approvals/ApprovalWorkflowEditor.tsx 80.76% <ø> (ø)
...s/WorkspaceWorkflowsApprovalsApprovalLimitPage.tsx 0.00% <ø> (ø)
src/ROUTES.ts 26.61% <0.00%> (ø)
...rovals/WorkspaceWorkflowsApprovalsApproverPage.tsx 0.00% <0.00%> (ø)
...workspace/workflows/tabs/WorkflowsApprovalsTab.tsx 78.66% <90.00%> (+0.88%) ⬆️
...pprovals/WorkspaceWorkflowsApprovalsCreatePage.tsx 0.00% <0.00%> (ø)
... and 5 more
... and 11 files with indirect coverage changes

@Gonals
Gonals marked this pull request as ready for review June 30, 2026 00:15
@Gonals
Gonals requested review from a team as code owners June 30, 2026 00:15
@Gonals
Gonals requested review from JS00001 and luacmartins August 25, 2026 18:06
@Gonals

Gonals commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Comments addressed and everything retested. @luacmartins, @JS00001, all yours

@Gonals
Gonals merged commit e18c251 into main Aug 26, 2026
44 of 45 checks passed
@Gonals
Gonals deleted the alberto-moreApprovers branch August 26, 2026 18:41
@github-actions

Copy link
Copy Markdown
Contributor

🚧 Gonals 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 OSBotify mentioned this pull request Aug 26, 2026
57 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Gonals in version: 9.4.62-1 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

Docs review: no help site changes required

I reviewed this PR against the help site articles under docs/articles and no changes are needed. I did not open a draft PR.

Why: This PR migrates approval workflows to the new rules-based backend structure and is gated behind the multipleApprovers beta (MULTIPLE_APPROVERS). It introduces no new user-facing copy — there are no src/languages/* changes in the diff, and every addition is internal logic (rule reconciliation, workflow⇄rules conversion, new Onyx/rule types).

Every user-facing behavior this enables is already documented in Add-Approvals.md:

  • Multiple / chained approvers per workflow — covered under Configure Approval Workflows (adding approvers, over-limit Additional approver).
  • The cross-workflow warning — the string approverInMultipleWorkflows ("This member already belongs to another approval workflow. Any updates here will reflect there too.") already ships and is quoted in the FAQ "Why did adding an approver to one workflow change other members' workflows?"
  • Shared-approver forwarding and pending-report reassignment — both covered in the FAQ ("What happens to pending reports when I change an approver?" and the reassignment triggers/exclusions).

So the article already reflects the behavior this PR wires up under the beta. No linked help site PR was created since nothing needs updating.

@Gonals, if you believe the beta changes any documented behavior (new copy, a different warning, or a new UI surface), reply with the details and I'll open a docs PR.


view run

@mitarachim

Copy link
Copy Markdown

Deploy Blocker #99625 was identified to be related to this PR.

@jponikarchuk

Copy link
Copy Markdown

This PR failing with Gmail account because of the issue #99640
This issue is reproducible in: All platforms

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 9.4.62-4 🚀

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

Bundle Size Analysis (Sentry):

@melvin-bot

melvin-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #99700

@mkhutornyi

Copy link
Copy Markdown

This PR caused https://expensify.enterprise.slack.com/archives/C0CCB30FHH6.
The rules-based approval workflows were added but its rule builder sent over-limit reports to the over-limit approver instead of the step's approver.
Fix rules-based approval workflows so over-limit approvers go AFTER the approver in its step replaces that logic.

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.

10 participants