Repository navigation
Description
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.67-3
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #87737
Email or phone of affected tester (no customers): applausetester+newccpiyo@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: iPhone 13 / iOS 26.5
App Component: Workspace Settings
Action Performed:
Preconditions
- Logged in to expensifail account -> create a workspace -> enable rule -> add merchant rule
Steps:
- Create another workspace
- Tap more feature in newly workspace setting and enable rules
- Tap rules -> scroll down to merchant section
- Tap "Add merchant rule" and fill the adding rule process
- Tap save rule -> note that the added merchant rule displayed correctly
- Navigate to account -> Troubleshoot -> Tap "clear cache and restart" and confirm it
- Back to the just created workspace and navigate to rule in workspace setting
- Scroll down to Merchant section
- Tap "Add merchant rule" and fill the adding rule process then save the rule -> note that both merchant rules are now displayed
Expected Result:
in step 8, after clear cache and restart, the first added merchant rule shouldn't be disappeared
Actual Result:
in step 8, added merchant rule disappeared after clear cache and restart
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Bug7145608_1778044949855.merchant_rule.mp4
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022054386451270274100
- Upwork Job ID: 2054386451270274100
- Last Price Increase: 2026-05-13
Issue Owner
Current Issue Owner: @allgandalfMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
MelvinBot commentedon May 13, 2026
Proposal
What is the root cause of that problem?
Merchant rules (
codingRules) are stored as a nested property on the Policy Onyx object atpolicy.rules.codingRules. They are properly persisted to the backend viaAPI.write(SET_POLICY_CODING_RULE), but they are only fetched from the backend via theOpenPolicyRulesPageREAD command, which is a lazy-load call that only fires when the user navigates to the Rules page.When "Clear cache and restart" is triggered,
clearOnyxAndResetAppwipes all Onyx data and then callsOpenApp. TheOpenAppcommand returns basic policy data but does not includecodingRules. When the user then navigates to the Rules page,PolicyRulesPagecallsopenPolicyRulesPageon mount — but the backend's response for this READ command appears to not returncodingRules, since the rules remain missing until the user adds a new rule (at which point theSET_POLICY_CODING_RULEAPI response brings back all coding rules, including the previously "missing" one).What changes do you think we should make in order to solve the problem?
This is likely a backend issue: the
OpenPolicyRulesPageAPI handler needs to includecodingRulesin its Onyx response data so that existing merchant rules are loaded when the user navigates to the Rules page after a cache clear.To confirm, verify whether the
OpenPolicyRulesPagebackend handler returnscodingRulesin its Onyx updates. If it doesn't, addcodingRulesto the response payload alongside other rule types (approvalRules,expenseRules).What alternative solutions did you explore? (Optional)
An alternative client-side approach would be to eagerly fetch rules data during
OpenApp/ReconnectAppfor policies that have rules enabled, but this would add unnecessary overhead for most users. The proper fix is ensuringOpenPolicyRulesPagereturns complete data.Investigation details
Data flow (normal):
setPolicyCodingRule()optimistically updates Onyx AND callsAPI.write(SET_POLICY_CODING_RULE)to persist on the backendMerchantRulesSectionwhich readspolicy?.rules?.codingRulesData flow (after cache clear):
clearOnyxAndResetApp()wipes ALL Onyx data includingpolicy.rules.codingRulesOpenAppfires → returns policy data withoutcodingRulesopenPolicyRulesPage()fires viauseEffect→ backend response does not populatecodingRulesMerchantRulesSectionreadspolicy?.rules?.codingRules→ undefined → no rules shownSET_POLICY_CODING_RULEwrite succeeds → server response includes all coding rules → both old and new rules appearStep 5 proves the rules are persisted on the backend. The gap is in step 3:
OpenPolicyRulesPageisn't returning them.Key evidence: The issue's step 9 shows that after adding a new merchant rule post-cache-clear, both the old and new rules appear — confirming the backend has the data but
OpenPolicyRulesPageisn't serving it.Possibly related: Expensify/App#83130 — offline-deleted rules reappearing after reconnecting until cache is cleared (inverse symptom, same data persistence area).
Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.melvin-bot commentedon May 13, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @cretadn22 (
External)[-]WS Setting - Added merchant rule disappeared after clear cache and restart[/-][+][$250] WS Setting - Added merchant rule disappeared after clear cache and restart[/+]melvin-bot commentedon May 13, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022054386451270274100
neerajbachani commentedon May 13, 2026
Proposal
What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
18 remaining items
allgandalf commentedon May 28, 2026
Hello, Sorry for missing the last ping somehow.
I'm about to go OoO till monday and i have some higher priority things to work on today before i log off, since this issue was reported by internal QA team and not customers, I hope it would be fine that i look into this after i'm back.Apologies for the delay here :) Please reassign if it priority is higherScratch that, i took a glance and the issue seemed easier than i thought so i have a PR ready:
allgandalf commentedon May 28, 2026
The merchant rules was not something which was available at the time i created the PR for
OpenPolicyRulesPagecommand, so i'll also notify the authors who implemented it to point it out for their contextEdit:
Commented here https://github.com/Expensify/Expensify/issues/593005#issuecomment-4561392271
mvtglobally commentedon May 30, 2026
Issue not reproducible during KI retests. (First week)
allgandalf commentedon Jun 1, 2026
@mvtglobally please test in a non default workspace , the bug is still reproducible
allgandalf commentedon Jun 1, 2026
Asked for retest https://expensify.slack.com/archives/C09V78U42D8/p1780288756708719
IuliiaHerets commentedon Jun 1, 2026
Reproducible on iPhone 13/iOS 26.5 v9.3.89-5
45a8e4fdcc28bd8103df77a2bd5b3108.mp4
allgandalf commentedon Jun 2, 2026
Backend PR was merged, awaiting deploy
allgandalf commentedon Jun 4, 2026
PR was deployed, closing https://github.com/Expensify/Auth/pull/21898#issuecomment-4613308785
allgandalf commentedon Jun 4, 2026
Asked for retest just in case https://expensify.slack.com/archives/C09V78U42D8/p1780549936520109
IuliiaHerets commentedon Jun 4, 2026
Not repro on iPhone 12/iOS 26.5/Build v9.3.98-1
90d4fe85-6d4f-4538-a2b6-1a6b37045f96.mp4