Skip to content

[Due for payment 2026-05-28] [$250] Expense - Duplicate expense created in the Expired Workspace #84368

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.32-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #83736
Email or phone of affected tester (no customers): luongquocvu92+010125@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Windows 10/Chrome
App Component: Money Requests

Action Performed:

Preconditions: User has an Expired Workspace and is a member of another Workspace

  1. Open the Workspace user as a member
  2. Click on an expense has created
  3. Click on the More button
  4. Select Duplicate expense
  5. Go to the Expired Workspace chat

Expected Result:

The duplicate expense should not be created in the Expired Workspace

Actual Result:

The duplicate expense displays in the Expired Workspace

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022043613175711864263
  • Upwork Job ID: 2043613175711864263
  • Last Price Increase: 2026-04-20

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed on Apr 13, 2026
  2. MelvinBot commented on Apr 13, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The duplicate expense flow never checks whether the target workspace has expired billing. When a user clicks "Duplicate expense," useDefaultExpensePolicy selects the target workspace using isPolicyAccessible, which only verifies the policy exists, isn't pending deletion, and the user has a role — it does not check billing/expiration status.

    The function shouldRestrictUserBillableActions exists for exactly this purpose and is already used in the Add Expense handler (MoneyReportHeader.tsx:1778), but it is missing from the Duplicate Expense handler (MoneyReportHeader.tsx:1483-1521).

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

    Add the same shouldRestrictUserBillableActions guard that exists in the Add Expense handler to the Duplicate Expense handler. Specifically, in MoneyReportHeader.tsx, inside the DUPLICATE_EXPENSE onSelected callback (around line 1483), add a check before proceeding with the duplication:

    If the target policy (from defaultExpensePolicy) has restricted billable actions, navigate to ROUTES.RESTRICTED_ACTION and return early — exactly as the Add Expense handler does at line 1778.

    The same fix should also be applied to the transaction-level duplicate action in MoneyRequestHeaderSecondaryActions.tsx which has the same gap.

    Investigation details

    Data flow (no expiration check at any step):

    1. User clicks "Duplicate expense" → MoneyReportHeader.tsx:1478
    2. isDuplicateAction() gate (ReportSecondaryActionUtils.ts:813-839) checks transaction count, scanning status, submitter — no expiration check
    3. useDefaultExpensePolicy() selects target workspace via isPolicyAccessible() (PolicyUtils.ts:1787-1795) — only checks non-empty, has ID, not pending-delete, user has role
    4. duplicateExpenseTransaction() (Duplicate.ts:665) creates expense in the target policy with no billing validation

    Contrast with Add Expense (which works correctly):

    • MoneyReportHeader.tsx:1778 calls shouldRestrictUserBillableActions(policy.id, ...) and navigates to the restricted action route if the workspace is expired

    Both entry points affected:

    • Report-level: MoneyReportHeader.tsx:1478-1521
    • Transaction-level: MoneyRequestHeaderSecondaryActions.tsx:204-238

    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.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 13, 2026
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 13, 2026
  5. melvin-bot commented on Apr 13, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)

  6. changed the title [-]Expense - Duplicate expense created in the Expired Workspace[/-] [+][$250] Expense - Duplicate expense created in the Expired Workspace[/+] on Apr 13, 2026
  7. 37 remaining items

  8. melvin-bot commented on May 21, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  9. melvin-bot commented on May 21, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.78-1 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-05-28. 🎊

    For reference, here are some details about the assignees on this issue:

    • @eVoloshchak requires payment through NewDot Manual Requests
  10. melvin-bot commented on May 21, 2026

    @melvin-bot

    @eVoloshchak The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  11. melvin-bot commented on May 26, 2026

    @melvin-bot

    @eVoloshchak Huh... This is 4 days overdue. Who can take care of this?

  12. melvin-bot commented on May 27, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. eVoloshchak commented on May 27, 2026

    @eVoloshchak
    Contributor

    BugZero Checklist:

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

      Link to the comment on the PR: N/A, this was simply never implemented
      Link to the comment on the Issue:

    • [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: regression wasn't critical

    • [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.

    Regression Test Proposal

    Precondition:

    • User has an Expired Workspace and is a member of another Workspace

    Test:

    1. Open the Workspace user as a member
    2. Click on an already existing expense
    3. Click on the More button
    4. Select Duplicate expense
    5. Verify that you're prompted to add a payment card

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-aea2-a993-ac52-d2cb375ad234
  14. melvin-bot commented on May 28, 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/2043613175711864263/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
  15. mallenexpensify commented on May 29, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @eVoloshchak due $250 via NewDot

    ^ Test case created. Thx

  16. JmillsExpensify commented on Aug 3, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @eVoloshchak

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions