Skip to content

[QA Retest & Close] Expense - Negative tax amount is not retained after unreporting expense #103665

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: #102175
Email or phone of affected tester (no customers): sidjosdiojsojo@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:

Precondition:

  • Enable Taxes.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with negative amount.
  4. Open the report.
  5. Change tax rate to non-zero rate.
  6. Click Report field.
  7. Click Remove from report.
  8. Go to self DM.
  9. Open the expesne.

Expected Result:

Negative tax amount will be retained after unreporting expense.

Actual Result:

Negative tax amount is not retained after unreporting expense.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7282537_1791580064780.2.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Svetlana Lazutkina
Bug ID: 7282537

Upwork Automation - Do Not Edit

Activity

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

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/cf9ff3e4eb89caa74bcab8d8d278ce6403a20ed8a7fc49826c87452a95e91194

  3. melvin-bot commented on Oct 9, 2026

    @melvin-bot

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

  4. melvin-bot commented on Oct 9, 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 9, 2026

    @melvin-bot

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

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

    @MelvinBot
    Contributor

    Deploy Blocker Analysis

    Causing PR: Show negative tax amount for negative expenses on the expense details page. The PR only covered expenses on a report. Unreported (self DM) expenses still show a positive tax, which is also what production shows today.

    Recommendation: Demote this issue and fix it forward. Don't revert.

    • The bug only affects what's displayed. Stored data and totals don't change.
    • A revert would show a positive tax on the report view again. That removes the PR's fix and makes nothing correct.

    Root cause: The expense details page sets the sign of the amount and the tax in different ways (ReportUtils.ts:5643-5650):

    • The amount gets an "is unreported" flag (reportID === UNREPORTED_REPORT_ID), so getAmount flips the sign and shows a negative value.
    • The tax goes through getTaxAmount(transaction, isFromExpenseReport) with no such flag. For an unreported expense, isFromExpenseReport is false because there's no report and MoneyRequestView.tsx:347 passes no policy. So normalizeTaxAmountSign returns Math.abs(), which shows a positive value.

    Recommended fix:

    1. Add an isFromTrackedExpense parameter to normalizeTaxAmountSign / getTaxAmount (and getConvertedTaxAmount), matching getAmount.
    2. In getTransactionDetails, pass transaction?.reportID === CONST.REPORT.UNREPORTED_REPORT_ID for taxAmount and convertedTaxAmount.
    3. Add a test in tests/ui/MoneyRequestViewTest.tsx for a negative unreported expense with tax.
    Investigation details
    • Unreported expenses store amounts with the flipped sign, just like expense reports. See the comment on getTransactionDisplayAmount. changeTransactionsReport doesn't change amount or taxAmount when an expense is removed from a report.
    • PR 102175 removed Math.abs() from formattedTaxAmount (MoneyRequestView.tsx:380) and relied on getTaxAmount for the sign. The Math.abs() branch for non-report expenses already existed; the PR only moved it into normalizeTaxAmountSign.
    • The result is that the tax shows negative on the report, then positive after Remove from report. Before the PR, both screens showed a positive tax.
    • Other places call getTaxAmount: SplitExpenseItems.ts, SearchUIUtils.ts, and the modified-expense message in ReportUtils.ts. Check them before you change the helper's signature.
    • Not verified: I didn't test this in a live app. A QA check that the self DM shows a positive tax, the same as production, would confirm this isn't a regression.

    Next Steps: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.


    view run

  8. bernhardoj commented on Oct 10, 2026

    @bernhardoj
    Contributor

    @MelvinBot implement this

    Also pass it to getTaxAmount in getTransactionSortValue

  9. MelvinBot commented on Oct 10, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: Keep the negative tax amount sign for unreported expenses
    Please mark it as "Ready for review" or ask me to do that for you when it is ready for review.

    It implements the proposed fix and also passes the unreported flag to getTaxAmount in getTransactionSortValue, as you asked. I added unit tests for the tax helpers, getTransactionDetails and getTransactionSortValue. The related unit, UI and IOU test suites, typecheck, lint and spell check pass. I didn't test it in the app.


    view run

  10. changed the title [-]Expense - Negative tax amount is not retained after unreporting expense[/-] [+][$175] Expense - Negative tax amount is not retained after unreporting expense[/+] on Oct 10, 2026
  11. melvin-bot commented on Oct 10, 2026

    @melvin-bot
  12. grgia commented on Oct 12, 2026

    @grgia
    Contributor

    Offending PR reverted

  13. changed the title [-][$175] Expense - Negative tax amount is not retained after unreporting expense[/-] [+][QA Retest & Close] Expense - Negative tax amount is not retained after unreporting expense[/+] on Oct 12, 2026
  14. kavimuru commented on Oct 12, 2026

    @kavimuru

    @cristipaval After changing tax rate, amount in report expense remains positive PR reverted

    bandicam.2026-10-12.15-02-49-107.mp4
  15. izarutskaya commented on Oct 13, 2026

    @izarutskaya

    Tax amount is not negative either before and after remove from report
    Chrome / v9.5.7-3

    Recording.4028.mp4
    bandicam.2026-10-13.11-18-51-334.mp4
  16. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions