Repository navigation
[Payment due @Krishna2323] Describe a rule from New rule and fall back to an agent rule - #103810
Conversation
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 74eb5c7aaa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!policy?.areCategoriesEnabled || policyCategories) { | ||
| return; | ||
| } | ||
| openPolicyCategoriesPage(policyID); |
There was a problem hiding this comment.
Wait for categories before applying the generated rule
When the categories collection is absent, openPolicyCategoriesPage() only starts an asynchronous request while the describe modal remains usable. If GenerateRule responds before that request—or the categories request fails—DescribeRuleModal calls withPolicyCategory() with policyCategories still undefined, which permanently removes a generated category before opening the flag-for-review, require-fields, or merchant editor. On a cold cache this can therefore turn a valid category-based description into an incomplete draft; defer handling/submission until categories have loaded rather than merely initiating the fetch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
(Yuwen's Agent) Thanks — real race, but I think the current design handles it acceptably and the proposed deferral would add scope I'd want to confirm first.
- The page already prefetches categories on focus (
useFocusEffect → fetchPolicyCategories) and on reconnect (useNetwork), specifically so the collection is present before an answer arrives (see the comment atRulesNewPage.tsx:98-99). generateRuleonly fires on form submit, which is seconds after focus, while the category read is a plain API read started at focus. So the read resolves well before the LLM round-trip returns in the normal case.- When
withPolicyCategorydrops the category,seedDraftAndNavigatestill opens the editor with a reviewable draft. The admin sees the empty category and picks it before saving — no silent incomplete rule is persisted.
Gating submission on a loaded collection adds a loading/recovery path (product behavior), so I'll leave it as a trade-off for now rather than expand scope here.
496fd34 to
dbcbc6a
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
(Yuwen's Agent) Thanks 🦜 — applied all 10 locale refinements in 6982ac1. The German fixes also align the |
|
I'm testing the latest changes on native devices. I'll probably finish before the CI checks are done. |
|
@chuckdries Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
🚧 yuwenmemon 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! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.5.16-0 🚀
|
|
No help site update needed. The describe-a-rule flow is behind the |
|
Deploy Blocker #104648 was identified to be related to this PR. |
|
This PR failing because of the issue #104688 |
|
🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.5.18-0 🚀
|
|
A help site update is needed. I opened Docs updates for E/A#103810 Update New rule option descriptions in Workspace Rules. This PR shortened three New rule option descriptions for all users. The Workspace Rules article still quoted the old text:
The docs PR changes only those three bullets to match the new UI copy. I didn't document the parts behind the @yuwenmemon, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.5.18-1 🚀
Bundle Size Analysis (Sentry): |
|
🤖 Payment issue created: #104872 |
@puneetlath please review
cc @Krishna2323 @JmillsExpensify
Explanation of Change
Here's the plan: Admins describe a rule once, and we build a standard rule or, failing that, draft an agent rule. New rule shows the four rule templates, then a box to describe the rule. A
ruleanswer opens that editor seeded on top, so Back returns to the description.unsupportedandmultipleRulesopen the agent rule page on the Write tab with the description prefilled and a banner explaining agent rules. Nothing saves before Create.This sits behind the
describeRulebeta. Without the beta, New rule keeps "Describe agent rule". Needs product sign-off. On HOLD for App#104055, which this builds on for the category tax rate editor.The Flag for review, Require fields and Spend editors now keep a seeded draft. With the beta, New rule has no agent option, so the Agents tab gets an Add agent rule row. The option descriptions are shorter for everyone.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/683436
PROPOSAL: N/A
Tests
Precondition: Enable the
describeRulebeta on the test account.Offline tests
QA Steps
Precondition: Enable the
describeRulebeta on the test account.Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari