App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-25] [CFI] [$175] Reimbursable field missing from bulk edit while individual editing works

Open m-natarajan opened this issue 2 weeks ago • 17 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: Reproducible in staging?: Needs Reproduction (Unable to reproduce) Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @greg-schroeder Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Open the affected report, shown as Outstanding cash expenses in the customer’s screenshot.
  2. Select multiple expenses with violations.
  3. Choose Edit multiple.
  4. Look for the Reimbursable field.

Expected Result:

Expenses whose reimbursable status can be changed individually should also support that change in bulk.

Actual Result:

Reimbursable is missing. Only Amount, Description, Merchant, Date, Category, and Attendees appear. The customer reports that changing reimbursable status individually still works.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [x] MacOS: Chrome / Safari

Screenshots/Videos

The screenshots and account/workspace details are in Slack thread

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

m-natarajan avatar Nov 12 '26 15:11 m-natarajan

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Krishna2323 (External)

melvin-bot[bot] avatar Nov 12 '26 15:11 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022120902876864920482

melvin-bot[bot] avatar Nov 12 '26 15:11 melvin-bot[bot]

🤖 Web test steps verification results: ⚠️ partial

The test account has no expenses or reports, so reproduction was blocked—not an observed product failure. Code investigation identified a bulk-versus-individual eligibility discrepancy, but the affected workspace’s configuration is needed to confirm attribution.

Reports list showing No reports yet
Step Status
1. Open a cash expense report with violationsSpend showed “No expenses yet”; Reports showed “No reports yet”.
Reports list showing No reports yet
⚠️
2. Select multiple expenses with violationsBlocked by the missing expense fixture.
⚠️
3. Choose Edit multipleNot reached because no expenses were available.
⚠️
4. Compare bulk and individual Reimbursable editingNeither editing flow could be verified at runtime.
⚠️

Proposal

What is the root cause of that problem?

Likely cause—medium confidence: Bulk editing requires the workspace’s reimbursable lock flag to be explicitly false. Individual editing additionally permits correcting an expense that disagrees with a locked workspace default, and treats an omitted lock flag as unlocked.

Consequently, expenses can support individual correction while the entire bulk Reimbursable field is hidden. One ineligible expense hides it for the whole selection.

Code evidence and alternative explanations
  • Bulk visibility: SearchEditMultiplePage.tsx:158–164 requires disabledFields.reimbursable === false for every reported expense.
  • Individual visibility: policy.ts:164–177 permits locked-policy mismatches. For example, a reimbursable expense under a locked non-reimbursable default remains individually correctable but fails the bulk check.
  • Missing versus disabled: SearchEditMultiplePage.tsx:397–405 hides the row through the visibility predicate; ordinary permission failures instead disable it.
  • Violations are not inputs to that visibility predicate. Their presence alone does not explain the omission.
  • Finalized-report permissions are less consistent with successful individual editing: both flows use the shared edit-permission checks.

This establishes a code discrepancy, not the affected customer’s exact configuration.

What changes do you think we should make in order to solve the problem?

First confirm the affected workspace’s reimbursable lock/default settings and each selected expense’s current reimbursable value.

If those inputs confirm this mechanism, align bulk visibility with the existing individual-policy helper. Preserve resolved workspace-policy requirements, report/card exclusions, all-selected-expenses eligibility, and permission checks.

Add regression coverage for:

  • Locked-default mismatches in both directions.
  • Omitted lock flags and default reimbursable values.
  • Mixed eligible/ineligible selections.
  • Unchanged values producing no update.

What alternative solutions did you explore? (Optional)

Removing permission checks would not address the visibility mismatch and would broaden editing incorrectly.

A related but distinct report is Category field and Reimbursable toggle missing when destination is self DM; it concerns expense creation, not bulk editing, so it is not established as a duplicate.


Next Steps for Contributor+ team: Confirm the affected configuration before accepting this proposed fix. To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/106741) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin’s proposal.


view run · no recording available

MelvinBot avatar Nov 12 '26 15:11 MelvinBot

Proposal

What is the root cause of that problem?

In src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx, bulk editing determines whether the Reimbursable field should be shown for the selected transactions on line 163:

return !isIOUReport(report) && !isInvoiceReport(report) && transactionPolicy?.disabledFields?.reimbursable === false && !isManagedCardTransaction(transaction);

There are two distinct bugs with the strict transactionPolicy?.disabledFields?.reimbursable === false check:

  1. Omitted / Undefined Lock Flag: By default in Expensify workspaces, disabledFields.reimbursable is undefined when the lock hasn't been explicitly configured (it is not explicitly set to false). In JavaScript, undefined === false evaluates to false. Therefore, for all standard unlocked workspaces, bulk edit erroneously treats Reimbursable as not editable and hides the field.
  2. Disagreement with Locked Policy Default: For individual expense editing, MoneyRequestView.tsx uses canShowReimbursableToggleForPolicy(policy, isReimbursable) from src/libs/PolicyUtils/policy.ts:
    function canShowReimbursableToggleForPolicy(policy: OnyxEntry<Policy>, isReimbursable: boolean | undefined): boolean {
        if (!policy?.disabledFields?.reimbursable) {
            return true;
        }
        return (isReimbursable ?? true) !== (policy.defaultReimbursable ?? true);
    }
    
    Even when disabledFields.reimbursable is locked (true), an expense that currently disagrees with the policy default ((isReimbursable ?? true) !== (policy.defaultReimbursable ?? true)) must remain correctable so it isn't permanently stuck on an unintended value. Line 163 in SearchEditMultiplePage ignored canShowReimbursableToggleForPolicy, causing a discrepancy where individual editing allows correcting reimbursable status, but bulk edit completely hides the field.

What changes do you think we should make in order to solve the problem?

In src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx:

  1. Import canShowReimbursableToggleForPolicy from @libs/PolicyUtils.

  2. Replace transactionPolicy?.disabledFields?.reimbursable === false with canShowReimbursableToggleForPolicy(transactionPolicy, transaction.reimbursable):

    const areSelectedTransactionsReimbursable = selectedTransactionContexts.every(({transaction, report, transactionPolicy}) => {
        // Unreported expenses have no policy yet but reimbursable is always applicable
        if (!transaction.reportID || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
            return true;
        }
        return !isIOUReport(report) && !isInvoiceReport(report) && canShowReimbursableToggleForPolicy(transactionPolicy, transaction.reimbursable) && !isManagedCardTransaction(transaction);
    });
    

This aligns bulk edit visibility with individual edit visibility across all workspace configurations:

  • Workspaces with disabledFields.reimbursable === undefined or false allow bulk editing.
  • Workspaces with locked reimbursable permit bulk editing when the selected expenses disagree with the locked policy default.
  • Existing checks for IOU reports, invoice reports, managed card transactions, and partial editability (hasPartiallyEditableReimbursableTransaction) remain fully intact.

What alternative solutions did you explore? (Optional)

  • Using transactionPolicy?.disabledFields?.reimbursable !== true: while this fixes the undefined lock flag issue, it still fails to support correcting expenses that disagree with a locked policy default. Reusing the canonical canShowReimbursableToggleForPolicy helper maintains consistency with MoneyRequestView, useFooterDerivedFlags, and DynamicSplitExpenseEditPage.


Contributor details

Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374

kevinjosh10 avatar Nov 12 '26 16:11 kevinjosh10

Proposal

What is the root cause of that problem?

In src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx:163, bulk edit decides whether the Reimbursable field should show with:

transactionPolicy?.disabledFields?.reimbursable === false

That strict === false check fails when the lock flag is undefined — which is the default for a standard unlocked workspace, where the flag is never explicitly set to false. undefined === false is false, so bulk edit treats Reimbursable as not editable and hides the field entirely. Individual editing does not have this bug: MoneyRequestView.tsx uses canShowReimbursableToggleForPolicy (src/libs/PolicyUtils/policy.ts), which returns true when the flag is falsy, and even when the flag is locked (true) it still lets the user correct an expense whose reimbursable value disagrees with the locked policy default. Bulk edit ignores that helper, so the two flows disagree.

What changes do you think we should make in order to solve the problem?

In SearchEditMultiplePage.tsx, reuse the canonical helper instead of duplicating the lock check:

return !isIOUReport(report) && !isInvoiceReport(report) && canShowReimbursableToggleForPolicy(transactionPolicy, transaction.reimbursable) && !isManagedCardTransaction(transaction);

with canShowReimbursableToggleForPolicy imported from @libs/PolicyUtils. This aligns bulk edit with individual edit across all workspace configurations: flags undefined or false allow bulk editing, and a locked policy still permits bulk-correcting expenses that disagree with the locked default. No new screen is needed — SEARCH_EDIT_MULTIPLE_REIMBURSABLE_RHP already exists, and the write path (draftTransaction.reimbursable → changes.reimbursable) already handles the value. The IOU-report, invoice-report, managed-card guards and the hasPartiallyEditableReimbursableTransaction handling stay untouched.

What alternative solutions did you explore?

Using transactionPolicy?.disabledFields?.reimbursable !== true would fix the undefined case but would still block correcting expenses that disagree with a locked policy default. Reusing canShowReimbursableToggleForPolicy keeps bulk edit consistent with MoneyRequestView and the other callers of that helper.

What will I verify?

Bulk-edit a selection on an unlocked workspace (flag undefined) and confirm the Reimbursable field appears; verify a locked-policy case where the selected expenses disagree with the default remains correctable; verify mixed selections and that managed-card transactions are still excluded; run the related SearchEditMultiple tests. Note: this issue is marked Needs Reproduction (the bot could not reproduce without fixtures), so I will confirm the behaviour against a workspace matching the report (Outstanding cash expenses with violations) before treating the fix as final.

Contributor details

  • Expensify email: [email protected]
  • Upwork profile: https://www.upwork.com/freelancers/~01c5c6bc0e7d162f7b

khizzcr7 avatar Nov 12 '26 18:11 khizzcr7

Proposal

Please re-state the problem that we are trying to solve in this issue.

When selecting multiple cash expenses on a report and opening Edit multiple, the Reimbursable field is missing from the bulk-edit screen even though changing Reimbursable on each of those expenses individually works as expected.

What is the root cause of that problem?

  1. Strict transactionPolicy?.disabledFields?.reimbursable === false check in SearchEditMultiplePage.tsx: In src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx:159-171, bulk edit determines whether the Reimbursable row should render via:

    const areSelectedTransactionsReimbursable = selectedTransactionContexts.every(({transaction, report, transactionPolicy}) => {
        if (!isCardTransactionReimbursableEditable(transaction)) {
            return false;
        }
    
        // Unreported expenses have no policy yet but reimbursable is always applicable
        if (!transaction.reportID || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
            return true;
        }
    
        // The workspace cash expense rules don't apply to card expenses, which follow their card feed's reimbursable setting instead
        return !isIOUReport(report) && !isInvoiceReport(report) && (isManagedCardTransaction(transaction) || transactionPolicy?.disabledFields?.reimbursable === false);
    });
    

    By contrast, individual expense editing (MoneyRequestView.tsx:565), split editing (DynamicSplitExpenseEditPage.tsx:283), and expense confirmation (useFooterDerivedFlags.ts:99) all evaluate cash-expense reimbursable visibility through canShowReimbursableToggleForPolicy:

    function canShowReimbursableToggleForPolicy(policy: OnyxEntry<Policy>, isReimbursable: boolean | undefined): boolean {
        if (!policy?.disabledFields?.reimbursable) {
            return true;
        }
        return (isReimbursable ?? true) !== (policy.defaultReimbursable ?? true);
    }
    

    Because SearchEditMultiplePage.tsx:170 checks transactionPolicy?.disabledFields?.reimbursable === false instead of canShowReimbursableToggleForPolicy, it fails in two cases where individual editing succeeds:

    • Unlocked workspaces where disabledFields.reimbursable is undefined (omitted): undefined === false is false, hiding Reimbursable in bulk edit.
    • Locked workspaces (disabledFields.reimbursable === true) where an expense disagrees with defaultReimbursable: e.g. an expense with a violation / mismatched reimbursable state ((transaction.reimbursable ?? true) !== (transactionPolicy.defaultReimbursable ?? true)). Individual editing shows the toggle so the user can correct the mismatch, whereas bulk edit hides the field.
  2. Fixing a locked-policy mismatch in SearchEditMultipleReimbursablePage hides the Reimbursable row when returning to SearchEditMultiplePage if draftTransaction.reimbursable is not considered: In DynamicSplitExpenseEditPage.tsx:279-283 and MoneyRequestView.tsx:565, canShowReimbursableToggleForPolicy is evaluated against the current/updated reimbursable value. However, in bulk edit, selecting a new value in SearchEditMultipleBooleanPage writes draftTransaction.reimbursable and navigates back to SearchEditMultiplePage before Save is pressed. If areSelectedTransactionsReimbursable only checks canShowReimbursableToggleForPolicy(transactionPolicy, transaction.reimbursable) (or if it switched to draftTransaction.reimbursable), we must ensure the Reimbursable row remains visible both when the underlying transaction.reimbursable is eligible and while a bulk-edit draft value (typeof draftTransaction?.reimbursable === 'boolean') has been selected prior to saving.

  3. Per-transaction save guard in src/libs/actions/IOU/BulkEdit.ts:387-389: Currently, BulkEdit.ts:387-389 checks:

    if (changes.reimbursable !== undefined && canEditField(CONST.EDIT_REQUEST_FIELD.REIMBURSABLE)) {
        transactionChanges.reimbursable = changes.reimbursable;
    }
    

    Unlike changes.billable (line 384, which gates on supportsExpenseFields), changes.reimbursable does not check !isIOUReport(baseIouReport) && !isInvoiceReportReportUtils(baseIouReport ?? undefined) or isCardTransactionReimbursableEditable(transaction) at the action layer. Keeping the action layer aligned with the UI guard prevents any non-editable card or non-expense report transaction from being mutated if updateMultipleMoneyRequests is invoked.

