Repository navigation
Enable Rules optimistically when copying merchant rules - #102985
Conversation
Co-authored-by: daledah <daledah@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
🤖 Android test steps verification results: ✅ pass All steps passed, including the offline case this PR targets. Copying Merchant rules turned Rules on in the target workspace and showed the copied rule right away, both online and offline, and the state stayed after reconnecting. The PR has no written test steps yet, so I used the repro steps from the linked issue plus an offline check.
|
This comment has been minimized.
This comment has been minimized.
1 similar comment
web-resize.mp4@MelvinBot the result looks good, please complete the author checklist and fill the Test + QA Steps section then open this PR |
|
Done. The PR is now ready for review, and PullerBear is requested as reviewer.
Please check two things. If your video came from a different platform, move it to the right section. The remaining platform sections (Android mWeb, iOS Native, iOS mWeb) are still empty. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safariweb-resize.mp4 |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 marcochavezf has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/marcochavezf in version: 9.5.4-0 🚀
|
|
No help site update needed. This PR only makes the offline (optimistic) state match what the server already does when you copy Merchant rules, and no article describes that behavior. |
|
This PR failing because of the issue #103297 |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.5.4-3 🚀
Bundle Size Analysis (Sentry): |














Explanation of Change
When you copy Merchant rules to another workspace, the backend now turns Rules on for the target. The optimistic update in
buildCopyPolicySettingsDatadid not, so while offline the target kept Rules off and the copied merchant rules stayed hidden until the server push arrived.This PR sets
areRulesEnabled: trueon each target policy when thecodingRulespart is selected, marks it pending, and clears the pending marker on success. On failure, the existing SET of the original target policy restores the old toggle. The flag is forced on even when Rules is copied too and the source has Rules off, because merchant rules are only visible while Rules is on.AI Tests
npm test -- tests/actions/CopyPolicySettingsTest.ts tests/unit/CopyPolicySettingsUtilsTest.ts: passed (115 tests, including 2 new ones)npm run typecheck: passednpm run lint-changed: passednpm run spell-changed: passednpm run fmt(oxfmt): no formatting changesFixed Issues
$ #102210
PROPOSAL: #102210 (comment)
Tests
Precondition: You have a Control workspace (Workspace A) with Rules enabled and at least one merchant rule.
Offline tests
Precondition: Same as Tests, plus a Control workspace (Workspace C) with Rules turned off. Upgrade is not available offline, so the target must already be on Control.
QA Steps
Same as Tests and Offline tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Online copy: Workspace B has Rules on and the copied merchant rule.
Offline copy: Workspace C has Rules on and the copied merchant rule, and keeps them after reconnecting.
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web-resize.mp4