You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-10-20] [$175] Rules - Created merchant rule appears on duplicated workspace when rules are not selected. #102869
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"
Open the staging.new.expensify.com website.
Navigate to "Workspaces"
Click on the three dots icon of the workspace with merchant rule created.
Click on "Duplicate" > "Next"
Unselect "Rules" > "Continue"
Navigate to the just created duplicate > "Rules" > "Expense Defaults"
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.
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.
The app creates optimistic rule copies when codingRules is true (Policy.ts:3647). It sets areRulesEnabled from expenses only (Policy.ts:3331). So the duplicate can end up with merchant rules while its Rules feature is turned off.
What changes do you think we should make in order to solve the problem?
In WorkspaceDuplicateSelectFeaturesForm.tsx, make Merchant rules depend on Rules:
In updateSelectedItems, unticking rules also unticks codingRules. Ticking codingRules also ticks rules, when the Rules row exists.
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.
Add tests:
A form test: unticking Rules also drops Merchant rules.
A PolicyTest case: {expenses: false, codingRules: false} writes no rules_ optimistic data.
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.
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.
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
[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
Link to the comment on the Issue: N/A
[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: N/A, not critical. It only affects which rules are copied when duplicating a workspace.
[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:
Be an admin of a Control workspace with Rules turned on and at least one merchant rule under Rules > Expense defaults.
Test:
Go to Workspaces.
Open the three-dot menu of the workspace with the merchant rule and click Duplicate workspace > Next.
Uncheck Rules and verify Merchant rules is unchecked too.
Check Merchant rules and verify Rules is checked too.
Uncheck Rules again and click Continue.
Open the new workspace > More features and turn on Rules.
Go to Rules > Expense defaults and verify the merchant rule from the original workspace isn't listed.
Activity
applause-bot commentedon Oct 2, 2026
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
MelvinBot commentedon Oct 2, 2026
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: trueand the merchant rules get copied.rulesandcodingRules(WorkspaceDuplicateSelectFeaturesForm.tsx:152-167).expensescomes fromrules, andcodingRulescomes fromcodingRules(lines 241 and 248).codingRulesis true (Policy.ts:3647). It setsareRulesEnabledfromexpensesonly (Policy.ts:3331). So the duplicate can end up with merchant rules while its Rules feature is turned off.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
codingRulescheck. 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:updateSelectedItems, untickingrulesalso untickscodingRules. TickingcodingRulesalso ticksrules, when the Rules row exists.parts, sendcodingRules: trueonly ifcodingRulesis selected and eitherrulesis 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.PolicyTestcase:{expenses: false, codingRules: false}writes norules_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
areRulesEnabledat Policy.ts:3331 toexpenses || 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.lengthchanges. 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
DuplicatePolicyrequest payload. If the request showscodingRules: falseand 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
melvin-bot commentedon Oct 2, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @TaduJR (
External)[-]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.[/+]melvin-bot commentedon Oct 2, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022105971153842020322
camesenin commentedon Oct 2, 2026
camesenin commentedon Oct 2, 2026
melvin-bot commentedon Oct 2, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
TaduJR commentedon Oct 2, 2026
Reviewing...
25 remaining items
melvin-bot commentedon Oct 19, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Oct 19, 2026
Payment Summary
Resolving PRs:
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Oct 20, 2026
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
TaduJR commentedon Oct 20, 2026
Offer Accepted @mallenexpensify
Thanks!
mallenexpensify commentedon Oct 20, 2026
@TaduJR paid, summary updated above. Thx.
@TaduJR plz complete the Contributor+ checklist and tag me in a post once you have. Thx
TaduJR commentedon Oct 20, 2026
Ohh how did I miss that. Adding now.
mallenexpensify commentedon Oct 21, 2026
@TaduJR 👀 above
TaduJR commentedon Oct 21, 2026
Contributor+ 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.
Not a regression. Add merchant rules option to workspace duplication #81514 (issue [Due for payment 2026-02-27] [$250] Feature: Ensure workspace merchant coding rules are copied to new workspace when duplicating workspaces #81364) added Merchant rules as its own checkbox, as the spec asked. The spec didn't say whether it should depend on Rules, and product decided here that it should (comment). No comment is needed on that PR.
Link to the comment on the PR: N/A
Link to the comment on the Issue: N/A
[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: N/A, not critical. It only affects which rules are copied when duplicating a workspace.
[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:
Test:
Do we agree 👍 or 👎
TaduJR commentedon Oct 21, 2026
Done @mallenexpensify