Skip to content

[Due for payment 2026-06-04] Expense - Potential duplicate message is shown in header for paid expense briefly #88305

Closed

Description

@jponikarchuk

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: V9.3.60-17
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #84657
Email or phone of affected tester (no customers): dreamnitethedragon+vegst@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Redmi note 10s android 13
App Component: Money Requests

Action Performed:

  1. Launch app
  2. Open workspace chat
  3. Create 2 distance manual expense
  4. Open the expense report
  5. Submit, approve and pay the expense
  6. Select both expense and duplicate expenses
  7. Navigate back to remove selection and note header message
  8. Open the expense and note header message

Expected Result:

Potential duplicate message must not shown in header for paid expense briefly on duplicate expenses.

Actual Result:

Potential duplicate message is shown in header for paid expense briefly on duplicate expenses.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 20, 2026
  2. melvin-bot commented on Apr 20, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #84657

  3. melvin-bot commented on Apr 20, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Apr 20, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Apr 20, 2026

    @OSBotify
    Contributor

    Investigation Summary

    Classification: Frontend bug
    Causing PR: #84657 - "[Duplicate Expense] Allow bulk duplication." by @Krishna2323 (High confidence)
    Related Issues: #84281

    Recommendation: REVERT

    PR #84657 introduced the bulk duplication feature and is directly implicated by melvin-bot's automated assignment. The bug is a UX regression introduced by this PR where the "Potential duplicate" message briefly appears in the header for paid expenses after performing a bulk duplication.

    Assigned: @Krishna2323 (PR author), @situchan (approving reviewer), @JS00001 (approving reviewer)
    Labels: DeployBlockerCash kept (App PR caused the issue). No label changes made.

    Detailed Analysis

    Evidence

    Verification

    PR #84657 modifies the following files directly relevant to the bug:

    • src/components/MoneyReportHeader.tsx — added conditional rendering of BulkDuplicateHandler component when isDuplicateOptionVisible is true
    • src/hooks/useSelectedTransactionsActions.ts — added isDuplicateOptionVisible computed from shouldShowBulkDuplicateOption
    • src/hooks/useSearchBulkActions.ts — introduced the shouldShowBulkDuplicateOption function
    • src/hooks/useBulkDuplicateAction.ts — new hook handling bulk duplication
    • src/components/Search/BulkDuplicateHandler.tsx — new invisible component for bulk duplicate subscriptions
    • src/libs/actions/IOU/Duplicate.ts — added bulkDuplicateExpenses function

    All of these files are confirmed to be in the affected code path.

    Root Cause

    The shouldShowBulkDuplicateOption function in useSearchBulkActions.ts does not check whether the parent expense report is in a paid/reimbursed state. As a result, when a user selects distance expenses on a paid report, isDuplicateOptionVisible evaluates to true.

    This causes the BulkDuplicateHandler component to mount inside MoneyReportHeader.tsx. When the user triggers the bulk duplication and then navigates back (clearing the selection), there is a brief window during which the newly duplicated transactions (or the original transactions) may have DUPLICATED_TRANSACTION violations registered before the component fully unmounts and state settles. During this transition, getReportPrimaryAction evaluates the violation data and temporarily returns REVIEW_DUPLICATES, causing the "Potential duplicate" banner to flash in the expense header.

    The fix should add a check in shouldShowBulkDuplicateOption to return false when isReportReimbursed (i.e., stateNum === APPROVED && statusNum === REIMBURSED), mirroring the guard that already exists for the canHoldTransactions check in useSelectedTransactionsActions.ts (line 274-276).

  6. MelvinBot commented on Apr 20, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    useMoneyReportHeaderStatusBar computes hasDuplicates via hasDuplicateTransactions() without checking whether the report is already settled/paid. The underlying isDuplicate() only checks whether a DUPLICATED_TRANSACTION violation exists and isn't dismissed — it has no awareness of report payment status.

    When a report is paid, payMoneyRequest optimistically clears transaction violations, but the server response re-populates them (violations persist server-side after payment). This causes the "Potential duplicate" banner to briefly flash in the header before a subsequent re-render hides it.

    What changes do you think we should make in order to solve the problem?

    In useMoneyReportHeaderStatusBar.ts line 79, guard hasDuplicates with an isSettled check so the duplicates banner is never shown for paid/reimbursed reports:

    const hasDuplicates = !isSettled(moneyRequestReport) && hasDuplicateTransactions(...)
    

    Import isSettled from ReportUtils. This is the minimal fix — paid reports should never show the duplicate banner regardless of what violation data the server returns.

    What alternative solutions did you explore? (Optional)

    An alternative would be to add the guard inside getStatusBarType() at line 107, but guarding at the hasDuplicates computation is cleaner since it also prevents shouldShowStatusBar from being true due to stale duplicate violations on settled reports.

    Another option would be fixing the server to strip DUPLICATED_TRANSACTION violations after payment, but that's a larger change and the client should still be resilient to this.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. JS00001 commented on Apr 20, 2026

    @JS00001
    Contributor

    This is linking to an old PR, which is currently locked to staging, demoting

  8. 33 remaining items

  9. added
    ReviewingHas a PR in review
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on May 29, 2026
  10. melvin-bot commented on Jun 3, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  11. melvin-bot commented on Jun 3, 2026

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@mallenexpensify)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants//hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  12. situchan commented on Jun 4, 2026

    @situchan
    Contributor

    This is not a regression from #84657.
    Reasoning: #88305 (comment)

  13. situchan commented on Jun 4, 2026

    @situchan
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: The root cause is in backend

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue: https://github.com/Expensify/Expensify/issues/645919

    Regression Test Proposal

    Test:

    1. Open workspace chat
    2. Create 2 manual expenses (same amount to trigger duplicate detection)
    3. Open the expense report
    4. Submit, approve and pay the expense report
    5. Open either paid expense
    6. Verify the "Potential duplicate" message does not appear in the header
    7. Navigate back to the paid expense report
    8. Verify the "Potential duplicate" status bar does not appear on the report

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-9589-a10e-f840-0cf4f18add24
  14. mallenexpensify commented on Jun 5, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @Krishna2323 due $250 via NewDot
    Contributor+: @situchan due $250 via NewDot

    ^ Test case created. Thx

  15. garrettmknight commented on Jun 16, 2026

    @garrettmknight
    Contributor

    $250 approved for @situchan

  16. laurenreidexpensify commented on Jun 29, 2026

    @laurenreidexpensify
    Contributor

    $250 approved for @Krishna2323

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2EngineeringReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions