App icon indicating copy to clipboard operation
App copied to clipboard

[$300] Expense - Incorrect Total amount is shown after deleting split expense

Open jponikarchuk opened this issue 2 months ago • 30 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: V9.2.61-4 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Exploratory Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Device used: Redminote 10s android 13 App Component: Money Requests

Action Performed:

  1. Go to
  2. Login with new gmail account
  3. Create a new workspace
  4. Open workpace chat
  5. Create a empty report
  6. Add a manual expense ₹4
  7. Open the expense and tap more
  8. Create a new manual expense for ₹4
  9. Open the expense and tap more
  10. Select Split and complete the flow
  11. Open the second split expense
  12. Tap header - delete the expense

Expected Result:

The report Total should be properly calculated to reflect the new amount after deleting the split expense.

Actual Result:

The report Total is incorrect.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

https://github.com/user-attachments/assets/9d80b173-7b8a-4499-96a9-91fb50ef1e43

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021993040190076850888
  • Upwork Job ID: 1993040190076850888
  • Last Price Increase: 2025-12-10
  • Automatic offers:
    • situchan | Reviewer | 109835299
Issue OwnerCurrent Issue Owner: @robertjchen

jponikarchuk avatar Nov 21 '25 08:11 jponikarchuk

Triggered auto assignment to @brianlee-expensify (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[bot] avatar Nov 21 '25 08:11 melvin-bot[bot]

@jponikarchuk i rephrased your "expected result" and "actual result" sections in the OP, but i think it still needs more clarification:

  • what is the incorrect system message?
  • what is the expected/correct system message?

brianlee-expensify avatar Nov 24 '25 01:11 brianlee-expensify

@brianlee-expensify The total amount was initially ₹6 but briefly changed to ₹8. The user did not modify the amount; they only deleted a split expense. However, the system message incorrectly indicates that the amount was changed.

jponikarchuk avatar Nov 24 '25 13:11 jponikarchuk

Job added to Upwork: https://www.upwork.com/jobs/~021993040190076850888

melvin-bot[bot] avatar Nov 24 '25 19:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 24 '25 19:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 28 '25 00:11 melvin-bot[bot]

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 01 '25 16:12 melvin-bot[bot]

asking in slack regarding next steps

brianlee-expensify avatar Dec 03 '25 16:12 brianlee-expensify

asking for repro first

brianlee-expensify avatar Dec 03 '25 18:12 brianlee-expensify

Reproduce, MacOS Monterey / Chrome, Xiaomi Redmi Note 10 / Android 12mWeb, Xiaomi Redmi Note 10 / Android 12, Web v9.2.71-2

https://github.com/user-attachments/assets/275fb838-946c-40bf-9375-5f79845caacb

https://github.com/user-attachments/assets/03ea972c-11a2-48ee-a1fd-7961281dd4cf

https://github.com/user-attachments/assets/425c4bb5-5cc8-417d-aa97-c3bb014ff560

m-natarajan avatar Dec 03 '25 19:12 m-natarajan

interesting, thanks @m-natarajan - adding some notes here:

  1. 1st recording @ 1:48 - amount is correct now, but the system message is still incorrect (should be about deleting the split expense, not changing the amount)
  2. 2nd recording @ 1:48 - total amount and currency are both incorrect (should be INR 8.00, not UAH 3.76). confirmed that changing currency preference at workspace level did not apply changes as hoped for the report "Expense Report 2025-12-03"
  3. 2nd recording @ 2:15 - deleting one of the split expenses still did not update the total amount and currency (should be INR 6.00, not UAH 3.76) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)
  4. 3rd recording @ 2:27 - deleting one of the split expenses temporarily showed the correct total amount and currency (INR 6.00), but immediately changed to the incorrect amount (INR 8.00) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)

also tested myself on prod, the total amount is incorrect

Image

will verify with engineering about the system message in this slack thread

brianlee-expensify avatar Dec 03 '25 19:12 brianlee-expensify

@brianlee-expensify 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

melvin-bot[bot] avatar Dec 04 '25 00:12 melvin-bot[bot]

update on Dec 4: verified with engineering about the system message in this slack thread - it is indeed correct that it should be about changing the amount, not deleting the split expense @jponikarchuk

rephrasing what's correct/incorrect below from this previous comment:

  1. 1st recording @ 1:48 - amount is correct now, but the system message is still incorrect (should be about deleting the split expense, not changing the amount)
  • both the amount and system message are correct now
  1. 2nd recording @ 1:48 - total amount and currency are both incorrect (should be INR 8.00, not UAH 3.76). confirmed that changing currency preference at workspace level did not apply changes as hoped for the report "Expense Report 2025-12-03"
  • confirming whether changing currency at workspace level only applies to new expenses created from that point on (slack thread)
  1. 2nd recording @ 2:15 - deleting one of the split expenses still did not update the total amount and currency (should be INR 6.00, not UAH 3.76) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)
  • system message is correct
  • confirming whether changing currency at workspace level only applies to new expenses created from that point on (slack thread)
  1. 3rd recording @ 2:27 - deleting one of the split expenses temporarily showed the correct total amount and currency (INR 6.00), but immediately changed to the incorrect amount (INR 8.00) and still showed the incorrect system message (should be about deleting the split expense, not changing the amount)
  • system message is correct, but the total amount is still incorrect

updating the title and original body of this GH to reflect these changes

brianlee-expensify avatar Dec 04 '25 19:12 brianlee-expensify

@situchan @brianlee-expensify this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Dec 05 '25 21:12 melvin-bot[bot]

Awaiting proposals

situchan avatar Dec 08 '25 02:12 situchan

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

melvin-bot[bot] avatar Dec 08 '25 16:12 melvin-bot[bot]

awaiting proposals

brianlee-expensify avatar Dec 09 '25 00:12 brianlee-expensify

Upwork job price has been updated to $300

melvin-bot[bot] avatar Dec 10 '25 22:12 melvin-bot[bot]

I'm Maciej from Callstack - expert contributor group. The issue is confirmed, I can take this job.

leshniak avatar Dec 11 '25 18:12 leshniak

📣 @situchan 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link Upwork job

melvin-bot[bot] avatar Dec 16 '25 16:12 melvin-bot[bot]

Not overdue

situchan avatar Dec 16 '25 16:12 situchan

@brianlee-expensify Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Dec 16 '25 23:12 melvin-bot[bot]

@leshniak any updates here?

brianlee-expensify avatar Dec 17 '25 23:12 brianlee-expensify

Sorry for the lack of updates. I have few clues:

  • the issue disappear after refreshing the app (the total amount looks fine),
  • there is probably some discrepancy between optimistic and success data in the communication with API.

I am currently analyzing IOU.ts file and updateSplitTransactions function in reverse split operation flow, but the amount of things going on here is a bit overwhelmed for me right now - I'm just started with the project. I've asked the Callstack team for help.

leshniak avatar Dec 18 '25 09:12 leshniak

Proposal

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

After adding an expense to the report, then splitting it and deleting one of its parts, the total amount of the report does not update. Image

What is the root cause of that problem?

According to the logic in updateSplitTransactions() from IOU.ts, deleting the second-to-last part of a split expense triggers the WRITE_COMMANDS.REVERT_SPLIT_TRANSACTION API method, which converts the last remaining part into a regular expense. The API response returns, among other things, a new total value for the report, but it is not updated to reflect the deleted parts of the split expense (in other words, it likely still includes the value of the original expense from before the split operation). On the other hand, the unheldTotal value is set correctly. Image

The total value in the optimistic UI variant is set correctly, but then it gets overwritten by the value from the backend.

The problem does not occur after reopening the report.

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

The backend logic for WRITE_COMMANDS.REVERT_SPLIT_TRANSACTION should be updated so the returned report total is correct after a split is reverted.

What alternative solutions did you explore? (Optional)

If the total value at the time WRITE_COMMANDS.REVERT_SPLIT_TRANSACTION is called via the API is correct, then a resynchronization with the backend should be performed in a different or additional way.

leshniak avatar Dec 18 '25 12:12 leshniak

@leshniak @situchan @brianlee-expensify this issue is now 4 weeks old, please consider:

  • Finding a contributor to fix the bug
  • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

melvin-bot[bot] avatar Dec 19 '25 21:12 melvin-bot[bot]

@leshniak Eep! 4 days overdue now. Issues have feelings too...

melvin-bot[bot] avatar Dec 23 '25 23:12 melvin-bot[bot]

Agree with @leshniak's analysis. The issue is in backend.

Optimistic total amount is correct and becomes wrong when online. As seen in this video, that incorrect amount is corrected again only when open the report and go online.

https://github.com/user-attachments/assets/fb961941-8026-4612-95ec-2d0d87952b16

🎀 👀 🎀 C+ reviewed

situchan avatar Dec 25 '25 21:12 situchan

Triggered auto assignment to @robertjchen, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

melvin-bot[bot] avatar Dec 25 '25 21:12 melvin-bot[bot]

@leshniak please check this video (around 00:14s). I tested on 2 devices.

https://github.com/user-attachments/assets/92f17164-2af3-4904-a7bf-703df4437068

It's interesting that total amount is displayed correctly on device A after deleting expense on device B. Can you please try to find the root cause?

situchan avatar Dec 25 '25 21:12 situchan