Repository navigation
Keep native receipt creates on disk and stop moving expenses the server rejected - #107935
Conversation
A request holding a File was never written to disk while in flight. On native the receipt create is such a request, so an app killed mid-upload lost the create while the move queued behind it survived and got a 456. On native the receipt lives in the app's own folder and the upload is rebuilt from its path, so it can be stored like any other request.
The failed create leaves the expense on screen with an error, but the server has no such expense, so moving it or adding it to a report only fails with a 456. A create that is still queued keeps working, since the queue sends the move after it.
A failed ChangeTransactionsReport put the expense back on its report with no message, so the user couldn't tell it didn't sync.
|
@jayeshmangwani 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] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d9f3281aad
ℹ️ 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".
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
A React Native File keeps its name and type on its prototype, so a queued receipt create written to disk came back after a restart without them and was uploaded as an unnamed, untyped part. Copy them onto the file when the request is queued, and reuse the same helper where the upload is rebuilt. A move that failed and then succeeded on retry kept the earlier error on the expense, so clear errors in the move's success data.
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
@elirangoshen, I'm trying to test this scenario, but when I move the expense in Session A(offline), delete it from Session B(online), and then bring Session A back online, it successfully moves to the other report that we selected while offline. offline-chanding-report.mov |
@jayeshmangwani thanks, that's my mistake in the test steps, not a bug in the PR. I've changed the step to make the move fail on purpose:
let me know its ok now |
|
@elirangoshen , everything looks good in testing. I noticed just one small issue: when we move the expense, the error message |
The error row under the expense already shows its message errors, so the row's own red line now keeps only the receipt errors instead of repeating the same message.
please try now |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid.movAndroid: mWeb Chromemweb-chrome.moviOS: HybridAppios.moviOS: mWeb Safarimweb-dafari.movMacOS: Chrome / Safariweb-test-1.movweb-test-2.mov |
thanks, working well now |
|
🚧 mountiny 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.5.56-0 🚀
|
|
No help site update needed — this PR fixes receipt-upload reliability and failed expense moves without adding a feature, changing the normal workflow, or making existing article instructions incorrect. |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.5.56-2 🚀
Bundle Size Analysis (Sentry): |
|
This was not an emergency. The Claude review action was broken on main, so proceeded to merge anyway. |


Explanation of Change
Some expenses never reach the server, and the move queued after them fails with a 456 ("Could not retrieve all transactionIDs"). This PR fixes the three App-side causes:
canPersistRequestskipped any request holding aFile, and native receipts are RNFiles, so an app killed mid-upload lost the create. The skip is now web-only: on native the receipt file stays in the app's folder and still uploads after a restart. A RNFilekeeps its name and type on the prototype, so they are now copied onto the file when it is queued; otherwise a receipt restored from disk would be sent without a filename or type.hasCreateFailedkeeps it out of "Add existing expense" and the move-to-report permission. A create that is only pending can still be moved.Fixed Issues
$ #106959
PROPOSAL:
Automated Tests
tests/unit/PersistedRequestsNativeTest.ts(new): with the native variant, a receipt create holding aFilestays on disk as the ongoing request while it is sent, with the queued move still behind it, andupdateOngoingRequeststores it too. A queued receipt keeps its name and type when stored as JSON. The mock keeps them on the prototype like a RNFile. All three cases fail against the previous behavior.tests/unit/canEditFieldOfMoneyRequestTest.ts: moving to a report is not allowed when the create was rejected, and is still allowed while the create is only pending.tests/unit/AddExistingExpenseTest.ts: "Add existing expense" leaves out an expense whose create was rejected, and keeps one whose create is only pending.tests/actions/TransactionTest.ts: a failed move puts the expense back on its report with the error, and a later move that works clears it.tests/unit/PersistedRequests.tsandtests/unit/RequestsKeptOnSAMLSignOutTest.tsnow load the web variant explicitly, because Jest resolves.nativefiles by default and these cases cover web.Tests
Rejected create is not offered in "Add existing expense":
Failed move shows an error:
Receipt create survives an app kill during upload (iOS):
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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