Skip to content

Keep icon for 3 suggested rules after copy update - #98199

Merged
yuwenmemon merged 3 commits into
mainfrom
yuwen-659201-suggested-rule-icons
Aug 11, 2026
Merged

Keep icon for 3 suggested rules after copy update#98199
yuwenmemon merged 3 commits into
mainfrom
yuwen-659201-suggested-rule-icons

Conversation

@yuwenmemon

Copy link
Copy Markdown
Contributor

Explanation of Change

getSuggestedAgentRuleIcon picks a suggestion's icon by keyword-matching its id + title text. Web-Expensify#55257 updates the in-product suggested-rule titles with newly-reviewed copy, and three of the new titles pick up a keyword that outranks the one that used to describe them (or drop their only match entirely), silently flipping their icon. This adds an explicit per-id override for those three so their icon stays Flag regardless of how the title is worded, and adds regression tests pinned to the exact new titles.

Fixed Issues

$
PROPOSAL:

Tests

Covered entirely by unit tests, no UI to manually verify beyond what's already exercised by tests/unit/getSuggestedAgentRuleIconTest.ts.

  1. Run npx jest tests/unit/getSuggestedAgentRuleIconTest.ts.
  2. Confirm all cases pass, including the three new ones for number-of-expenses, receipt-transaction-mismatch, and itemized-split-recommended.
  • Verify that no errors appear in the JS console

Offline tests

N/A — pure client-side string matching, no network or Onyx dependency.

QA Steps

Same as tests.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Not applicable — no visual/UI change, pure logic fix covered by unit tests.

@yuwenmemon
yuwenmemon requested review from a team as code owners August 10, 2026 21:05
@melvin-bot
melvin-bot Bot requested review from mjasikowski and trjExpensify and removed request for a team August 10, 2026 21:05
@melvin-bot

melvin-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

@mjasikowski 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]

@melvin-bot
melvin-bot Bot removed the request for review from a team August 10, 2026 21:05
@yuwenmemon

Copy link
Copy Markdown
Contributor Author

(Yuwen's Agent) build (New Expensify Dev, DebugDevelopment, false) failed on this PR's first CI run — not related to this PR's changes (only src/libs/PolicyRulesUtils.ts + its test, no native iOS code).

Root cause: the remote build cache missed (Remote cache failure error: NoSuchKey), forcing a full local iOS build, which surfaced a pre-existing Swift concurrency error in a dependency:

node_modules/expo-modules-core/ios/Core/Events/EventEmitter.swift:52:17: error: sending 'emitter' risks causing data races
node_modules/expo-modules-core/ios/Core/Events/EventEmitter.swift:79:17: error: sending 'emitter' risks causing data races

Other open PRs' same build job pass in ~45s via a cache hit, so this only surfaces when the cache misses. Failed run. Re-running once the workflow finishes.

@yuwenmemon

Copy link
Copy Markdown
Contributor Author

(Yuwen's Agent) Recurred identically after the ESLint fix push — same file, same lines, same cache-miss trigger. Confirmed this is a reproducible (not one-off) issue and filed Expensify#670173 to track it separately, since it's unrelated to this PR's changes and any PR can hit it on a cold cache.

@yuwenmemon
yuwenmemon merged commit eaa0de5 into main Aug 11, 2026
42 checks passed
@yuwenmemon
yuwenmemon deleted the yuwen-659201-suggested-rule-icons branch August 11, 2026 18:33
@github-actions

Copy link
Copy Markdown
Contributor

🚧 yuwenmemon has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/yuwenmemon in version: 9.4.53-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes required.

This PR is a purely internal cosmetic fix: src/libs/PolicyRulesUtils.ts adds per-id overrides so three suggested agent rules (number-of-expenses, receipt-transaction-mismatch, itemized-split-recommended) keep their Flag icon after the suggested-rule titles were reworded. The only observable effect is which icon renders next to a suggestion — no user flow, setting, label, or documented behavior changes.

Why no docs update is needed
  • I searched App/docs/articles for anything documenting suggested-rule / agent-rule icons (icon, Flag, suggestion icon, etc.). The AI-agents articles (Create-Agent-Rules.md, How-to-Write-Agent-Rules.md, Create-and-Use-Custom-Agents.md) describe how to create and write agent rules, but never document the icon shown next to a suggestion.
  • The suggested-rule titles themselves live in Web-Expensify's InProductSuggestedRules (updated in Web-Expensify#55257), not in the help site.
  • The change is fully covered by unit tests with no UI-visible content change, so there is nothing on the help site to keep in sync.

Since no docs changes are needed, I did not open a draft help site PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants