Fix/96257 optimistic move scan failed on pay approve - #97084
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c399bc020
ℹ️ 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".
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Fixing deploy blockers.
|
@yusufdeveloper2903, what do you think about the existing concerns (P1, P2, and CONSISTENCY-3)? |
…move-scan-failed-on-pay-approve
…mount and fix foreign-currency totals
Thanks — you're right on all of them, addressed in the latest commit:
|
|
@yusufdeveloper2903 when I come back online and try to approve the expense with the "scan failed", a new, empty report appears; however, after repeatedly clicking the "Approve" button, the expense with the failed scan returns to the original report, leaving the report empty there: Screen.Recording.2026-07-30.at.17.50.35.movThank you |
…mistic moved report
…move-scan-failed-on-pay-approve
|
@brunovjk thanks for catching this , fixed now. REC-20260731142439.1.mp4
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari97084_web_chrome.mov |
brunovjk
left a comment
There was a problem hiding this comment.
LGTM, @yusufdeveloper2903!
I only noticed a ESLint warning: employeeEmail seems to be unused in the new scan-failed expenses test block. Could you please clean that up before merge? Thanks!
…move-scan-failed-on-pay-approve
…move-scan-failed-on-pay-approve
|
@yusufdeveloper2903 Can you merge |
…move-scan-failed-on-pay-approve
|
@brunovjk ready for review 🙂 |
There was a problem hiding this comment.
ReportWorkflow.ts isn't touched at head, so Approve isn't covered. That change was in ad4fb65b, dropped in 18951374.
Dropping it was right: Auth only splits in PayMoneyRequest, so an optimistic split on approve has nothing to reconcile against. Pay-only matches the issue.
Please update the body to match, in two spots:
- "triggered in
payMoneyRequestandapproveMoneyRequest" -> pay only. - Tests step 5-6 says to verify the expense moves on Approve. It can't. Assert it does not move instead.
Two blocking comments below.
…move-scan-failed-on-pay-approve
|
@deetergp ready for review |
|
It's up to you now, @deetergp? Thanks. |
|
@yusufdeveloper2903 GH is saying this branch has conflicts, though it is not showing me what they are. |
|
@deetergp Here's exactly where the conflict is 👇 The conflict is caused by #98096 ( 2 files conflict. Both are just parameter lists — no logic clash. 1.
|
|
Those resolutions look good to me @yusufdeveloper2903 |
|
@deetrgo merged main and resolved the conflicts. |
…move-scan-failed-on-pay-approve
|
Hi @deetergp I've merged main into this branch and there are no conflicts now, can we go ahead and merge it |
|
Damnit. Sorry @yusufdeveloper2903 I approved it, but now GH is saying there are (unspecified) conflicts. |
…move-scan-failed-on-pay-approve
|
Merged with main again to resolve the conflict |
|
🚧 deetergp has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |

Explanation of Change
When a report mixes a valid expense with a SmartScan-failed (non-submittable) expense, the backend moves the scan-failed expense into a new report on Pay/Approve so the rest can proceed. This was backend-only, so offline the expense stayed in the report until reconnect (#96257).
This PR adds the optimistic (client-side) split by generalizing the existing held-expense split (
getReportFromHoldRequestsOnyxData/getHoldReportActionsAndTransactions) to also move scan-failed transactions. It's triggered inpayMoneyRequestandapproveMoneyRequestwhenever the report contains a scan-failed expense. Moved/remaining report totals are computed from the moved transactions; the held-only path is byte-identical (no regression).Fixed Issues
$ #96257
PROPOSAL: #96257 (comment)
Tests
Offline tests
QA Steps
Same as Tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
After fixREC-20260727153205.mp4