[Payment due @FitseTLT] MergeTransaction: guard against requesting merge candidates with an empty transactionID#96194
Conversation
…mpty transactionID getTransactionsForMerging could fire GetTransactionsForMerging (or write a malformed MERGE_TRANSACTION Onyx key) when targetTransaction.transactionID was blank, producing backend auth errors. Return early when the transactionID is empty.
…rMerging Add a test asserting no merge-candidate Onyx entry is written when the target transaction has an empty transactionID.
|
@stitesExpensify 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] |
…ions-empty-id-guard
Reviewer Checklist
Screenshots/Videos |
|
@puneetlath On the test steps, I don't think Merge is related with having duplicate expenses. |
|
@FitseTLT when you go through the duplicates flow and choose to keep one, you are merging the transactions together.
|
|
Nope @puneetlath the function you changed doesn't get called in this flow it is called when you click merge on a transaction when it fetches the eligible merge transactions list |
|
Got it! I'll adjust the steps. |
|
Everything else good from your perspective @FitseTLT? |
|
Yep |
|
🎯 @FitseTLT, thanks for reviewing and testing this PR! 🎉 A payment issue will be created for your review once this PR is deployed to production. If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 puneetlath 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/puneetlath in version: 9.4.36-0 🚀
|
|
🤖 No help site changes required. I reviewed the changes in this PR against the help site articles under The relevant help article, How-to-Merge-Expenses.md, documents the merge-expenses flow, and the behavior it describes is unchanged by this PR. No draft docs PR was created. If you believe a documentation update is warranted here, let me know and I'll draft one. |






Explanation of Change
getTransactionsForMerginginsrc/libs/actions/MergeTransaction.tsreadstargetTransaction.transactionIDand then either computes eligible transactions locally or calls theGetTransactionsForMergingAPI — without checking that the transactionID is non-empty. WhentransactionIDis blank, this fires the API with an emptytransactionID(which the backend rejects with a401, logged as a[OOPS!]server error) and would also write to a malformedmergeTransaction_Onyx key.This adds an early return when
transactionIDis empty, so neither the local path nor the API call runs with a blank ID. This is the client-side complement to the Auth-side graceful-degrade change for #616428.Fixed Issues
For https://github.com/Expensify/Expensify/issues/616428
PROPOSAL:
Tests
The empty-
transactionIDguard itself is covered by an automated unit test intests/actions/MergeTransactionTest.ts(getTransactionsForMerging→ "should do nothing when the target transaction has no transactionID"), since a blank transactionID is not reliably reproducible through the UI.Offline tests
QA Steps
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