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
Workspace rule takes precedence over personal rule #82223
Version Number: v9.3.17-6 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:#81033 Email or phone of affected tester (no customers):kiatest.80+ck212263@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: iPhone 16/iOS 18.7.1 App Component: Money Requests
Action Performed:
Launch Hybrid app
As a admin of workspace, apply following rules:
Create workspace rule for "Amazon" → Category: "Office Supplies"
Create personal rule for "Amazon" → Category: "Software" (Account >> Expense Rules)
Create workspace rule for "Amazon" → Category: "Travel" (newer, should lose)
Go to workspace chat
Create an expense with merchant: "Amazon"
Observe workspace rule get applied instead of personal rule
Expected Result:
Personal rule wins → Category: "Software". Personal rule should take precedence over workspace rule
Actual Result:
Workspace rule takes precedence over personal rule. Workspace rule with category "Office Supplies" get applied
👋 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:
Identify the pull request that introduced this issue and revert it.
Classification: Backend bug Causing PR: #81033 - "Enable merchant rules" by @luacmartins (High confidence) Related Issues: None identified
Recommendation: NEEDS INVESTIGATION
This is a backend bug where the rule precedence logic is incorrect. PR #81033 simply removed the production environment check that was hiding merchant rules from production users, which exposed a pre-existing backend bug in the rule precedence logic.
According to the official documentation, personal expense rules should take precedence over workspace merchant rules. However, the current implementation is applying workspace rules instead.
Since this is a backend precedence logic issue, it requires investigation by the backend team to fix the rule application order on the server side.
Labels: Removed DeployBlockerCash label since this is a backend bug. Keeping DeployBlocker label.
📋 Detailed Analysis
Evidence
PR #81033 was a simple change that removed the isProduction environment check from src/pages/workspace/rules/MerchantRulesSection.tsx, enabling merchant rules for all users. This PR itself did not introduce rule precedence logic—it only made the feature visible to production users.
The bug was reported as:
Expected: Personal rule with category "Software" should be applied
Actual: Workspace rule with category "Office Supplies" is applied instead
The test specifically created multiple rules to test precedence:
Workspace rule for "Amazon" → Category: "Office Supplies"
Personal rule for "Amazon" → Category: "Software"
Workspace rule for "Amazon" → Category: "Travel" (newer, loses to older workspace rule)
"What happens if a personal expense rule and a Workspace Merchant Rule both apply?
Personal expense rules take precedence over Workspace Merchant Rules."
This confirms the reported behavior is indeed a bug. The rule application logic exists on the backend (rules are applied when expenses are created via API calls), not in the frontend App code.
Root Cause
The rule precedence logic is implemented on the backend. When an expense is created with a merchant name that matches both personal and workspace rules, the backend should:
First check for matching personal rules
Only apply workspace rules if no personal rule matches
Currently, it appears the backend is applying workspace rules without properly checking for personal rule precedence, or the precedence order is reversed.
Since PR #81033 only removed a UI visibility check and did not modify any rule application logic, this is a backend bug that was always present but only became visible when merchant rules were enabled for production users.
I have removed the DeployBlockerCash label because this is a backend bug that requires a backend fix, not an App revert or fix.
Why this is a backend bug:
PR Enable merchant rules #81033 only changed frontend code to show the merchant rules UI in production (removed an isProduction check)
The rule precedence logic that determines which rule to apply (personal vs workspace) is implemented on the backend
No App code change caused the incorrect precedence behavior
The fix needs to happen in the backend API that applies rules to expenses
The bug blocks deploying because it affects core functionality (expense rule precedence), but there is no App PR to revert. The backend team needs to investigate and fix the rule application logic on the server side.
Discussing this. The logic currently fails because we first apply the workspace rule, which sets a category. And then we run into this logic that only applies a category if one is not set, effectively skipping the personal rule
Activity
melvin-bot commentedon Feb 12, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #81033
melvin-bot commentedon Feb 12, 2026
💬 A slack conversation has been started in #expensify-open-source
melvin-bot commentedon Feb 12, 2026
Triggered auto assignment to @NicMendonca (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.github-actions commentedon Feb 12, 2026
👋 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:
OSBotify commentedon Feb 12, 2026
🔍 Investigation Summary
Classification: Backend bug
Causing PR: #81033 - "Enable merchant rules" by @luacmartins (High confidence)
Related Issues: None identified
Recommendation: NEEDS INVESTIGATION
This is a backend bug where the rule precedence logic is incorrect. PR #81033 simply removed the production environment check that was hiding merchant rules from production users, which exposed a pre-existing backend bug in the rule precedence logic.
According to the official documentation, personal expense rules should take precedence over workspace merchant rules. However, the current implementation is applying workspace rules instead.
Since this is a backend precedence logic issue, it requires investigation by the backend team to fix the rule application order on the server side.
Labels: Removed
DeployBlockerCashlabel since this is a backend bug. KeepingDeployBlockerlabel.📋 Detailed Analysis
Evidence
PR #81033 was a simple change that removed the
isProductionenvironment check fromsrc/pages/workspace/rules/MerchantRulesSection.tsx, enabling merchant rules for all users. This PR itself did not introduce rule precedence logic—it only made the feature visible to production users.The bug was reported as:
Verification
The official documentation explicitly states:
This confirms the reported behavior is indeed a bug. The rule application logic exists on the backend (rules are applied when expenses are created via API calls), not in the frontend App code.
Root Cause
The rule precedence logic is implemented on the backend. When an expense is created with a merchant name that matches both personal and workspace rules, the backend should:
Currently, it appears the backend is applying workspace rules without properly checking for personal rule precedence, or the precedence order is reversed.
Since PR #81033 only removed a UI visibility check and did not modify any rule application logic, this is a backend bug that was always present but only became visible when merchant rules were enabled for production users.
OSBotify commentedon Feb 12, 2026
Update
I have removed the
DeployBlockerCashlabel because this is a backend bug that requires a backend fix, not an App revert or fix.Why this is a backend bug:
isProductioncheck)The bug blocks deploying because it affects core functionality (expense rule precedence), but there is no App PR to revert. The backend team needs to investigate and fix the rule application logic on the server side.
luacmartins commentedon Feb 12, 2026
Discussing this. The logic currently fails because we first apply the workspace rule, which sets a category. And then we run into this logic that only applies a category if one is not set, effectively skipping the personal rule
JS00001 commentedon Feb 13, 2026
This is fixed by https://github.com/Expensify/Web-Expensify/pull/50712 as well
luacmartins commentedon Feb 17, 2026
PR is merged. Closing.