Skip to content

Expense - Tax field present in cross policy bulk edit, despite one WS having taxes disabled #84678

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.34.0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #82948
Email or phone of affected tester (no customers): ibellicotest+2250@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Search

Action Performed:

Prerequisite: Account has two workspaces.
Prerequisite 2: Workspace 1 has taxes enabled and workspace 2 has taxes disabled.

  1. Open the Expensify app.
  2. Open a workspace with taxes enabled.
  3. Create a manual expense and select any tax rate during creation.
  4. Navigate to a different workspace with taxes disabled.
  5. Create another manual expense.
  6. Navigate to "Reports" > "Expenses"
  7. Select both expenses, tap on dropdown menu and select "Edit Multiple"
  8. Note that "Tax Rate" field is available despite one of the expenses not having taxes enabled.
  9. Tap on "Tax Rate"
  10. Note that all the taxes from Workspace 1 are displayed.

Expected Result:

"Tax rate" field should not be available during cross policy bulk edit, if one of the workspaces has "Taxes" disabled.

Actual Result:

"Tax Rate" field is available and editable during cross policy bulk edit, despite one of the workspaces having "Taxes" disabled.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Activity

  1. added
    DeployBlockerCash
    Bug
    on Mar 10, 2026
  2. melvin-bot commented on Mar 10, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #82948

  3. melvin-bot commented on Mar 10, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. melvin-bot commented on Mar 10, 2026

    @melvin-bot

    Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  5. github-actions commented on Mar 10, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. OSBotify commented on Mar 10, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #82948 - "Reapply "Feat: bulk edit multiple"" by @pasyukevich (High confidence)
    Related Issues: None

    Recommendation: ROLL FORWARD

    The issue is straightforward to fix and a revert would remove the entire bulk edit feature. The fix requires checking if tax tracking is enabled for ALL workspaces involved in the bulk edit, not just the active workspace.

    Labels: This is reproducible only on staging (not in production as this is a new feature), and the bug is in the App repository. Therefore, I am removing the DeployBlockerCash label as this does not block the mobile app deploy, but keeping DeployBlocker for the backend/web deploy.

    📋 Detailed Analysis

    Evidence

    PR #82948 introduced the bulk edit multiple expenses feature. The issue was explicitly linked to this PR by melvin-bot in the first comment. The bug appears when:

    1. User has two workspaces
    2. Workspace 1 has taxes enabled
    3. Workspace 2 has taxes disabled
    4. User selects expenses from both workspaces and opens "Edit Multiple"
    5. Tax Rate field appears and shows taxes from Workspace 1

    Verification

    I examined the code in /home/runner/_work/App/App/src/pages/Search/SearchEditMultiple/SearchEditMultiplePage.tsx lines 87-89:

    const isTaxTrackingEnabled = !hasPerDiemOrTimeTransaction && !!policy?.tax?.trackingEnabled;
    const areCategoriesEnabled = !!policy?.areCategoriesEnabled && hasEnabledOptions(policyCategories ?? {});
    const areTagsEnabled = !!policy?.areTagsEnabled && hasEnabledTags(policyTagLists);

    The policy variable comes from getSearchBulkEditPolicyID() which returns the active policy ID when expenses are from different workspaces. This means it only checks ONE workspace for tax tracking.

    Compare this to the correct pattern used for billable/reimbursable fields (lines 72-78):

    const areSelectedTransactionsBillable = selectedTransactionContexts.every(
        ({transaction, transactionPolicy}) => transactionPolicy?.disabledFields?.defaultBillable === false || !!transaction.billable,
    );
    
    const areSelectedTransactionsReimbursable = selectedTransactionContexts.every(
        ({transaction, report, transactionPolicy}) => !isIOUReport(report) && transactionPolicy?.disabledFields?.reimbursable === false && !isManagedCardTransaction(transaction),
    );

    These correctly use .every() to check ALL transactions policies.

    Root Cause

    The isTaxTrackingEnabled logic only checks a single workspace policy for tax tracking, rather than verifying that ALL selected expenses belong to workspaces with tax tracking enabled. When doing cross-policy bulk edit:

    1. If the active workspace has taxes enabled, the tax field shows
    2. But some selected expenses may be from a workspace with taxes disabled
    3. This allows editing tax on expenses that should not have tax fields

    The fix should check that ALL involved workspaces have tax tracking enabled, similar to the billable/reimbursable pattern:

    const isTaxTrackingEnabled = !hasPerDiemOrTimeTransaction && selectedTransactionContexts.every(
        ({transactionPolicy}) => !!transactionPolicy?.tax?.trackingEnabled
    );
  7. OSBotify commented on Mar 10, 2026

    @OSBotify
    Contributor

    Label Decision: The DeployBlockerCash label was added by an internal Expensify employee (@jponikarchuk), so I will not remove it per the investigation guidelines. However, based on the analysis, this is a frontend bug in the App repository caused by PR #82948. The recommended approach is to roll forward with a fix rather than revert the entire bulk edit feature.

  8. MelvinBot commented on Mar 10, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When a user selects expenses from two different workspaces (one with taxes enabled, one with taxes disabled) and opens "Edit Multiple," the Tax Rate field is shown and editable. It should not appear if any selected expense belongs to a workspace with taxes disabled.

    What is the root cause of that problem?

    When selected transactions span multiple policies, getSearchBulkEditPolicyID() in src/libs/SearchUIUtils.ts falls back to the user's activePolicyID (their current workspace) instead of checking each transaction's actual policy.

    SearchEditMultiplePage.tsx:87 then uses that single fallback policy to decide tax field visibility:

    const isTaxTrackingEnabled = !hasPerDiemOrTimeTransaction && !!policy?.tax?.trackingEnabled;
    

    So if the user's active workspace has taxes enabled, the Tax Rate field appears for all selected transactions — even those belonging to a workspace with taxes disabled. The single-expense view (MoneyRequestView.tsx:415) correctly checks each transaction's own policy via isTaxTrackingEnabled(), but the bulk edit page does not replicate this per-transaction check.

    Additionally, canEditFieldOfMoneyRequest in ReportUtils.ts treats TAX_RATE as a non-restricted field (it's not in the restrictedFields array), so there is no secondary safety net that would catch this.

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

    In SearchEditMultiplePage.tsx, instead of deriving isTaxTrackingEnabled from the single fallback policy, check whether all selected transactions' policies have tax tracking enabled. If any transaction's policy has tax.trackingEnabled === false (or undefined), the Tax Rate field should be hidden.

    This can be done by iterating selectedTransactionContexts (which already contains each transaction's transactionPolicy) and verifying every policy has tax.trackingEnabled set to true — similar to how areSelectedTransactionsReimbursable already iterates all selected transactions at line 76-78 of the same file.

    The same pattern (single fallback policy) also affects areCategoriesEnabled and areTagsEnabled on lines 88-89, but those are separate issues.

    What alternative solutions did you explore? (Optional)

    An alternative would be to add TAX_RATE to the restrictedFields array in canEditFieldOfMoneyRequest and add a per-transaction isTaxTrackingEnabled check there. However, this would only control the disabled/enabled state of the field, not its visibility. The more direct and consistent fix is to check all policies in SearchEditMultiplePage.tsx where field visibility is determined.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  9. added
    Reviewing
    on Mar 10, 2026
  10. IuliiaHerets commented on Mar 10, 2026

    @IuliiaHerets

    Chrome / 9.3.34-1
    No Edit multiple option

    Screen.Recording.2026-03-10.at.19.10.22.mp4
  11. removed
    DeployBlockerCash
    on Mar 10, 2026
  12. added
    Daily
    and removed
    Hourly
    on Mar 17, 2026
  13. melvin-bot commented on Mar 24, 2026

    @melvin-bot

    @garrettmknight, @marcaaron Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  14. melvin-bot commented on Mar 26, 2026

    @melvin-bot

    @garrettmknight, @marcaaron Huh... This is 4 days overdue. Who can take care of this?

  15. garrettmknight commented on Mar 27, 2026

    @garrettmknight
    Contributor

    It's being reviewed, Melv.

  16. melvin-bot commented on Apr 3, 2026

    @melvin-bot

    @garrettmknight, @marcaaron Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  17. garrettmknight commented on Apr 7, 2026

    @garrettmknight
    Contributor

    Kk, we're on prod! #84756 seems to have fixed it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDailyEngineeringReviewing

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions