Skip to content

Add workspace setting to control marking non-reimbursable reports as paid - #100569

Merged
stitesExpensify merged 27 commits into
Expensify:mainfrom
s77rt:prevent-payout-non-reimbursable-reports
Oct 16, 2026
Merged

stitesExpensify merged 27 commits into
Expensify:mainfrom
s77rt:prevent-payout-non-reimbursable-reports

Conversation

@s77rt

@s77rt s77rt commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Explanation of Change

Added new policy rule preventPayoutNonReimbursableReports, when enabled, non-reimbursable reports cannot be marked as paid.

Fixed Issues

$ #100427
PROPOSAL:

Tests

  1. Create a report with only non-reimbursable expenses
  2. Open report
  3. Verify you can mark the report as paid
  4. Go to workspace > Workflows > Advanced
  5. Enable Prevent marking non-reimbursable reports as paid toggle
  6. Create another report with only non-reimbursable expenses
  7. Open report
  8. Verify you cannot mark the report as paid
  9. Go to Spend > Reports
  10. Look for the same report and verify you cannot mark it as paid
    • The action in the row should be View
    • When selecting the report and clicking on the green button at the top, there should be not option to pay the report
    • Open the report and verify there is no option to pay or mark report as paid
  • Verify that no errors appear in the JS console
Screen.Recording.2026-10-02.at.9.35.59.AM.mov
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests

QA Steps

Same as Tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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

@melvin-bot

melvin-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx bun ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx bun ./scripts/generateTranslations.ts --compare-ref main

@s77rt s77rt changed the title Add workspace setting to control marking non-reimbursable reports as paid [Hold Web-E#55961] Add workspace setting to control marking non-reimbursable reports as paid Sep 8, 2026
@s77rt
s77rt marked this pull request as ready for review September 8, 2026 08:57
@s77rt
s77rt requested review from a team as code owners September 8, 2026 08:57
@melvin-bot
melvin-bot Bot requested review from FitseTLT and trjExpensify and removed request for a team September 8, 2026 08:57
@melvin-bot

melvin-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

@FitseTLT 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 September 8, 2026 08:57
@s77rt

s77rt commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

@FitseTLT This cannot be tested yet (BE PRs not deployed yet) but you can start reviewing code

@trjExpensify

Copy link
Copy Markdown
Contributor

Joe owns the parent issue, switching the product review.

@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

I will test this once the backend is out 👍

@joekaufmanexpensify

Copy link
Copy Markdown
Contributor

Backend still in review, but we seem to be getting closer.

@joekaufmanexpensify

joekaufmanexpensify commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

@s77rt this is off hold now, correct? nothing remains from the backend?

@s77rt
s77rt requested a review from FitseTLT October 9, 2026 12:30
@s77rt

s77rt commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

@FitseTLT I have addressed the review comments and resolved conflicts. Please make sure to retest as there were some changes in this recent PR #102347 that touch some common logic

Comment thread src/libs/actions/Policy/Policy.ts
Comment thread src/libs/ReportUtils.ts
Comment thread src/pages/workspace/rules/ExpenseReportRulesSection.tsx Outdated
Comment on lines +172 to +173
((nonReimbursableSpend !== 0 || hasSettledZeroReimbursableSpend(spendBreakdown, report, transactions)) &&
!(policy?.preventPayoutNonReimbursableReports && hasOnlyNonReimbursableTransactions(report?.reportID, transactions))))

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.

I don't think this condition is correct it is mixing up our rule to hasSettledZeroReimbursableSpend. I feel like I got your intention you don't want hasSettledZeroReimbursableSpend unintentionally enabling our case but from the intention of their pr I think they want to target reimbursable expenses cumulating to zero. So we should apply our rule for the all non-reimbursable case and then apply !hasOnlyNonReimbursableTransactions condition beside hasSettledZeroReimbursableSpend.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm not sure I got what you mean. The new condition does keep the intention of the original PR and extend to support this one.

  • If a report has any expenses that as whole cancel each other, also show the pay button
  • If a report has non reimbursable expenses then show the pay button

However if that report only has non-reimbursable expenses and the policy settings prevent paying those, then do not show the pay button

Am I missing some case?

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.

Hmmm. I am not sure how practical it is because now hasSettledZeroReimbursableSpend case is also intervening with the all non-reimbursable case but there are at least two problems.

  1. non-zero nonReimbursableSpend value was supposed to only allow pay only for the case of all non-reimbursable, now there is no logic limiting that.
  2. A zero all non-reimbursable report is also allowed to be paid which also happens on main of course but I don't think is correct it is unintentionally slipping through hasSettledZeroReimbursableSpend.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

non-zero nonReimbursableSpend value was supposed to only allow pay only for the case of all non-reimbursable, now there is no logic limiting that.

This was pointless because if a report has nonReimbursableSpend > 0 but it also contain reimbursable expenses, then the pay button will show up regardless due to either reimbursableSpend > 0 or the new hasSettledZeroReimbursableSpend

A zero all non-reimbursable report is also allowed to be paid which also happens on main of course but I don't think is correct it is unintentionally slipping through hasSettledZeroReimbursableSpend.

it can be marked as paid still, the only thing preventing this is this new preventPayoutNonReimbursableReports flag

@FitseTLT

Copy link
Copy Markdown
Contributor

bump @s77rt we are close!

@s77rt

s77rt commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

Addressed comments

@stitesExpensify

Copy link
Copy Markdown
Contributor

I will review this tomorrow

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

Looks great!

@stitesExpensify
stitesExpensify merged commit b1a2d81 into Expensify:main Oct 16, 2026
37 of 40 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.5.14-0 🚀

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

@MelvinBot

MelvinBot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

A help site update is needed. I opened a draft docs PR: Docs updates for E/A#100569 Add Prevent marking non-reimbursable reports as paid setting.

This PR adds a new Prevent marking non-reimbursable reports as paid toggle to Workflows > Advanced, and it isn't behind a beta. This sentence in Workspace Rules lists every report-level rule and leaves out the new one:

They are Prevent self-approvals, Auto-approve compliant reports, and Auto-pay approved reports.

The docs PR makes two small edits:

  • Workspace-Rules.md: adds the new toggle to that sentence.
  • Workspace-Workflows.md: adds one bullet for it to the Advanced tab settings list.

I checked the label and its position against the live web UI.

@s77rt, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review


view run · view recording

@jponikarchuk

Copy link
Copy Markdown

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

@jponikarchuk

Copy link
Copy Markdown

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

@lanitochka17

Copy link
Copy Markdown

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.5.14-3 🚀

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants