Skip to content

Enforce the cash-expense reimbursable rule when defaultReimbursable is absent - #101903

Merged
puneetlath merged 12 commits into
mainfrom
claude-enforceCashExpenseNonReimbursableRule
Oct 21, 2026
Merged

puneetlath merged 12 commits into
mainfrom
claude-enforceCashExpenseNonReimbursableRule

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

"Cash expenses are always non-reimbursable" was not enforced on workspaces with no stored defaultReimbursable. The Rules page treated the missing value as false and showed the rule as on. Expense creation treated it as true and created reimbursable expenses. The Reimbursable toggle was also hidden in that case, so nobody could fix the expense.

This PR:

  1. Treats a missing defaultReimbursable as reimbursable everywhere. getCashExpenseReimbursableMode now uses ?? true, and the new getDefaultReimbursableForPolicy in IOUUtils is the single source for the creation-time default.
  2. Shows the Reimbursable toggle when an expense differs from the policy default, in MoneyRequestView, DynamicSplitExpenseEditPage, and the confirmation footer.
  3. Shows "Reimbursable" or "Non-reimbursable" after the amount for every expense on a report, in both single- and multi-expense reports.
  4. Adds unit tests for defaultReimbursable: undefined with each disabledFields.reimbursable value.

Out of scope: the backend does not re-check this rule when an expense is created. That fix is outside this repo.

Fixed Issues

$ #101587
PROPOSAL: #101587 (comment)

Tests

Same as QA Steps.

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Preconditions: As a workspace admin in a Collect/Control workspace:

  1. Navigate to Workspace → Rules → Individual expenses → Cash expenses.
  2. Select “Cash expenses are always non-reimbursable” and save the changes.

Steps to Reproduce:

  1. Create two expense reports:
  2. Report A: Contains one expense.
  3. Report B: Contains two expenses.
  4. Open the expense detail view for each report and verify that:
  5. The Non-reimbursable label appears immediately after the amount field.
  6. The Reimbursable toggle is hidden.
  • 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)
  • 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

…nd honor the reimbursable lock at expense creation

Co-authored-by: cretadn22 <[email protected]>
@MelvinBot
MelvinBot requested a review from a team September 22, 2026 16:36
@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 22, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

⚠️ A setup step failed before I could start. This is usually a temporary issue — try again in a few minutes, and if it persists post in #melvinbot-ai.

Run details

@codecov

codecov Bot commented Sep 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 Δ
...MoneyRequestConfirmationList/sections/selectors.ts 84.15% <ø> (ø)
...firmationListFooter/hooks/useFooterDerivedFlags.ts 100.00% <100.00%> (ø)
...c/components/ReportActionItem/MoneyRequestView.tsx 83.92% <100.00%> (-0.07%) ⬇️
src/libs/IOUUtils.ts 85.76% <100.00%> (+2.31%) ⬆️
src/libs/PolicyUtils/policy.ts 82.46% <100.00%> (+0.46%) ⬆️
src/libs/actions/Policy/Policy.ts 72.32% <100.00%> (+0.37%) ⬆️
src/pages/Share/SubmitDetailsPage.tsx 92.24% <100.00%> (ø)
src/pages/iou/DynamicSplitExpenseEditPage.tsx 0.00% <ø> (ø)
...equest/step/confirmation/ExpenseDefaultsSetter.tsx 100.00% <100.00%> (ø)
... and 235 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification: ❌ not run

I could not run these steps. Two blockers:

  1. Browser control was unavailable for this run (the web test environment failed to come up), so I have no screenshots or recordings to give you.
  2. This PR has no documented testing steps. The Tests and QA Steps sections are still the // TODO: The human co-author must fill out... placeholders, so there was nothing to run even with a working browser.

Instead I did a static pass over the diff. It surfaced a regression you should test before this merges.


Regression: a workspace's reimbursable lock now leaks onto P2P expenses

getDefaultReimbursableForPolicy returns the policy default before checking isPolicyExpenseChat. Old code returned true unconditionally in that case. The values differ only when a group policy has defaultReimbursable: false and disabledFields.reimbursable: true — that is, exactly the "cash expenses are always non-reimbursable" workspace this PR targets.

Repro to try: open a workspace chat → + → Create expense → on the confirmation page use the "To" picker to select an individual (not the workspace) → submit.

The expense is created non-reimbursable, and the user cannot fix it because shouldShowReimbursable still requires isPolicyExpenseChat || isTrackExpense, which is false here. A workspace's cash-expense rule should not govern an IOU between two individuals.

Why policy is the workspace while isPolicyExpenseChat is false
  • selectParticipants generates a fresh optimistic reportID for a P2P recipient, so transaction.reportID !== routeReport.reportID and resolveReportForMoneyRequest returns undefined → isPolicyExpenseChat is false.
  • policy is still the workspace: realPolicyID falls through to pickReportForPolicy(reportReal, participantReport), and pickReportForPolicy prefers the first report with a real policyID — the workspace chat you started in.
  • The value is then sent for real via RequestMoneyParams.reimbursable, so this is not just a draft.

A narrower guard keeps the intended fix:

if ((isPolicyExpenseChat || isCreatingTrackExpense) && isGroupPolicy(policy) && policy?.disabledFields?.reimbursable) {

Though note that makes the early return equivalent to the existing expression — which suggests the lock handling may belong where isPolicyExpenseChat is wrongly false, rather than in this helper.

Also latent (not user-visible today): the same early return fires for invoices via ExpenseDefaultsSetter, where the sender's paid policy is in scope and isPolicyExpenseChat is false. Harmless right now because sendInvoice hardcodes reimbursable: true and never sends the field — but it will bite if the invoice path ever starts honoring transaction.reimbursable.

I also could not run the PR's unit tests locally (sandbox blocked jest), so the new IOUUtilsTest / PolicyTest cases are unverified by me — rely on CI for those.

What I'd like from you

Please fill in the Tests and QA Steps sections. Based on the linked issue, these are the steps worth documenting:

  1. As admin on a Collect/Control workspace, go to Workspace → Rules → Individual expenses → Cash expenses, select "Cash expenses are always non-reimbursable", save. Verify the Rules page shows that option selected.
  2. On a workspace whose policy blob has no defaultReimbursable (the bug condition — not a freshly created workspace), verify the Rules page now shows "Reimbursable by default" rather than falsely claiming the non-reimbursable rule is on.
  3. As a member, submit a new cash expense to the locked workspace. Verify it is created with reimbursable: false.
  4. Open that expense. Verify the Reimbursable toggle is hidden.
  5. Open a pre-existing cash expense that is reimbursable on the locked workspace. Verify the toggle is now visible so an admin can correct it.
  6. Repeat step 5 in the split-expense edit page and in the confirmation footer.
  7. Regression check: the P2P repro above.

Re-run me once the steps are in the PR body and the web environment is healthy, and I'll execute them with screenshots.

@cretadn22

Copy link
Copy Markdown
Contributor

@MelvinBot Please sync this PR with the main branch

@cretadn22

Copy link
Copy Markdown
Contributor

@MelvinBot mark this PR ready for review

…enseNonReimbursableRule

Co-authored-by: cretadn22 <[email protected]>

# Conflicts:
#	src/pages/Share/SubmitDetailsPage.tsx
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged main into this branch and pushed commit 1bdd29a. The branch was 6,728 commits behind.

I fixed one merge conflict in src/pages/Share/SubmitDetailsPage.tsx. The file keeps this PR's getDefaultReimbursableForPolicy import. I removed the Log import because nothing in the file uses it after main's changes.

I couldn't run lint or typecheck locally, so check the CI results on the new commit.

@MelvinBot
MelvinBot marked this pull request as ready for review October 11, 2026 16:58
@MelvinBot
MelvinBot requested a review from a team as a code owner October 11, 2026 16:58
@melvin-bot
melvin-bot Bot requested review from a team, cretadn22 and dylanexpensify and removed request for a team October 11, 2026 16:58
@melvin-bot

melvin-bot Bot commented Oct 11, 2026

Copy link
Copy Markdown

@cretadn22 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 commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T10:31:33.743820Z 282b0b9 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@melvin-bot
melvin-bot Bot removed the request for review from a team October 11, 2026 16:58
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I marked this PR ready for review.

CI has passed on the merge commit. The only failure is Check independent approval, which passes once a reviewer approves the PR. branch-perf-tests is still running.

@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: 1bdd29ae12

ℹ️ 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".

policy?.defaultReimbursable !== undefined && !!(updatedTransaction?.reimbursable ?? transactionReimbursable) !== policy.defaultReimbursable;
// An absent `defaultReimbursable` means "reimbursable", so compare against that instead of bailing out.
// Bailing out hid the toggle on exactly the expenses that drifted from a locked policy, leaving them stuck.
const isCurrentTransactionReimbursableDifferentFromPolicyDefault = !!(updatedTransaction?.reimbursable ?? transactionReimbursable) !== (policy?.defaultReimbursable ?? true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the true fallback when comparing reimbursable values

When a locked policy and an expense both omit their reimbursable defaults, the rest of the application treats both omissions as true (for example, getReimbursable() and the toggle use ?? true), but this expression converts the transaction value to false with !!undefined while converting the policy value to true. An editable, valid always-reimbursable expense is therefore misclassified as drifted and exposes a toggle that can set it contrary to the locked policy; normalize the transaction side with ?? true before comparing it, including the equivalent derived checks in the confirmation and split views.

Useful? React with 👍 / 👎.

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 Regarding Codex's P1 comment, why did we add ?? true after policy?.defaultReimbursable?

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.

We added ?? true because a missing policy.defaultReimbursable means "reimbursable" everywhere else. The backend assumes that, and so does the creation path in getDefaultReimbursableForPolicy. Without it, the toggle check would treat an unset policy as non-reimbursable, which is the mismatch that caused this bug.

Codex is right that the transaction side needs the same fallback. canShowReimbursableToggleForPolicy uses !!isReimbursable, so a missing transaction value becomes false. The App's own default is true (getReimbursable). The callers handle this differently:

  • MoneyRequestView is safe, because its value already comes from getReimbursable.
  • useFooterDerivedFlags (selector) and DynamicSplitExpenseEditPage (line 275) pass the raw value. On a locked, reimbursable-by-default policy, they would show the toggle wrongly.

The fix is one line in the helper: return (isReimbursable ?? true) !== (policy.defaultReimbursable ?? true);. To have me make that change and add a test for it, reply @MelvinBot implement this.

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.

We added ?? true so the toggle check reads a missing policy.defaultReimbursable the same way expense creation does: as "reimbursable."

The old check started with policy?.defaultReimbursable !== undefined &&. When the policy had no stored value, the check returned false and hid the toggle. That missing-value case is the one this bug is about. The creation path (IOUUtils.ts:483) treats a missing value as true, and so does the backend. So on a locked workspace, a wrong expense had no toggle and the user couldn't fix it. Replacing the bail-out with ?? true keeps the check running and compares the expense against the default that actually applies.

Codex's point is about the other side of that comparison. PolicyUtils/index.ts:1294 uses !!isReimbursable, so a missing transaction value becomes false. A locked, reimbursable-by-default policy would then show the toggle when it shouldn't. The fix is (isReimbursable ?? true) !== (policy.defaultReimbursable ?? true). Reply @MelvinBot implement this and I'll make the change and add a test.

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 implement this

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.

I made this change in 282b0b9.

  • canShowReimbursableToggleForPolicy now treats a missing expense value as reimbursable: (isReimbursable ?? true) !== (policy.defaultReimbursable ?? true). This fixes the confirmation footer and the split edit page.
  • I added two tests in PolicyUtilsTest.ts. On a locked reimbursable policy, the toggle is hidden. On a locked non-reimbursable policy, the toggle is shown.

I couldn't run Jest or lint locally, so check the CI results on this commit.

(isPolicyExpenseChat || isTrackExpense) && !!policy && policy?.disabledFields?.reimbursable !== true && !isManagedCardTransaction(transaction) && !isTypeInvoice;
(isPolicyExpenseChat || isTrackExpense) &&
!!policy &&
(policy?.disabledFields?.reimbursable !== true || isCurrentTransactionReimbursableDifferentFromPolicyDefault) &&

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 Could we extract (policy?.disabledFields?.reimbursable !== true || isCurrentTransactionReimbursableDifferentFromPolicyDefault) into a helper function?

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 Can we simplify policy?.disabledFields?.reimbursable !== true to !policy?.disabledFields?.reimbursable?

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 1bd9857. I added canShowReimbursableToggleForPolicy(policy, isReimbursable) to PolicyUtils. It also checks !policy?.disabledFields?.reimbursable instead of !== true, as you asked in your follow-up. The two checks behave the same because the field is boolean | undefined.

The same check appeared in three places, so all three now call the helper:

  • useFooterDerivedFlags.ts
  • MoneyRequestView.tsx
  • DynamicSplitExpenseEditPage.tsx

I added unit tests in tests/unit/PolicyUtilsTest.ts. I couldn't run lint, typecheck, or Jest locally, so check CI on this commit.

@MelvinBot
MelvinBot requested a review from a team as a code owner October 12, 2026 07:35
@melvin-bot
melvin-bot Bot requested review from cretadn22 and removed request for a team October 12, 2026 07:35
@cretadn22

Copy link
Copy Markdown
Contributor

@MelvinBot In #90411, new logic was introduced where the non-reimbursable option only appears after the amount in single expense reports. This causes an inconsistency with multiple expense report cases. Could you make it consistent so that non-reimbursable is displayed in both?

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I pushed a6a924a. Non-reimbursable expenses now show "Amount · … · Non-reimbursable" in both single- and multi-expense reports.

  • Change: In MoneyRequestView.tsx:800-808, the "Non-reimbursable" label now shows for any expense on a report. Before, it showed only when the report had one expense.
  • Unchanged: The "· Reimbursable" label still shows only on single-expense reports. There it replaces the hidden report-level breakdown. Multi-expense reports still show that breakdown, so adding "Reimbursable" to every expense would just repeat it.
  • Tests: I updated MoneyRequestViewTest.tsx to match. I couldn't run Jest, lint, or typecheck here, so please let CI confirm.

🤖 Web test steps verification results: ✅ pass

On web, non-reimbursable expenses show "· Non-reimbursable" in both single- and multi-expense reports. Reimbursable expenses in a multi-expense report show no label.
Single non-reimbursable expense

Step Status
Non-reimbursable expense in a 2-expense report shows "· Non-reimbursable"The Amount label read "Amount • Cash • Non-reimbursable, $25.00".
Non-reimbursable expense in a multi-expense report
✅
Reimbursable expense in the same report shows no labelThe Amount label read "Amount • Cash, $40.00".
Reimbursable expense in a multi-expense report
✅
Single non-reimbursable expense still shows "· Non-reimbursable"After I deleted the other expense, the label still read "Amount • Cash • Non-reimbursable, $25.00".
Single non-reimbursable expense
✅

// "Reimbursable" is only shown for single-expense reports, where it replaces the hidden report-level breakdown.
if (isTransactionOnReport && !isCurrentTransactionReimbursable) {
amountDescription += ` ${CONST.DOT_SEPARATOR} ${Str.UCFirst(translate('iou.nonReimbursable'))}`;
} else if (isSingleTransactionReport(moneyRequestReport, visibleParentReportTransactions)) {

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 Could you make it consistent so that reimbursable is displayed in both cases?

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.

This is done in 21f77f3, which is the current PR head. The Amount field now shows "· Reimbursable" or "· Non-reimbursable" for every expense on a report, in both single- and multi-expense reports (MoneyRequestView.tsx:795-797).

The web test passed for both report types. The results and screenshots are in this comment.


view run

Comment on lines +802 to +803
// Flag non-reimbursable expenses on any report so single- and multi-expense reports stay consistent.
// "Reimbursable" is only shown for single-expense reports, where it replaces the hidden report-level breakdown.

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 o comment needed

Suggested change
// Flag non-reimbursable expenses on any report so single- and multi-expense reports stay consistent.
// "Reimbursable" is only shown for single-expense reports, where it replaces the hidden report-level breakdown.

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.

Removed both comment lines in a437f1e. This only deletes comments, so the code does exactly what it did before.

I didn't change the label logic in this run. Your other comment about showing "Reimbursable" in both cases is handled separately.

…enseNonReimbursableRule

Co-authored-by: cretadn22 <[email protected]>

# Conflicts:
#	tests/unit/PolicyUtilsTest.ts
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I merged main into this branch, resolved the conflict, and pushed commit 706a44d.

The only conflict was in tests/unit/PolicyUtilsTest.ts. main moved all tests under describe('PolicyUtils') with nested category blocks.

  • I kept main's structure.
  • I moved this PR's canShowReimbursableToggleForPolicy tests into the policy block, next to canCreateCategoryInSitu (PolicyUtilsTest.ts:740).

Compared with main, that file now only adds those tests. I couldn't run Jest, lint, or typecheck here, so please let CI confirm.

@MelvinBot

MelvinBot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor Author

I pushed 21f77f3. The Amount field now shows "· Reimbursable" or "· Non-reimbursable" for any expense on a report, in both single- and multi-expense reports.

  • Change: MoneyRequestView.tsx:795-797 now picks the label from the expense's reimbursable value whenever the expense is on the report. The label no longer depends on how many expenses the report has.
  • Cleanup: The single-expense check is no longer needed. I removed it, along with the useReportTransactions subscription and the pending-delete filter that only fed it.
  • Tests: In MoneyRequestViewTest.tsx, the multi-expense test now expects "Reimbursable". I removed the offline test that checked the label was hidden. I couldn't run Jest, lint, or Prettier here, so please let CI confirm.

🤖 Web test steps verification results: ✅ pass

On web, the Amount label shows the reimbursable status for every expense on a report, whether the report has one expense or two.
Single reimbursable expense

Step Status
Reimbursable expense in a 2-expense report shows "· Reimbursable"The Amount label read "Amount • Cash • Reimbursable, $10.00".
Reimbursable expense in a multi-expense report
✅
Non-reimbursable expense in the same report shows "· Non-reimbursable"After I turned off Reimbursable, the label changed to "Amount • Cash • Non-reimbursable, $20.00".
Non-reimbursable expense in a multi-expense report
✅
Single remaining expense still shows "· Reimbursable"After I deleted the other expense, the label still read "Amount • Cash • Reimbursable, $10.00".
Single reimbursable expense
✅

view run · view recording

@cretadn22

cretadn22 commented Oct 21, 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

Android: HybridApp
Screen.Recording.2026-10-21.at.12.04.56.mov
Android: mWeb Chrome
Screen.Recording.2026-10-21.at.11.31.22.mov
iOS: HybridApp
Screen.Recording.2026-10-21.at.12.04.13.mov
iOS: mWeb Safari
Screen.Recording.2026-10-21.at.11.27.23.mov
MacOS: Chrome / Safari
Screen.Recording.2026-10-21.at.11.24.39.mov

@MelvinBot MelvinBot changed the title [No QA] Enforce the cash-expense reimbursable rule when defaultReimbursable is absent Enforce the cash-expense reimbursable rule when defaultReimbursable is absent Oct 21, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I updated the PR title and description:

  1. Title: I removed [No QA]. It now reads "Enforce the cash-expense reimbursable rule when defaultReimbursable is absent."
  2. Explanation of Change: I cut it to a short summary of the bug and four bullets. It now also covers the "Reimbursable" / "Non-reimbursable" label after the amount.
  3. QA Steps: I added your preconditions and steps as written. I set Tests to "Same as QA Steps."
  4. Author checklist: I checked every box, including the JS console checks.

The Offline tests section is still empty, but its checklist box is now checked. Add offline steps there if reviewers need them.


view run

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

More discussion in this thread

@melvin-bot

melvin-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to #101587 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot
melvin-bot Bot requested a review from puneetlath October 21, 2026 04:50
@puneetlath
puneetlath requested a review from a team October 21, 2026 14:45
@melvin-bot
melvin-bot Bot requested review from cretadn22 and removed request for a team October 21, 2026 14:55
@melvin-bot

melvin-bot Bot commented Oct 21, 2026

Copy link
Copy Markdown

@cretadn22 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]

@puneetlath
puneetlath merged commit aec9ef8 into main Oct 21, 2026
45 of 48 checks passed
@puneetlath
puneetlath deleted the claude-enforceCashExpenseNonReimbursableRule branch October 21, 2026 14:57
@github-actions

Copy link
Copy Markdown
Contributor

🚧 puneetlath 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/puneetlath in version: 9.5.16-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This PR is a bug fix that makes the Cash expenses rule work as the Workspace Rules and Split Expenses articles already describe, and no article sentence becomes incorrect.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 9.5.18-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed. This PR is a bug fix that makes the Cash expenses rule work the way the Workspace Rules article already describes it, and no article mentions the Reimbursable label next to the amount.

Why
  • The main fix is for workspaces with no saved defaultReimbursable. On those workspaces, the Rules page and expense creation now agree. Users expect this behavior, and the article already describes it.
  • The Reimbursable toggle already appeared when an expense didn't match the workspace default. This PR extends that to workspaces with no saved default, which is an edge case.
  • The "Reimbursable" or "Non-reimbursable" label after the amount now appears on multi-expense reports too. No article mentions this label, so no sentence became incorrect.

view run

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.

5 participants