Skip to content

[QA Retest & Close] Tax amount is not negative after splitting expense & selecting non-zero tax rate during split #103723

Closed

Description

@applause-bot

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


Version Number: 9.5.7-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: http://github.com/Expensify/App/pull/102175
Email or phone of affected tester (no customers): jsoidjndoiniodnsjojd@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with negative expense and 0% tax rate.
  4. Open the expense.
  5. Click More > Split.
  6. Click on any split.
  7. Click Tax rate.
  8. Change to 5% rate.
  9. Click Save > Save.
  10. Open the split with 5% tax rate.

Expected Result:

Tax amount will be negative after splitting expense and selecting non-zero tax rate during splitting.

Actual Result:

Tax amount is not negative after splitting expense and selecting non-zero tax rate during splitting.

It only changes to negative after reselecting tax rate on expense details thread.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bandicam.2026-10-12.13-29-16-034.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7283161

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 12, 2026
  2. applause-bot commented on Oct 12, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:

  3. melvin-bot commented on Oct 12, 2026

    @melvin-bot

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

  4. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    @grgia you have been assigned to this deploy blocker because you reviewed the offending PR: #102175

  5. melvin-bot commented on Oct 12, 2026

    @melvin-bot

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

  6. github-actions commented on Oct 12, 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.
  7. MelvinBot commented on Oct 12, 2026

    @MelvinBot
    Contributor

    Deploy Blocker Analysis

    Causing PR: Show negative tax amount for negative expenses on the expense details page. It exposed this bug but didn't create it.

    Root cause: When you save a single split, updateSplitExpenseField forces the split's tax to be positive at src/libs/actions/IOU/SplitExpenseItems.ts:900: taxAmount: Math.abs(transactionDetails?.taxAmount ?? 0). Production has the same line, so refund splits have already been saved with the wrong tax sign. Before the causing PR, the expense details page wrapped tax in Math.abs(), which hid the error. That PR removed the wrapper at MoneyRequestView.tsx:380.

    Recommendation: roll forward. Reverting the causing PR would hide the split bug again and bring back the positive-tax display bug it fixed. In updateSplitExpenseField, set the tax sign from the split's final amount. Do this after the distance recalculation (lines 907-922):

    const absTaxAmount = Math.abs(transactionDetails?.taxAmount ?? 0);
    updatedItem.taxAmount = updatedItem.amount < 0 ? -absTaxAmount : absTaxAmount;

    Add a test in tests/actions/IOU/SplitExpenseItemsTest.ts: a split with amount: -500 and a 5% tax rate should end with a negative taxAmount.

    Investigation details

    How the wrong sign reaches the UI

    1. All other split paths in SplitExpenseItems.ts keep the tax sign the same as the amount sign. Lines 447, 640, 755, and 975 use calculateTaxAmount(taxValue, signedAmount, …). Only line 900 strips the sign. A -$10 split at 5% gets taxAmount: +48 next to amount: -1000.
    2. SplitTransactionUpdate.ts:662-663 passes that value to getMoneyRequestInformation. MoneyRequestBuilder.ts:1568 then negates it for expense reports, so the stored value is -48. The value sent to the API at SplitTransactionUpdate.ts:366 has the same wrong sign.
    3. getTaxAmount() flips the stored sign, so the split shows +$0.48.

    Why re-picking the tax rate on the expense thread fixes it: That path calls updateMoneyRequestTaxRate with the real stored transaction (DynamicIOURequestStepTaxRatePage.tsx:159,180), and that function sets the sign correctly.

    Why tie the sign to the amount instead of just deleting Math.abs: In the split tax-rate step, the draft amount is flipped by getAmount(…, false, true), and getTransactionDetails(draft) flips it back. Deleting Math.abs works only because those two flips cancel. It would break if the draft's reportID were not an expense report.

    Other checklist PRs ruled out

    Confidence: High, based on code tracing. I didn't reproduce the bug in the app.

    Demoting: The wrong sign already exists in production, so demoting is reasonable if a quick fix isn't possible. Tax totals are still incorrect, so fixing it is better.

  8. changed the title [-]Tax amount is not negative after splitting expense & selecting non-zero tax rate during split[/-] [+][QA Retest & Close] Tax amount is not negative after splitting expense & selecting non-zero tax rate during split[/+] on Oct 12, 2026
  9. kavimuru commented on Oct 12, 2026

    @kavimuru

    Reverted #103763

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

Metadata

Metadata

Assignees

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions