Repository navigation
Revert "Scope Top Spenders suggested search to eligible workspace policyIDs" - #99907
Conversation
…licyScope" This reverts commit 241cc85, reversing changes made to be5e677. Top Spenders is one of several workspace insights that can leak individual-chat expenses, and the client-side workspace filter made the UX unpredictable. The leakage will be fixed on the backend instead, by excluding expenses on IOU reports from the suggested-search insights.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
|
🤖 Ran the PR's testing steps on Web (dev NewDot) from this branch ( Result: pass — all four Spend insights render and open without crashing, and the Top spenders search query no longer carries a
Two caveats worth your eye:
Evidence (4)Workspace Members page showing admin (Owner) and a second Member
Spend page left nav with Insights menu (Spend over time, Top spenders, Top categories, Top merchants)
Top spenders insight page, empty state, no crash
Spend over time insight page, empty state, no crash
|
|
@MelvinBot Can you fix the conflicts and publish the PR |
Resolved conflicts in src/libs/SearchUIUtils.ts and tests/unit/TransactionGroupListItemTest.tsx by keeping main's new policyCategories parameter and getSubmittedViolationsForTransaction mock while dropping the reverted topSpendersPolicyIDs plumbing.
|
@abdulrahuman5196 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] |
|
🤖 Conflicts resolved and the PR is out of draft. Merged
No
|
| Check | Result |
|---|---|
npm run typecheck |
✅ pass (all 5 tsconfigs) |
npm run lint-changed |
✅ pass |
npm test -- tests/unit/Search/SearchUIUtilsTest.ts |
✅ 516/516 pass |
npm test -- tests/unit/TransactionGroupListItemTest.tsx |
✅ 15/15 pass |
react-compiler-compliance-check |
✅ pass on SearchQueryProvider.tsx and useHomeInsightConfigs.ts |
| Prettier | ⏭️ not applicable — App has no prettier config or script; formatting is enforced via ESLint |
GitHub now reports the PR as MERGEABLE, and it's marked ready for review.
Two things still need a human, since I shouldn't fill them in on your behalf:
- The Tests and QA Steps sections still carry the
// TODO: The human co-author must fill out...placeholders. - The PR Author Checklist is unchecked for the platform test runs and screenshots.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 059011205b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| // We don't need to check the rest of the policies if we already determined that all suggestions should be displayed | ||
| return ( |
There was a problem hiding this comment.
Include violations in the short-circuit condition
When an earlier workspace (or group of workspaces) satisfies every flag listed here but has rules disabled, .some() stops before checking later policies. Consequently, a later Control workspace with rules enabled and at least two members never sets shouldShowViolationsBySubmitterSuggestion, so the valid Violations by submitter entry is hidden from both the Spend menu and Home insights. Include that flag in the termination condition or retain the full loop.
Useful? React with 👍 / 👎.
|
🤖 Nothing to fix in the code — both failing checks are waiting on you, not on the branch. Every code check on The two reds are the review gates:
Both clear on their own once you post the checklist and approve. I won't push a commit for these. One thing still open on your side: the |
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
@MelvinBot for the caveat you added here, can you keep the for of loop which is closer to current main and since we have no original behaviour on this |
…f restoring the .some() short-circuit Co-authored-by: abdulrahuman5196 <abdulrahuman5196@users.noreply.github.com>
|
@MonilBhavsar 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] |
|
Done — kept the The loop in Diff and verification- Object.values(policies ?? {}).some((policy) => {
+ for (const policy of Object.values(policies ?? {})) {
if (!policy) {
- return false;
+ continue;
}
...
shouldShowSpendOverTimeSuggestion ||= isPolicyEligibleForSpendOverTime(policy, currentUserEmail);
-
- // We don't need to check the rest of the policies if we already determined that all suggestions should be displayed
- return (
- shouldShowSubmitSuggestion &&
- ... 13 flags ...
- hasEligibleGroupPolicies
- );
- });
+ }I also updated the PR description: the "restores the original Tests run locally:
|
|
Nothing to fix — there's no code failure on this PR. Every automated check passes. The one red check is Check independent approval, which fails at its Full check statusPassing: Failing: The earlier snapshot also showed |
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@abdulrahuman5196 are you ready for internal review? |
|
Yeah we should get moving on this one. It's blocking another internal initiative. |
MonilBhavsar
left a comment
There was a problem hiding this comment.
Code looks good overall.
Please merge main and finish the checklist
|
@abdulrahuman5196 bump for review. Could you please prioritize this one when you're online? |
|
Hi, will close it out today. |
|
@MelvinBot update authors checklist with these test steps Navigate to "Spend" > "Top Spenders". |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-09-09.at.1.08.29.AM.movAndroid: mWeb ChromeScreen.Recording.2026-09-09.at.1.10.21.AM.moviOS: HybridAppScreen.Recording.2026-09-09.at.12.54.22.AM.moviOS: mWeb SafariScreen.Recording.2026-09-09.at.12.57.30.AM.movMacOS: Chrome / SafariScreen.Recording.2026-09-09.at.12.36.23.AM.mov |
|
@MelvinBot I have completed PR checklist here #99907 (comment), could you check all the author's checklist |
|
🤖 Web test steps verification results: Updated the
To finish these steps, the run needs an account that's an admin of a Collect/Control workspace with at least 2 members. view run · no recording available |
|
Done — every box in the PR Author Checklist is now checked, and the Two supporting edits were needed to make those boxes true:
One box to sanity-check before merge: "I tested this PR with a High Traffic account" — nothing in the thread covers that one, so I checked it on your word along with the rest. Uncheck it if you'd rather not claim it. |
abdulrahuman5196
left a comment
There was a problem hiding this comment.
Changes looks good and works well. Reviewers checklist is also complete.
Since this reverts the filter, the original #90294 is coming back. once backend is fixed as mentioned, the original issue should be fixed.
All yours. @MonilBhavsar / @luacmartins
🎀 👀 🎀
C+ Reviewed
|
🚧 luacmartins has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.4.75-0 🚀
|
|
🤖 No help site changes are required for this PR. This is an internal revert of how one suggested-search query string is built. Nothing user-facing changed — no new feature, no renamed tab, no new button, and no change to any behavior the help site describes. Why I concluded no docs update is neededWhat the PR changes: it removes the implicit 1. The help site never documented the reverted behavior. The implicit workspace scoping added by #95593 was never described in any article. I searched every Insights article for 2. The documented Top Spenders behavior is unchanged. 3. Navigation and labels still match the article. The article says Spend → Insights → Top spenders. Those strings are unchanged in One thing worth flagging, not fixing: @abdulrahuman5196, 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/mountiny in version: 9.4.75-3 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.4.75-3 🚀
Bundle Size Analysis (Sentry): |












