Skip to content

[Due for payment 2026-10-20] [$175] Rules - Created merchant rule appears on duplicated workspace when rules are not selected. #102869

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.1-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: #100389
Email or phone of affected tester (no customers): ibellicotest+3215@gmail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Motorola MotoG60 / Android 12 (Hybrid app) - Windows 11 / Chrome
App Component: Workspace Settings

Action Performed:

Prerequisite: User is owner of a "Control" workspace with "Rules" enabled.
Prerequisite 2: At least one merchant rule created on "Expense Defaults"

  1. Open the staging.new.expensify.com website.
  2. Navigate to "Workspaces"
  3. Click on the three dots icon of the workspace with merchant rule created.
  4. Click on "Duplicate" > "Next"
  5. Unselect "Rules" > "Continue"
  6. Navigate to the just created duplicate > "Rules" > "Expense Defaults"
  7. Note that created merchant rule was copied, despite "Rules" being unselected during duplication.

Expected Result:

Rules should not be copied to duplicate workspace if user unselected "Rules" feature during the process.

Actual Result:

Created merchant rules are copied to duplicate workspace despite "Rules" feature being disabled during the duplication process.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

To be added by Applause Leads

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7274858

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 2, 2026
  2. applause-bot commented on Oct 2, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/5e6e1dbd4ef19aa3ffd4aa8f021169cf254afd50accef0ba0a377dac86494940

  3. MelvinBot commented on Oct 2, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    On the Duplicate workspace "Select features" page, Rules and Merchant rules are two separate checkboxes. Every checkbox starts out ticked. Unticking Rules leaves Merchant rules ticked, so the app still sends codingRules: true and the merchant rules get copied.

    Add rules engine types and merchant rule AST helpers did not cause this. It moved merchant rules to a new Onyx collection but kept the same codingRules check. The separate checkbox came from Add merchant rules option to workspace duplication, which matches the bug also happening in production.

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

    In WorkspaceDuplicateSelectFeaturesForm.tsx, make Merchant rules depend on Rules:

    1. In updateSelectedItems, unticking rules also unticks codingRules. Ticking codingRules also ticks rules, when the Rules row exists.
    2. When building parts, send codingRules: true only if codingRules is selected and either rules is selected or the Rules row isn't shown. The Rules row is hidden when the workspace has no workspace-level rules, and merchant rules should still be copyable then.
    3. Add tests:
      • A form test: unticking Rules also drops Merchant rules.
      • A PolicyTest case: {expenses: false, codingRules: false} writes no rules_ optimistic data.
    Product question and secondary issue

    Product question: The original spec, [Due for payment 2026-02-27] [$250] Feature: Ensure workspace merchant coding rules are copied to new workspace when duplicating workspaces, asked for a separate Merchant rules checkbox. If product wants the two to stay independent, this works as designed. In that case, change the optimistic areRulesEnabled at Policy.ts:3331 to expenses || codingRules. The duplicate then won't show merchant rules under a disabled Rules feature.

    Secondary issue: The "select all" effect at lines 329-335 runs again whenever items.length changes. If merchant rules load after the page opens, the Merchant rules row shows up late and re-ticks everything the user unticked. This can happen when Duplicate is opened from the Workspaces list right after sign-in. Fix it by adding only new items to the selection instead of resetting the whole selection. This probably wasn't the cause here, because the tester created the rule earlier, so the rules were already loaded.

    Not verified: I didn't reproduce this in a live session or check the DuplicatePolicy request payload. If the request shows codingRules: false and the rules were still copied, the cause is a backend/internal issue instead.

    What alternative solutions did you explore? (Optional)

    Remove the separate Merchant rules row and copy merchant rules whenever Rules is ticked. This is simpler, but it drops the separate choice that the original feature added.

    Related open issues:


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/102869) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 2, 2026
  5. melvin-bot commented on Oct 2, 2026

    @melvin-bot

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

  6. changed the title [-]Rules - Created merchant rule appears on duplicated workspace when rules are not selected.[/-] [+][$175] Rules - Created merchant rule appears on duplicated workspace when rules are not selected.[/+] on Oct 2, 2026
  7. melvin-bot commented on Oct 2, 2026

    @melvin-bot
  8. camesenin commented on Oct 2, 2026

    @camesenin
  9. camesenin commented on Oct 2, 2026

    @camesenin
  10. melvin-bot commented on Oct 2, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  11. TaduJR commented on Oct 2, 2026

    @TaduJR
    Contributor

    Reviewing...

  12. 25 remaining items

  13. melvin-bot commented on Oct 19, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  14. melvin-bot commented on Oct 19, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    Upwork Job

    • Assignee: @TaduJR requires payment (Needs manual offer from BZ)

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  15. mallenexpensify commented on Oct 20, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @TaduJR paid $175 via Upwork

    @TaduJR can you please accept the job below? Please reply here and tag me once you have.
    https://www.upwork.com/jobs/~022105971153842020322

    @TaduJR plz complete the Contributor+ checklist and tag me in a post once you have. Thx

  16. TaduJR commented on Oct 20, 2026

    @TaduJR
    Contributor

    Offer Accepted @mallenexpensify

    Thanks!

  17. mallenexpensify commented on Oct 20, 2026

    @mallenexpensify
    Contributor

    @TaduJR paid, summary updated above. Thx.

    @TaduJR plz complete the Contributor+ checklist and tag me in a post once you have. Thx

  18. TaduJR commented on Oct 20, 2026

    @TaduJR
    Contributor

    @TaduJR plz complete the Contributor+ checklist and tag me in a post once you have. Thx

    Ohh how did I miss that. Adding now.

  19. mallenexpensify commented on Oct 21, 2026

    @mallenexpensify
    Contributor

    @TaduJR 👀 above

  20. TaduJR commented on Oct 21, 2026

    @TaduJR
    Contributor

    Contributor+ Checklist:

    Regression Test Proposal

    Precondition:

    • Be an admin of a Control workspace with Rules turned on and at least one merchant rule under Rules > Expense defaults.

    Test:

    1. Go to Workspaces.
    2. Open the three-dot menu of the workspace with the merchant rule and click Duplicate workspace > Next.
    3. Uncheck Rules and verify Merchant rules is unchecked too.
    4. Check Merchant rules and verify Rules is checked too.
    5. Uncheck Rules again and click Continue.
    6. Open the new workspace > More features and turn on Rules.
    7. Go to Rules > Expense defaults and verify the merchant rule from the original workspace isn't listed.

    Do we agree 👍 or 👎

  21. TaduJR commented on Oct 21, 2026

    @TaduJR
    Contributor

    @TaduJR 👀 above

    Done @mallenexpensify

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