Skip to content

Keep held expenses out of unheld totals when splitting offline - #105524

Merged
marcochavezf merged 3 commits into
mainfrom
claude-offlineSplitUnheldTotal
Nov 2, 2026
Merged

marcochavezf merged 3 commits into
mainfrom
claude-offlineSplitUnheldTotal

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

When an expense is split, SplitTransactionUpdate passes the post-split report total to the money request builder as newReportTotal. The builder copied that full total into unheldTotal and unheldReimbursableTotal. The full total also counts held expenses, so after an offline split every held expense was counted as unheld, and the Approve dropdown showed the whole report total for "Approve only".

This PR changes the builder so that, when newReportTotal is passed, unheldTotal and unheldReimbursableTotal move by the change in total (newReportTotal - previous total) instead of being overwritten with it. Held amounts stay out of the unheld totals. Without an override, the change is still -reportAmount, so the existing per-transaction behavior is unchanged.

A unit test covers a report with one held expense and one unheld expense that is split while offline. It fails on main (unheldTotal becomes the full total) and passes with this change.

Fixed Issues

$ #104050
PROPOSAL: #104050 (comment)

Tests

// TODO: The human co-author must fill out the tests you ran before marking this PR as "ready for review"
// Please describe what tests you performed that validates your changed worked.

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Case 1: "Approve only" includes held expenses after an offline split

  1. Submit two expenses to the same report: $10 and $20
  2. Open the $10 expense > Hold > enter a reason
  3. Go offline
  4. Open the $20 expense > More > Split > save as $10 + $10
  5. Open the report and click the Approve dropdown
  6. Verify that "Approve only $20.00" and "Approve $30.00" show

Case 2: splitting a held expense into a lower total

  1. Submit two expenses to the same report: $100 and $20
  2. Open the $100 expense > Hold > enter a reason
  3. Go offline
  4. Open the $100 expense > More > Split. Set the first split to $30, then the second to $30, and Save
  5. Open the report and click the Approve dropdown
  6. Verify that "Approve only $20.00" and "Approve $80.00" show

Case 3: report with a $0.00 total

  1. Submit a $10 expense to the workspace chat
  2. Add a -$10 expense to the same report, so the report total is $0.00
  3. Go offline
  4. Open the $10 expense > More > Split > save as $5 + $5
  5. Verify that report total is $0.00
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team October 30, 2026 19:14
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Oct 30, 2026
@mkhutornyi

Copy link
Copy Markdown

@MelvinBot Same as the unheld totals: this is the last line that still reads newReportTotal by truthiness, so a report whose total becomes 0 falls back to previousReimbursableTotal - reportAmount. Can we use previousReimbursableTotal + reportTotalChange here too?

@MelvinBot

MelvinBot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ✅ pass

After splitting an unheld expense offline on a report that also has a held expense, the report total stayed at $30.00 (not doubled), and "Approve only" showed $10.00 (unheld only), both offline and after going back online. The PR's Tests section is still empty, so these steps come from the linked issue's repro plus the held-expense case this PR fixes.
Online: Approve only $10.00 vs Approve $30.00

Step Status
Workspace has Submission frequency disabled and Add approvals enabled; report has one held and one unheld expenseSubmissions off (instant submit), Approvals on. Report has Expense A $10 (unheld) and Expense B $20 (held). Total $30.00.
Submission frequency disabledApprovals enabledReport with $10 unheld + $20 held, total $30.00
✅
Go offlineTroubleshoot > Force offline turned on. The "You appear to be offline" banner appeared.
Force offline enabled
✅
More > Split on the unheld expense, save while offlineSplit Expense A ($10) into two $5.00 parts and saved while offline. No error.
Split screen, two $5.00 parts, offline
✅
Report total matches the real total after the offline split (not doubled)$20 (held) + $5 + $5 = Total $30.00, the same as before the split.
Report after offline split, total $30.00
✅
"Approve only" amount excludes the held expenseNew report with Expense C $10 and Expense D $20, submitted while online. Then Expense D was held on the submitted report, and Expense C was split into two $5.00 parts while offline. Total stayed $30.00. The Approve dropdown offered "Approve only $10.00" and "Approve $30.00". The approval was not confirmed.
Submitted report with held expense shows Approve dropdownSplitting unheld expense on submitted report, offlineSubmitted report total $30.00 after offline splitOffline: Approve only $10.00 vs Approve $30.00
✅
Go back online; totals stay correct after syncReport total stayed $30.00, and the dropdown still showed "Approve only $10.00" / "Approve $30.00". Note: right after reconnecting, the chat list preview briefly showed "owes $40.00", then corrected itself to $30.00. This brief state was not captured in a screenshot. The report view itself never showed $40. A duplicate-expense prompt, unrelated to this PR, had to be cleared with "Keep all" before approving.
Report online, total $30.00Chat preview settled at $30.00Online: Approve only $10.00 vs Approve $30.00
✅

view run · no recording available

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Done in fd30d9b. MoneyRequestBuilder.ts:1518 now uses previousReimbursableTotal + reportTotalChange. A newReportTotal of 0 is now applied instead of falling back to previousReimbursableTotal - reportAmount.

When the report total is overridden, the new formula gives the same result as the old newReportTotal - nonReimbursableTotal, because a reimbursable change leaves nonReimbursableTotal alone. I also added a reimbursableTotal assertion to the offline split test.

Checks
  • npm test -- tests/actions/IOUTest/ tests/unit/IOUUtilsTest.ts: 19 suites, 875 tests passed
  • npm run lint on both changed files: clean
  • npm run typecheck: passed

view run

@mkhutornyi

Copy link
Copy Markdown

@codex review

@mkhutornyi

Copy link
Copy Markdown

@MelvinBot review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T21:47:26.782288Z c90e0ef Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Review at fd30d9b

Looks good to merge. I found no blocking issues. Before review, someone still needs to fill out the PR body's Tests, Offline tests, and QA sections, which are still TODO. CI passes except Check independent approval and the pending branch-perf-tests.

Why the change is correct:

  • MoneyRequestBuilder.ts:1499 moves unheldTotal, reimbursableTotal, and unheldReimbursableTotal by the same change as total. Held amounts never enter the unheld totals, so this is the right model.
  • Splitting a held expense now also works. The split children inherit the hold (SplitTransactionUpdate.ts:1299-1414). The total change is 0, so the unheld totals correctly stay the same. The old code set unheldTotal = newReportTotal, which would have counted that held amount as unheld.
  • The split loop calls the builder once per split. Each call reads the same pre-split report and gets the same newReportTotal (SplitTransactionUpdate.ts:1038). Every call computes the same result, so the change is not applied more than once.
  • When the currencies differ, newReportTotal is already in the report currency. The change is applied correctly there too.
  • A report total of 0 is now handled everywhere, including the reimbursableTotal fix in the last commit.

Optional nits:

  1. If iouReport.total is undefined or NaN, total is not updated. However, unheldTotal still moves by newReportTotal - 0, which is the whole new total (MoneyRequestBuilder.ts:1499, :1532). This matches the old overwrite behavior, so it is not a regression. To be safe, use -reportAmount as the change when total is not a number.
  2. The new test fakes the held expense by writing unheldTotal directly with Onyx.merge. A second case that splits a held expense would cover the hold-inheritance path above. That path behaves differently now than on main.
Out of scope (already on main)

When a split moves to a different report, reportTotals uses that report's current total (SplitTransactionUpdate.ts:522-530). That report's change is therefore 0. This PR keeps total and the unheld totals in step there. It does not change how the target report's total is calculated.


view run

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd30d9bd78

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +1532 to +1534
iouReport.unheldTotal += reportTotalChange;
if (reimbursable && newUnheldReimbursableTotal === undefined && isCurrencyMatching) {
iouReport.unheldReimbursableTotal = newReportTotal ? newReportTotal - (iouReport.unheldNonReimbursableTotal ?? 0) : previousUnheldReimbursableTotal - reportAmount;
iouReport.unheldReimbursableTotal = previousUnheldReimbursableTotal + reportTotalChange;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep held split deltas out of unheld totals

When the source expense itself is held and the user saves ordinary cash splits whose sum is below the original amount (which computeSplitSaveErrorMessage() permits), SplitTransactionUpdate.copyCommentsAndHoldState() carries that hold to every child while passing the changed report total here. Adding the resulting reportTotalChange to unheldTotal and unheldReimbursableTotal therefore changes the approvable amount even though the entire delta belongs to held expenses; for example, reducing a held $100 expense to $60 makes an initially zero unheld total become +$40. Skip this delta for held source transactions or pass a separately computed unheld-total change.

AGENTS.md reference: AGENTS.md:L96-L100

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MelvinBot address #105524 (comment)

Splitting a held expense into a lower total shows a negative "Approve only" amount offline

A cash split can total less than the original (only an info warning). The hold is copied to every split (SplitTransactionUpdate.ts#L1414), so the whole change in the report total belongs to held spend. The builder still adds it to the unheld totals (MoneyRequestBuilder.ts#L1532-L1534).

Preconditions: workspace with approvals enabled, you are the report's approver, desktop web.

  1. Submit two expenses to the same report: $100 and $20
  2. Open the $100 expense > Hold > enter a reason
  3. Go offline
  4. Open the $100 expense > More > Split. Set the first split to $30, then the second to $30, and Save
  5. Open the report and click the Approve dropdown

Expected: "Approve only $20.00" and "Approve $80.00"
Actual: "Approve only -$20.00" and "Approve $80.00"

@MelvinBot MelvinBot Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c90e0ef. When you split a held expense, its unheld totals now stay the same. In your example, "Approve only" stays at $20.00 instead of -$20.00.

  • Why: each new split inherits the source expense's hold, so the whole change in the report total is held spend.
  • Change: the split now passes isReportTotalChangeOnHold: isCreationOfSplits && isTransactionOnHold to the builder. With that flag set, the builder leaves unheldTotal and unheldReimbursableTotal alone. total and reimbursableTotal still move by the full change.
  • Test: I added a unit test for your case. It holds a $100 expense, adds a $20 unheld expense, and splits the $100 into $30 + $30 while offline. It expects a total of $80 and an unheld total of $20. It fails without the fix and passes with it.
  • Checks: all 176 tests in SplitTest.ts, lint, and typecheck pass.

I didn't confirm this in the web app. The test browser went blank before the first step, so none of your repro steps ran.


view run · no recording available

@MelvinBot

MelvinBot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ❌ fail

One regression found: when you split a held expense offline into parts that add up to less than the original, "Approve only" shows a negative amount (-$40.00 instead of $50.00) until the app reconnects. Plain splits, splits of held expenses that keep the same sum, and non-reimbursable splits all keep the correct totals offline and online.
V8 back online: Approve only $50.00 / Approve $60.00

Step Status
Online split, no holds: $40 + $60 report, split $40 into $15 + $25Total stayed $100.00. The chat preview showed 3 expenses and $100.00. The Approve amount didn't change.
V1 before split: $40 + $60, total $100V1 after split: $60 + $15 + $25, total $100V1 chat preview after split, total $100
✅
Offline split of a held expense, same sum: $30 + held $50, split $50 into $20 + $30Both new parts kept the hold. Total stayed $80.00, and "Approve only" stayed $30.00 offline and after reconnecting.
V2 offline: Approve only $30.00 / Approve $80.00V2 back online: total $80.00
✅
Offline split of a non-reimbursable expense: $25 reimbursable + $35 non-reimbursable, split $35 into $10 + $25Both new parts stayed non-reimbursable. Reimbursable $25, non-reimbursable $35, and total $60 didn't change, offline or online.
V3 offline: non-reimbursable split, totals unchangedV3 back online: $25 / $35 / $60
✅
Offline split that moves one part to another reportSkipped. The split editor has no per-part report picker, so this flow can't be reached in the UI.
V4 split-line editor has no report picker
⚠️
Resolve duplicates: two $12 duplicates + held $8After "Keep selected", the report showed $12 + $8 (held) = $20.00, which is correct. On submit, the held $8 moved to its own Draft report. That is the app's normal behavior (held expenses stay behind on submit), not a regression from this PR. This flow also doesn't run the changed code.
V5 before submit: $12 + $8 held, total $20V5 after submit: held $8 moved to its own Draft report
⚠️
Console and network errorsNo in-app errors appeared. The network log had one AuthenticatePusher 403 that succeeded on retry. Every other request returned 200.
✅
Offline: remove a split part while another expense is heldBefore: total $110, "Approve only" $40. Split $100 into $60 + $40, held the $60 part and a separate $10 expense, then removed the $60 part while offline. The split recombined to $100, and a crossed-out $60 line stayed on the report, so the total read $170.00. After reconnecting, the total was correct at $110.00. This PR doesn't change how the total itself is calculated, so the extra $60 line is probably an existing bug. I didn't compare against main.
V7 before: Approve only $40.00 / Approve $110.00V7 offline after removing split: ghost $60 line, total $170V7 back online: total $110, Approve only $100
⚠️
Offline: split a held expense into a smaller sum ($50 + held $100, split $100 into $5 + $5)Total was correct at $60.00, but "Approve only" showed -$40.00 while offline. It corrected to $50.00 after reconnecting.
Cause: MoneyRequestBuilder.ts:1499 and :1532-1534 add the whole total change (+90) to unheldTotal (-50 → +40), even though all of that change came from held expenses. By the code, main would show $60 here (off by $10, but not negative). I didn't test main.
Fix: only add the change to the unheld totals when the split expense isn't held. Codex flagged the same case.
V8 offline: held $100 split into $5 + $5, total $60V8 offline: Approve only -$40.00 / Approve $60.00V8 back online: Approve only $50.00 / Approve $60.00
❌

view run · no recording available

When a held expense is split, every split inherits the hold, so the whole change in the report total is held spend. Skip the unheld totals in that case so 'Approve only' does not go negative when the splits total less than the original.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@mkhutornyi

Copy link
Copy Markdown

@MelvinBot review

@mkhutornyi

Copy link
Copy Markdown

@codex review

@MelvinBot

Copy link
Copy Markdown
Contributor Author

Review at c90e0ef

Looks good to merge. I found no blocking issues. The latest commit fixes Codex's finding, and CI passes except Check independent approval and the PR author checklist. The Tests, Offline tests, and QA sections in the PR body are still TODO.

Why the latest commit is correct:

  • SplitTransactionUpdate.ts:1041 passes isReportTotalChangeOnHold only when a held expense is split for the first time. Every new split inherits that hold, so the whole change in the total is held spend. With the flag set, MoneyRequestBuilder.ts:1535-1539 leaves the unheld totals alone, while total and reimbursableTotal still move.
  • The flag reads the source expense's hold (:543), not the new splits. If the HOLD action isn't loaded, the new splits don't get the hold optimistically (:1394). Even then, keeping their change out of "Approve only" matches what the server will return.
  • When a split moves to another report, that report's change is 0, so the flag has no effect there.

Should fix, but it doesn't block (I read the code; I didn't run this):

  1. Editing splits that are already held has the same problem Codex found. When you edit existing splits, the flag is false (:432), so the change goes into unheldTotal. Cash splits may total less than the original (SplitExpenseUtils.ts:104-116).
    • Example: split a held $100 expense into $50 + $50. After sync, edit the splits to $30 + $30 while offline. "Approve only" drops by $40 and can go negative. On main it shows the full total instead, so both are wrong and this is not a regression.
    • Fix: for edits, base the flag on the existing splits' hold state, for example isCreationOfSplits ? isTransactionOnHold : allChildTransactions.every(isOnHold). A mix of held and unheld splits would need a separately computed unheld change.

Nits:

  1. My earlier note on the total fallback still applies. If iouReport.total is undefined, the change at MoneyRequestBuilder.ts:1503 becomes the whole new total. If total is NaN, the change becomes NaN and so does unheldTotal. main sets unheldTotal to the override instead. Using -reportAmount whenever total is not a finite number covers both cases.
  2. The new held-split test sets comment.hold without a HOLD report action. That means the new splits never actually get the hold. The test checks the flag but not hold inheritance. That's fine for this fix, but a test that holds the expense with the real hold action would also cover how the new splits get the hold.

Reply with @MelvinBot fix the held split edit case to have me apply fix 1.


view run

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: c90e0ef84f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@MelvinBot

MelvinBot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ✅ pass

I found no regressions from this PR. Seven split, hold, non-reimbursable, and duplicate-report flows kept correct totals and "Approve only" amounts offline and online. One offline bug showed up (editing an existing held split shows $27 instead of $30), but it reproduces the same way without this PR's changes, so it is pre-existing.
Duplicated report: $11 / $23 / $34, matches source

Step Status
No holds: split $10 into $4 + $6 offlineTotal stayed $30.00 with a plain Approve button (no "Approve only"). Same online.
No holds: split offline, total $30No holds: online, total $30
✅
Split a held $20 expense into $12 + $8 offlineTotal stayed $30.00, and both parts stayed held. The dropdown showed "Approve only $10.00" / "Approve $30.00" offline and online.
Held expense split offline, both parts held, total $30Offline: Approve only $10.00Online: Approve only $10.00 / Approve $30.00
✅
Edit an existing held split ($12/$8 → $15/$5) offline (pre-existing bug, not a regression)With the PR, the offline total showed $27.00 instead of $30.00, and the dropdown showed "Approve $27.00". "Approve only $10.00" stayed correct. The total corrected itself to $30.00 after going online. I re-ran the same steps with this PR's logic removed (main behavior) and got the same $27.00 offline, then $30.00 online. The PR doesn't change the line that sets the report total.
PR code: offline total $27.00 after editing held split to $15/$5PR code: online total back to $30.00Main code: offline total $27.00 after same editMain code: Approve only $10.00 / Approve $27.00 offlineMain code: online total back to $30.00
⚠️
Edit an existing unheld split and add a third part ($4/$6 → $3/$3/$4) offlineTotal stayed $30.00 offline and online.
Unheld split edited to 3 parts offline, total $30Unheld split online, total $30
✅
Non-reimbursable mix: split the $11 reimbursable expense into $5 + $6 offlineReimbursable $11.00, non-reimbursable $23.00, total $34.00, all unchanged.
Offline after reimbursable split: $11 / $23 / $34
✅
Non-reimbursable mix: split the $23 non-reimbursable expense into $13 + $10 offlineReimbursable $11.00, non-reimbursable $23.00, total $34.00, all unchanged.
Offline after non-reimbursable split: $11 / $23 / $34
✅
Non-reimbursable mix: go back onlineAll four parts persisted. Totals stayed $11.00 / $23.00 / $34.00.
Online after sync: $11 / $23 / $34
✅
Delete one held split part ($5) offlineTotal dropped exactly from $30.00 to $25.00. The dropdown showed "Approve only $10.00" / "Approve $25.00" offline and online.
Split part deleted offline, total $25.00Online: Approve only $10.00 / Approve $25.00
✅
Duplicate a 4-expense report (More > Duplicate report)The copy matched the source: $11.00 reimbursable, $23.00 non-reimbursable, $34.00 total. Tested online only.
Duplicated report: $11 / $23 / $34, matches source
✅

view run · view recording

@mkhutornyi

Copy link
Copy Markdown

@MelvinBot add QA steps below and mark this PR ready for review

Case 1: "Approve only" includes held expenses after an offline split

  1. Submit two expenses to the same report: $10 and $20
  2. Open the $10 expense > Hold > enter a reason
  3. Go offline
  4. Open the $20 expense > More > Split > save as $10 + $10
  5. Open the report and click the Approve dropdown
  6. Verify that "Approve only $20.00" and "Approve $30.00" show

Case 2: splitting a held expense into a lower total

  1. Submit two expenses to the same report: $100 and $20
  2. Open the $100 expense > Hold > enter a reason
  3. Go offline
  4. Open the $100 expense > More > Split. Set the first split to $30, then the second to $30, and Save
  5. Open the report and click the Approve dropdown
  6. Verify that "Approve only $20.00" and "Approve $80.00" show

Case 3: report with a $0.00 total

  1. Submit a $10 expense to the workspace chat
  2. Add a -$10 expense to the same report, so the report total is $0.00
  3. Go offline
  4. Open the $10 expense > More > Split > save as $5 + $5
  5. Verify that report total is $0.00

@MelvinBot
MelvinBot marked this pull request as ready for review October 30, 2026 21:40
@MelvinBot
MelvinBot requested a review from a team as a code owner October 30, 2026 21:40
@melvin-bot
melvin-bot Bot requested a review from mkhutornyi October 30, 2026 21:40
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I added your three QA cases to the QA Steps section and marked this PR as ready for review.

The Tests section still has the TODO placeholder. You may want to fill it in, or replace it with "Same as QA Steps", before the reviewer checklist runs.


view run

@melvin-bot
melvin-bot Bot removed the request for review from a team October 30, 2026 21:40
@melvin-bot

melvin-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

@mkhutornyi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from trjExpensify and removed request for a team October 30, 2026 21:40
@mkhutornyi

Copy link
Copy Markdown

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
case1.mov
case2.mov
case3.mov

@mkhutornyi

Copy link
Copy Markdown

While testing, I found bug happening on main:

Bug: Editing splits offline to a lower total only applies the last split's change to the report total

  1. Submit two expenses to the same report: $100 and $20
  2. Split the $100 expense into $50 + $50 while online
  3. Hold both $50 splits
  4. Go offline
  5. Open a split > More > Edit splits. Set the first split to $30, then the second to $30, and Save
  6. Check the report total and the Approve dropdown

Expected: total $80.00, "Approve $80.00"
Actual: total $100.00, "Approve $100.00"

bug.mov

@melvin-bot

melvin-bot Bot commented Oct 30, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to #104050 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@melvin-bot
melvin-bot Bot requested a review from marcochavezf October 30, 2026 21:42
@MelvinBot

MelvinBot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ✅ pass

I found no regressions in six new flows, each checked offline and online: a $0 report, a new expense added offline, splits into a lower total, a held non-reimbursable split, undoing a split, and a personal IOU. Earlier runs already covered the other split cases. In one case, the report view showed a wrong total ($70.00 instead of $50.00) for a moment and then corrected itself. I didn't confirm whether this PR causes it (see step 5).
Online IOU total $20.00

Step Status
$0 report: $10 + -$10, split the $10 into $5 + $5 offlineTotal stayed $0.00 offline and online.
Offline: $0.00 total after splitOnline: $0.00 total after split
✅
New $15 expense added offline to a submitted report with $10 (held) + $20Total $45.00. The dropdown showed "Approve only $35.00" / "Approve $45.00" offline and online.
Offline: Approve only $35.00 / Approve $45.00Online: Approve only $35.00 / Approve $45.00
✅
Unheld $20 split into a lower total ($5 + $5) offline, with a held $10 on the reportThe editor allowed the lower sum and showed a warning. Total $20.00. The dropdown showed "Approve only $10.00" / "Approve $20.00" offline and online.
Offline: Approve only $10.00 / Approve $20.00Online: Approve only $10.00 / Approve $20.00
✅
Held non-reimbursable $30 split into $10 + $10 offline, with an unheld reimbursable $20Total $40.00, split into reimbursable $20.00 and non-reimbursable $20.00. The dropdown showed "Approve only $20.00" / "Approve $40.00" offline and online.
Offline: reimbursable $20 / non-reimbursable $20, total $40Online: Approve only $20.00 / Approve $40.00
✅
Undo a $20 + $20 split back to one $40 expense offline, with a held $10 on the reportThe final state was correct: Total $50.00, "Approve only $40.00" / "Approve $50.00" offline and online. Note: right after dismissing an unrelated "Review duplicates" prompt while offline, the report view briefly showed Total $70.00 and "Approve only $60.00" / "Approve $70.00". At the same time, the reports list showed $50.00. It corrected itself on the next render and did not happen again on a re-check. I did not compare this against main, so I can't say whether the PR causes it.
Offline reports list: $50.00 after undoing splitOffline, brief wrong state: $70.00 total after dismissing duplicatesOffline re-check: $50.00Online: $50.00
✅
Personal IOU: request $12, then $8, from another user offlineThe chat showed "owes $20.00" offline and online.
Offline IOU total $20.00Online IOU total $20.00
✅
Console and network errorsThe only failed request was one AuthenticatePusher 403, which succeeded on retry. I couldn't read the browser console in this environment, so I checked network requests only.
✅

view run · no recording available

@trjExpensify trjExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@marcochavezf
marcochavezf merged commit 2367c46 into main Nov 2, 2026
54 of 58 checks passed
@marcochavezf
marcochavezf deleted the claude-offlineSplitUnheldTotal branch November 2, 2026 23:58
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🚧 marcochavezf has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@OSBotify OSBotify mentioned this pull request Nov 3, 2026
99 tasks done
@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.5.31-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 failure ❌
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update needed — this PR fixes incorrect amounts after offline expense splits, restoring expected behavior without changing the documented workflow.

@OSBotify

OSBotify commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.5.31-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@OSBotify

OSBotify commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/blimpich in version: 9.5.31-4 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants