Skip to content

[Due for payment 2026-09-04] Negative expenses don't appear in the "Add Expenses" field on draft reports #98425

Closed

Description

@m-natarajan

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


Version Number: 9.4.52-9
Reproducible in staging?: Y
Reproducible in production?: Y
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: @Justin-Hayes-PH
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Have negative expense in Unreported status (Create negative expense in Self DM)
  2. Navigate to Spend > Expenses > +Create > Create Report
  3. Add Expenses > Existing Expenses

Expected Result:

All Unreported expenses show here

Actual Result:

Only expenses with a positive value appear there, expenses that are negative are excluded.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Select the officially supported platforms where the issue was reproduced:

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

Screenshots/Videos

Recording.3352.mp4

View all open jobs on GitHub

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

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 12, 2026
  2. MelvinBot commented on Aug 12, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The "Add Expenses → Existing Expenses" list explicitly filters out any unreported expense whose amount is negative.

    In src/pages/AddExistingExpense.tsx:124-127, the eligibility filter has this rule:

    Only block negative amounts for unreported expenses.

    // Only block negative amounts for unreported expenses.
    if (transactionAmount < 0 && isUnreported) {
        return false;
    }

    Because the negative expense created in the Self DM is unreported (isUnreported === true) and its amount is negative, it is dropped before the list is rendered — so only positive-value unreported expenses appear. This matches the reported symptom exactly.

    Note the guard applies to every target report type. The very next line already restricts the zero-amount exclusion to IOU reports only (isIOU && transactionAmount === 0), but the negative-amount exclusion is not scoped that way, so it also removes negative expenses when the target is a regular expense report (the flow in this issue: Spend → Expenses → +Create → Create Report). Negative expenses (credits/refunds) are legitimate on expense reports; they are only invalid on IOU/money-request reports.

    Why this is the right code path & related sign nuance

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

    Scope the negative-amount exclusion to IOU reports only, mirroring the existing zero-amount rule, so negative unreported expenses remain selectable when the target is an expense report.

    In src/pages/AddExistingExpense.tsx:124-132, replace the separate "negative when unreported" and "zero when IOU" guards with a single guard that blocks amounts <= 0 only for IOU reports (isIOU). This keeps negative amounts out of money-request/IOU reports (where they are invalid) while allowing them into expense reports.

    What alternative solutions did you explore? (Optional)

    • Remove the negative guard entirely — not recommended, since negative amounts should still be blocked for IOU reports.
    • Fix by amount sign only — insufficient, because the intent is report-type-dependent (allowed on expense reports, not on IOU).

    Confidence: Medium — root cause is pinned to a specific return false in the eligibility filter with clear code evidence; the exact scoping of the fix (IOU-only) should be confirmed against the original intent of the guard by a reviewer familiar with the Add-Existing-Expense flow.

    Related issue: #98268 — negative amounts rendering as positive in the same RHP (sign-handling in this area).


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/blob/ed3f5b11eddf68f52130fcade87d47f826bf5467/src/pages/AddExistingExpense.tsx#L124-L127) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 12, 2026
  4. j3ffffff commented on Aug 12, 2026

    @j3ffffff
  5. melvin-bot commented on Aug 12, 2026

    @melvin-bot

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

  6. melvin-bot commented on Aug 12, 2026

    @melvin-bot
  7. trjExpensify commented on Aug 12, 2026

    @trjExpensify
    Contributor

    @nyomanjyotisa can you help me understand why we added this condition in your PR? #89357

    It's a valid business case for a user to have negative unreported expenses (i.e a chargeback or something) and need to add that to their report. I totally agree we don't want to extend that to expenses on IOUReports used for P2P, but this doesn't seem right.

  8. nyomanjyotisa commented on Aug 13, 2026

    @nyomanjyotisa
    Member

    @trjExpensify You’re right. The original issue behind #72552 was specifically about preventing negative expenses from being added to IOU reports. In #89357, I preserved #72552’s broader implementation and test and overlooked that original scope and the later clarification. Negative expenses should be allowed on expense reports and blocked only on IOU reports. Sorry for the oversight.

  9. trjExpensify commented on Aug 13, 2026

    @trjExpensify
    Contributor

    Do you mind working on a PR to rectify this?

  10. nyomanjyotisa commented on Aug 13, 2026

    @nyomanjyotisa
    Member

    Sure, I’ll work on a PR.

  11. 19 remaining items

  12. FitseTLT commented on Sep 3, 2026

    @FitseTLT
    Contributor

    @mallenexpensify Pls also consider the extra bug I fixed here confirmed and fixed in pr. Thx

  13. madmax330 commented on Sep 7, 2026

    @madmax330
    Contributor

    Not overdue, waiting on payment

  14. melvin-bot commented on Sep 8, 2026

    @melvin-bot

    @mallenexpensify Huh... This is 4 days overdue. Who can take care of this?

  15. mallenexpensify commented on Sep 8, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @nyomanjyotisa due $250 via NewDot
    Contributor+: @FitseTLT due $375 via NewDot

    @FitseTLT $125 on the followup PR cuz no tests needed.

  16. mallenexpensify commented on Sep 8, 2026

    @mallenexpensify
    Contributor

    @nyomanjyotisa are you due payment too? I couldn't quite tell cuz it looked like this came from a PR you worked on, per

    @nyomanjyotisa can you help me understand why we added this condition in your PR? #89357

  17. nyomanjyotisa commented on Sep 9, 2026

    @nyomanjyotisa
    Member

    @mallenexpensify I believe so. I authored #98627 after Tom asked me to fix it. #89357 was deployed on May 4, and #98425 was reported on August 12, outside the seven-day regression period.

  18. added and removed on Sep 9, 2026
  19. mallenexpensify commented on Sep 9, 2026

    @mallenexpensify
    Contributor

    wow... this one is a lil confusing cuz the second PR was linked in the OP to the first PR. I think I the payment above is correct. Think we're good to close, comment or reopen if you disagree.

  20. trjExpensify commented on Sep 10, 2026

    @trjExpensify
    Contributor

    approved $250 for @nyomanjyotisa

  21. flaviadefaria commented on Sep 11, 2026

    @flaviadefaria
    Contributor

    Approved: @FitseTLT due $375 via NewDot

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions