Repository navigation
[Payment due @huult] [No QA] Hide redundant MARKEDREIMBURSED action when report has a sibling IOU pay action - #95015
Conversation
…tion Co-authored-by: Rory Abraham <roryabraham@users.noreply.github.com>
|
@DylanDylann 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: 3d73234aaf
ℹ️ 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".
| if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.MARKED_REIMBURSED) && hasSiblingPayReportAction(reportAction)) { | ||
| return false; |
There was a problem hiding this comment.
Recompute cached siblings when PAY arrives
When the MARKED_REIMBURSED action is loaded before its sibling PAY action, DERIVED.VISIBLE_REPORT_ACTIONS has already cached it as visible. The incremental computation in visibleReportActions.ts processes only the action IDs included in each update, so merging the PAY action never reevaluates the existing MARKED_REIMBURSED action; isReportActionVisible() then returns that stale cached true value without invoking this new check. This means the duplicate remains in exactly the late-arriving-action scenario the helper intends to handle, unless visibility for all relevant siblings is invalidated or recomputed when a PAY action arrives.
Useful? React with 👍 / 👎.
| // Once a PAY action is found, unrelated report updates cannot change the result. Don't cache misses since PAY may arrive later. | ||
| const hasPayAction = Object.values(getAllReportActions(reportID)).some((action) => isPayAction(action)); | ||
| if (hasPayAction) { | ||
| reportsWithPayAction.add(reportID); |
There was a problem hiding this comment.
Match the PAY action to the reimbursement event
A report can contain a historical PAY action that is not the twin of this MARKED_REIMBURSED action—for example, after a NewDot payment is canceled, cancelPayment() adds a REIMBURSEMENT_DEQUEUED action but retains the original PAY action, and the report can subsequently be marked reimbursed through an OldDot/no-twin path. Checking for any PAY action over the report's entire history hides that later legitimate audit entry, so this needs to correlate the actions or exclude canceled/failed payments rather than treating every lifetime PAY action as the replacement.
Useful? React with 👍 / 👎.
|
@FitseTLT @roryabraham One of you needs to 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] |
# Conflicts: # src/libs/actions/OnyxDerived/configs/visibleReportActions.ts # tests/unit/OnyxDerivedTest.tsx
|
@codex review |
|
@MelvinBot review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8076e0fda5
ℹ️ 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".
| const reportID = reportAction?.reportID; | ||
| if (!reportID || !reportAction?.reportActionID) { | ||
| return false; |
There was a problem hiding this comment.
Pass the collection report ID into the sibling lookup
When a persisted report action omits its optional reportID and relies on the reportActions_<reportID> collection key, this early return makes the new sibling check a no-op. That shape is explicitly supported by callers, which already compute actionReportID = reportAction.reportID ?? reportID, and is used by existing Onyx fixtures; however, isReportActionVisible() drops that known ID before calling this helper. Consequently the background-job MARKED_REIMBURSED action described by this change can remain visible beside its PAY action unless the report ID is passed separately into the lookup.
Useful? React with 👍 / 👎.
|
🤖 Review: this works, but it's solving a harder problem than the one you have. The linked issue's own conclusion is that The "no regression" argument that justifies the complexity doesn't hold. The PR keeps no-twin paths (ABA batches, zero-amount paychecks, OldDot non-instant-submit) visible. But Also: the root cause is server-side. This is a client-side compensation for a backend value that shouldn't have been baked at write time. Fixing it there is a smaller change, covers every client including app versions that never update, and is what the linked issue recommends. That needs an internal engineer — please confirm the server fix isn't the right call before landing this. Additional findings if this approach is kept1. I did verify the cache opt-out is safe: every consumer I checked ( 2. The look-back after a 3. 4. Minor: the 5. Cache invalidation itself is sound. Onyx's What I couldn't verify: I wasn't able to run the test suite in this environment, so the four new tests are reviewed by reading only. Reply with |
|
@codex review |
|
@MelvinBot review |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-09-19.at.18.43.37.mov |
|
@roryabraham could you check my comment? |
|
@roryabraham Could you take a look when you have time? |
|
🎯 @huult, 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. |
|
@nyomanjyotisa 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] |
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.4.94-0 🚀
|
|
No help site changes are required for this PR, so I did not create a docs PR. This PR fixes a bug where a report could show a duplicate "marked as paid" message in its history. The fix changes nothing users can see or configure. No feature names, settings, buttons, or workflows changed. What I checked
|
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.4.94-0 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Payment issue created: #102453 |
Explanation of Change
NewDot renders the IOU
payaction in place of theMARKEDREIMBURSEDaction, so the two should never both be displayed on the same report. The existing guard inshouldReportActionBeVisiblehidesMARKEDREIMBURSEDonly when the write-timeoriginalMessage.isNewDotflag is set or the bakedshouldShowisfalse.Both of those signals are computed once, at write time, and persisted into the Onyx update. When a
MARKEDREIMBURSEDaction is created outside a NewDot request (e.g. a background job, then served back viaGetMissingOnyxMessages),isNewDotis unset and a staleshouldShow: truegets baked in — so neither condition fires and the row leaks through alongside the IOUpayaction, producing the duplicate "marked as paid" message.This change stops trusting the stale baked flags and instead derives the answer locally: a new
hasSiblingPayReportActionhelper checks whether the report already contains an IOUpayaction, andMARKEDREIMBURSEDis hidden when it does. This is scoped toMARKEDREIMBURSEDonly (notREIMBURSED), and is purely additive to the existing flag checks, so:MARKEDREIMBURSED+ IOUpayon the same report) → siblingpayexists → hidden → duplicate fixed.MARKEDREIMBURSEDwith no IOUpay→ sibling absent → still visible → no regression.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/636674
PROPOSAL: https://github.com/Expensify/Expensify/issues/636674#issuecomment-4617734150
Tests
Automated tests only.
Offline tests
n/a
QA Steps
None.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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