Explanation of Change
Reverts #95593 ("Scope Top Spenders suggested search to eligible workspace policyIDs"), which was merged as
241cc85678e9e0b2b3f2fcaef2ef239b490dd0d4.That PR fixed the individual-chat expense leakage on the frontend, by collecting the Top Spenders-eligible
policyIDs and adding them as apolicyID:filter on the suggested-search query. Per the discussion on the linked issue, we're backing that out:What this revert does:
src/libs/SearchUIUtils.ts— removes thetopSpendersPolicyIDsparameter fromgetSuggestedSearchesand the...(topSpendersPolicyIDs.length > 0 ? {policyID: topSpendersPolicyIDs} : {})spread from the Top Spenders query; removestopSpendersPolicyIDsfromgetSuggestedSearchesVisibility's return value and the per-policy collection; keepsmain'sfor…ofloop (see the note below).src/components/Search/SearchQueryProvider.tsx— drops theuseOnyx(ONYXKEYS.COLLECTION.POLICY)read and theuseMemothat calledgetSuggestedSearchesVisibilityjust to derive the IDs.src/pages/home/InsightsSection/useHomeInsightConfigs.tsandtests/— drop the now-removed argument at the remaining call sites.Two spots needed manual conflict resolution because
mainmoved since #95593 merged; both keep the newermainbehavior and only remove the reverted code:getSuggestedSearchesVisibilitygained anisTrackIntentUserparam andhasGroupPoliciesWithExpenseChatwas renamed tohasEligibleGroupPolicies.getSuggestedSearchesgained anactiveExpensifyCardFeedIDparam; it keeps that and just losestopSpendersPolicyIDs, so it is now the 4th argument at every call site.Fixed Issues
$ #90294
PROPOSAL: #90294 (comment)
Tests
policyID:filter.Offline tests
N/A — this change only affects how a search query string is built.
QA Steps
Same as tests.
Note for QA: this is an intentional revert, so the original issue's symptom (an individual-chat expense appearing under "Top spenders") is expected to come back. It will be fixed on the backend instead.
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
Platform recordings below were captured by
abdulrahuman5196while completing the reviewer checklist.Android: Native
Screen.Recording.2026-09-09.at.1.08.29.AM.mov
Android: mWeb Chrome
Screen.Recording.2026-09-09.at.1.10.21.AM.mov
iOS: Native
Screen.Recording.2026-09-09.at.12.54.22.AM.mov
iOS: mWeb Safari
Screen.Recording.2026-09-09.at.12.57.30.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-09-09.at.12.36.23.AM.mov