You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2025-06-02] [$250] Expense - Unreported expense added to report in offline mode shows negative amount #62367
Version Number: 9.1.47-0 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from TestRail:#62097 Email or phone of affected tester (no customers):applausetester+dsm90d@applause.expensifail.com Issue reported by: Applause Internal Team Device used: Mac 15.4 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Log in with Expensifail account.
Account has self DM and a workspace.
Go to staging.new.expensify.com
Go offline.
Go to self DM.
Track a manual expense in self DM.
Go to workspace chat.
Submit an expense.
Click on the expense preview.
Click More.
Click Add expense > Add unreported expense.
Select the track expense from Step 4.
Click Add to report.
Expected Result:
The unreported expense added to report will not have negative amount.
Actual Result:
The unreported expense added to report in offline mode shows negative amount.
👋 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:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
When a user adds an unreported expense to a report while offline, the expense displays a negative amount. This is confusing and incorrect because the amount should remain positive until the report is properly synced.
What is the root cause of that problem?
The getAmount function applies a negation (-amount) to values when isFromExpenseReport is true. However, it doesn't account for offline mode. In offline mode, unreported expenses are shown in a report context before they are properly associated with a reportID, leading to incorrect application of the report logic and display of a negative amount. here
What changes do you think we should make in order to solve the problem?
We should update the getAmount function to accept an isOffline flag and treat offline transactions similarly to unreported or IOU transactions. Specifically:
If isOffline is true, return the absolute value of the amount, avoiding the negation logic that applies only to fully reported expenses.
@nabi-ebrahimi Since this is a deploy blocker & a regression that is on staging but not prod, I dont think we should be modifying a common method that hasn't been touched. Lets try and find the PR that caused this regression & go from there
Unless its a new issue because of a new feature using this method?
@JS00001@twisterdotcom@nkdengineer 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]
[@akinwale] 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: N/A
[@akinwale] 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.
[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:
The account has an existing self-DM
Test:
Launch Expensify
Go offline
Create a tracked expense (in the self-DM)
Navigate to a workspace chat
Create a new expense
Open the expense report
Click More > Add expense and select Add unreported expense
Select the tracked expense created in step 3
Verify that the amount for the expense in the report is not a negative amount.
Activity
melvin-bot commentedon May 20, 2025
Triggered auto assignment to @JS00001 (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon May 20, 2025
Triggered auto assignment to @twisterdotcom (
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.melvin-bot commentedon May 20, 2025
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 20, 2025
👋 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:
nabi-ebrahimi commentedon May 20, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user adds an unreported expense to a report while offline, the expense displays a negative amount. This is confusing and incorrect because the amount should remain positive until the report is properly synced.
What is the root cause of that problem?
The
getAmountfunction applies a negation (-amount) to values whenisFromExpenseReportis true. However, it doesn't account for offline mode. In offline mode, unreported expenses are shown in a report context before they are properly associated with areportID, leading to incorrect application of the report logic and display of a negative amount. hereWhat changes do you think we should make in order to solve the problem?
We should update the
getAmountfunction to accept anisOfflineflag and treat offline transactions similarly to unreported or IOU transactions. Specifically:isOfflineis true, return the absolute value of the amount, avoiding the negation logic that applies only to fully reported expenses.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
N / A
What alternative solutions did you explore? (Optional)
Screen.Recording.2025-05-20.at.5.29.46.PM.mov
JS00001 commentedon May 20, 2025
@nabi-ebrahimi Since this is a deploy blocker & a regression that is on staging but not prod, I dont think we should be modifying a common method that hasn't been touched. Lets try and find the PR that caused this regression & go from there
Unless its a new issue because of a new feature using this method?
34 remaining items
melvin-bot commentedon May 26, 2025
@JS00001 @twisterdotcom @nkdengineer 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]
akinwale commentedon Jun 2, 2025
@twisterdotcom Could you assign me as the C+ since I reviewed the PR? Thanks.
akinwale commentedon Jun 2, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[@akinwale] 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: Fix adding unreported expense when expense is created in offline mode #62097 (comment)
[@akinwale] 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: N/A
[@akinwale] 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.
[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 👎?
twisterdotcom commentedon Jun 3, 2025
Payment Summary:
akinwale commentedon Jun 3, 2025
@twisterdotcom One more payment due for @nabi-ebrahimi based on this comment.
nabi-ebrahimi commentedon Jun 3, 2025
@twisterdotcom I couldn't find you on Slack. This is my Upwork profile, btw.
https://www.upwork.com/freelancers/~01c641ee7bc16be868
twisterdotcom commentedon Jun 5, 2025
Amazing, offer is here: https://www.upwork.com/nx/wm/offer/107573407. Closing again now as I updated the payment summary.
nabi-ebrahimi commentedon Jun 5, 2025
@twisterdotcom Thanks, I accepted the Offer
JmillsExpensify commentedon Jun 9, 2025
$250 approved for @akinwale