What changes do you think we should make in order to solve the problem?

  1. In src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx:

    • Import canShowReimbursableToggleForPolicy from @libs/PolicyUtils.
    • Update areSelectedTransactionsReimbursable (lines 159–171) to use canShowReimbursableToggleForPolicy(transactionPolicy, transaction.reimbursable) alongside the existing isManagedCardTransaction(transaction) and isCardTransactionReimbursableEditable(transaction) checks from PR #104057:
      const areSelectedTransactionsReimbursable = selectedTransactionContexts.every(({transaction, report, transactionPolicy}) => {
          if (!isCardTransactionReimbursableEditable(transaction)) {
              return false;
          }
      
          // Unreported expenses have no policy yet but reimbursable is always applicable
          if (!transaction.reportID || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
              return true;
          }
      
          // The workspace cash expense rules don't apply to card expenses, which follow their card feed's reimbursable setting instead
          return (
              !isIOUReport(report) &&
              !isInvoiceReport(report) &&
              (isManagedCardTransaction(transaction) || canShowReimbursableToggleForPolicy(transactionPolicy, transaction.reimbursable))
          );
      });
      
  2. In tests/ui/SearchEditMultiplePageTest.tsx: Add unit tests covering:

    • Showing Reimbursable when policy.disabledFields is undefined (standard unlocked workspace where disabledFields.reimbursable is omitted).
    • Showing Reimbursable when policy.disabledFields.reimbursable is true (defaultReimbursable: false) and the selected cash expenses have reimbursable: true (or undefined), matching individual editability when an expense disagrees with the locked policy default.
    • Hiding Reimbursable when policy.disabledFields.reimbursable is true and any selected cash expense already matches policy.defaultReimbursable.

What alternative solutions did you explore? (Optional)

  • Checking transactionPolicy?.disabledFields?.reimbursable !== true in SearchEditMultiplePage.tsx: this would fix workspaces where disabledFields.reimbursable is undefined, but would still fail when disabledFields.reimbursable is true and the selected expenses disagree with policy.defaultReimbursable (which is why individual editing via canShowReimbursableToggleForPolicy still shows the toggle). Reusing canShowReimbursableToggleForPolicy keeps bulk edit 100% consistent with MoneyRequestView, DynamicSplitExpenseEditPage, and useFooterDerivedFlags.

cocvn157 avatar Nov 13 '26 02:11 cocvn157

Reproduced on dev: on a workspace where the Cash expense default is set to "Always non-reimbursable" (disabledFields.reimbursable: true, defaultReimbursable: false), cash expenses that are still reimbursable show the Reimbursable toggle when edited individually, but Edit Multiple hides it. Switching back to "Reimbursable by default" makes the row appear.

The cause is the strict disabledFields?.reimbursable === false check in SearchEditMultiplePage.tsx. This also hides the row when the flag is missing, which OldDot and the Rules page treat as unlocked.

@MelvinBot implement this proposal.

Please keep the card handling from #104057.

Also, fix the Billable row the same way. Line 156 has the same strict check (defaultBillable === false), while single-expense editing uses isBillableEnabledOnPolicy.

Add UI tests covering:

  • A missing flag (row shown).
  • A locked workspace where expenses differ from the default (row shown).
  • A locked workspace where expenses match the default (row hidden).
  • A mixed selection (row hidden).

🎀👀🎀 C+ reviewed

Krishna2323 avatar Nov 13 '26 18:11 Krishna2323

Triggered auto assignment to @lakchote, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Nov 13 '26 18:11 melvin-bot[bot]

🤖 Web test steps verification results: ⚠️ partial

Browser verification was blocked by an unavailable web session, not a confirmed product regression. No screenshot is available.

Step Status
Missing flags show both rowsBrowser verification blocked.
⚠️
Locked defaults with differing expenses show both rowsBrowser verification blocked.
⚠️
Expenses matching locked defaults hide rowsBrowser verification blocked.
⚠️
Mixed selections hide rowsBrowser verification blocked.
⚠️
Company-card restrictions remain unchangedBrowser verification blocked; existing automated card tests passed.
⚠️

Created draft PR: Fix bulk expense reimbursable and billable field visibility, assigned to Krishna2323.

  • Updated both rows and preserved card handling.
  • Added nine UI regression cases.
  • 942 targeted tests passed, including all 25 bulk-edit UI tests.
  • Lint, TypeScript, spelling, formatting, Storybook smoke, and direct React Compiler checks passed.
  • Full Jest runs timed out; a complete suite pass is not claimed.

Manual web verification remains outstanding before marking the draft ready for review.


view run · no recording available

MelvinBot avatar Nov 13 '26 19:11 MelvinBot

@Krishna2323

The solution for this issue has been :rocket: deployed to production :rocket: in version 9.5.40-1 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:

  • https://github.com/Expensify/App/pull/106894

If no regressions arise, payment will be issued on 2026-11-25. :confetti_ball:

The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

melvin-bot[bot] avatar Nov 18 '26 00:11 melvin-bot[bot]

@Krishna2323 Eep! 4 days overdue now. Issues have feelings too...

Triggered auto assignment to @mallenexpensify (Awaiting Payment)

Payment Summary

Resolving PRs:

  • https://github.com/Expensify/App/pull/106894

  • Reviewer: @Krishna2323 owed $175 via NewDot

BugZero Checklist (@mallenexpensify)

  • [ ] I have confirmed assignees, roles, and Upwork contracts look correct
  • [ ] I have paid out Upwork contracts / manual NewDot requests
  • [ ] [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon

@mallenexpensify Whoops! This issue is 2 days overdue. Let's get this updated quick!

Matt's AI agent:

Prep notes for the CM. This is not a payment approval. Do not request payment until the CM posts the final amount.

Waiting on C+ checklist from @Krishna2323.

Job price: $175.

  • Krishna2323 (C+): 100%, via NewDot

Price basis: standard, no Help Wanted.

Next: wait for the C+ checklist.

Evidence
  • No TestRail case yet.
  • Resolving PR 106894: MelvinBot, merged 2026-11-14, approved by Krishna2323, mountiny. Videos: author 0/5, C+ 5/5.

PAYPREP v1

mallenexpensify avatar Nov 30 '26 04:11 mallenexpensify

Contributor+ Checklist:

  • [x] [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to the comment on the PR: https://github.com/Expensify/App/pull/84756#discussion_r4736270958 Link to the comment on the Issue: https://github.com/Expensify/App/issues/75617#issuecomment-7272234862

  • [x] [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: N/A

  • [x] [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

Regression Test Proposal

Precondition:

  • Workspace admin on a workspace where Rules > Cash expenses is available.
  • Cash expenses set to Reimbursable by default.
  • Two reimbursable cash expenses on one open report.

Test:

  1. Go to the workspace Rules > Cash expenses and select Always non-reimbursable.
  2. Open the report and open one of the expenses.
  3. Verify that the Reimbursable toggle is shown.
  4. Go back to the report and select both expenses.
  5. Click the selection button > Edit multiple.
  6. Verify that the Reimbursable row is shown.

Do we agree 👍 or 👎

Krishna2323 avatar Nov 30 '26 07:11 Krishna2323

Payment Summary

Contributor+: @Krishna2323 due $175 via NewDot

mallenexpensify avatar Dec 01 '26 00:12 mallenexpensify