Skip to content

[Due for payment 2025-07-22] [$250] Expense - LHN does not show report total after adding unreported expenses to the report #64563

Closed

Description

@mitarachim

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.1.69-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/6315066
Email or phone of affected tester (no customers): applausetester+sud90n@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.5 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Account has self DM.
  1. Go to staging.new.expensify.com
  2. Go to self DM.
  3. Submit two track expenses with merchant in self DM.
  4. Go to workspace chat.
  5. Click + > Create report.
  6. Click Add expense > Add unreported expense.
  7. Select the two track expenses from Step 3.
  8. Click Add to report.

Expected Result:

Workspace chat preview in LHN will show the report total, which is the sum of the two track expenses.

Actual Result:

Workspace chat preview in LHN only shows the amount of one of the track expenses.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6864618_1750340632842.20250619_213833.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021937302836776083924
  • Upwork Job ID: 1937302836776083924
  • Last Price Increase: 2025-07-01
  • Automatic offers:
    • brunovjk | Reviewer | 107904954
    • FitseTLT | Contributor | 107904955
Issue OwnerCurrent Issue Owner: @johncschuster

Activity

  1. added
    Daily
    Bug
    on Jun 19, 2025
  2. melvin-bot commented on Jun 19, 2025

    @melvin-bot

    Triggered auto assignment to @johncschuster (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.

  3. FitseTLT commented on Jun 19, 2025

    @FitseTLT
    Contributor

    Proposal

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

    Expense - LHN does not show report total after adding unreported expenses to the report

    What is the root cause of that problem?

    To get the last message text for report we pass the last iou action of the iou report here

    const iouReport = getReportOrDraftReport(getIOUReportIDFromReportActionPreview(lastReportAction));
    const lastIOUMoneyReportAction = iouReport?.reportID
    ? allSortedReportActions[iouReport.reportID]?.find(
    (reportAction, key): reportAction is ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.IOU> =>
    shouldReportActionBeVisible(reportAction, key, canUserPerformWriteAction(report)) &&
    reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE &&
    isMoneyRequestAction(reportAction),
    )
    : undefined;
    const reportPreviewMessage = getReportPreviewMessage(
    !isEmptyObject(iouReport) ? iouReport : null,
    lastIOUMoneyReportAction ?? lastReportAction,
    true,
    reportUtilsIsChatReport(report),
    null,
    true,
    lastReportAction,

    and here we return tracking copy with the amount of the the iou tracked expense action

    App/src/libs/ReportUtils.ts

    Lines 4526 to 4544 in 2fa04d3

    if (!isEmptyObject(iouReportAction) && !isIOUReport(report) && iouReportAction && isTrackExpenseAction(iouReportAction)) {
    // This covers group chats where the last action is a track expense action
    const linkedTransaction = getLinkedTransaction(iouReportAction);
    if (isEmptyObject(linkedTransaction)) {
    return reportActionMessage;
    }
    if (!isEmptyObject(linkedTransaction)) {
    if (isScanning(linkedTransaction)) {
    return translateLocal('iou.receiptScanning', {count: 1});
    }
    if (hasMissingSmartscanFieldsTransactionUtils(linkedTransaction)) {
    return translateLocal('iou.receiptMissingDetails');
    }
    const amount = getTransactionAmount(linkedTransaction, !isEmptyObject(report) && isExpenseReport(report)) ?? 0;
    const formattedAmount = convertToDisplayString(amount, getCurrency(linkedTransaction)) ?? '';
    return translateLocal('iou.trackedAmount', {formattedAmount, comment: getMerchantOrDescription(linkedTransaction)});

    so we don't see the total amount

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

    We should avoid isExpenseReports just like we are checking for !isIOUReport here

    if (!isEmptyObject(iouReportAction) && !isIOUReport(report) && iouReportAction && isTrackExpenseAction(iouReportAction)) {

        if (!isEmptyObject(iouReportAction) && !isIOUReport(report) && !isExpenseReport(report) && iouReportAction && isTrackExpenseAction(iouReportAction)) {
    

    If needed can consider adding the same condition for the split logic here too

    On additional note: when we add unreported expenses the report will have non-reimbursable transactions so return spent copy here

    App/src/libs/ReportUtils.ts

    Lines 4637 to 4639 in 2fa04d3

    if (containsNonReimbursable) {
    return translateLocal('iou.payerSpentAmount', {payer: getDisplayNameForParticipant({accountID: report.ownerAccountID}) ?? '', amount: formattedAmount});
    }

    that might be wrong especially if the workspace has submit enabled and the report hasn't been submitted so we can consider returning some other copy for the case of containsNonReimbursable if the report status is 0 but the exact copy should be suggested by the internal team. (it can be tracked copy may be)

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    If needed we can add a test for getLastMessageTextForReport to assert that it returns the correct copy for report preview which contain tracked expenses.

    What alternative solutions did you explore? (Optional)

  4. melvin-bot commented on Jun 23, 2025

    @melvin-bot

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

  5. added
    External
    on Jun 24, 2025
  6. changed the title [-]Expense - LHN does not show report total after adding unreported expenses to the report[/-] [+][$250] Expense - LHN does not show report total after adding unreported expenses to the report[/+] on Jun 24, 2025
  7. melvin-bot commented on Jun 24, 2025

    @melvin-bot
  8. added
    Help Wanted
    on Jun 24, 2025
  9. melvin-bot commented on Jun 24, 2025

    @melvin-bot

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

  10. 24 remaining items

  11. added
    Awaiting Payment
    on Jul 15, 2025
  12. changed the title [-][$250] Expense - LHN does not show report total after adding unreported expenses to the report[/-] [+][Due for payment 2025-07-22] [$250] Expense - LHN does not show report total after adding unreported expenses to the report[/+] on Jul 15, 2025
  13. melvin-bot commented on Jul 15, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  14. removed
    Reviewing
    on Jul 15, 2025
  15. melvin-bot commented on Jul 15, 2025

    @melvin-bot

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

    If no regressions arise, payment will be issued on 2025-07-22. 🎊

    For reference, here are some details about the assignees on this issue:

  16. melvin-bot commented on Jul 15, 2025

    @melvin-bot

    @brunovjk @johncschuster The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero 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]

  17. johncschuster commented on Jul 15, 2025

    @johncschuster
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment:

    • [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:

    • [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 Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    Do we agree 👍 or 👎

  18. added
    Daily
    and removed
    Weekly
    on Jul 21, 2025
  19. johncschuster commented on Jul 21, 2025

    @johncschuster
    Contributor

    Payment Summary

    Contributor: @FitseTLT paid $250 via Upwork ✅
    Contributor+: @brunovjk paid $250 via Upwork ✅

  20. brunovjk commented on Jul 21, 2025

    @brunovjk
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other: Applause Internal Team
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: Add unreportedExpense to report page #60352 (comment)

    • [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:

    • [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

    Tests

    Precondition:

    Account has self DM.

    1. Go to self DM.
    2. Submit two track expenses with merchant in self DM.
    3. Go to workspace chat.
    4. Click + Create report.
    5. Click Add expense Add unreported expense.
    6. Select the two track expenses from Step 3.
    7. Click Add to report.
    8. Workspace chat preview in LHN will show the report total, which is the sum of the two track expenses.

    Do we agree 👍 or 👎

  21. added
    Daily
    and removed
    Daily
    on Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions