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.50-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/folder/13176922/test-cases/41237519
Email or phone of affected tester (no customers): applausetester+la4jjj@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 11, Chrome | iPhone SE 3rd generation, iOS 26.4
App Component: Search
Action Performed:
Preconditions:
- The user is signed in with an Expensifail account.
- The user has a unsubmitted expense in the workspace.
- Go to https://staging.new.expensify.com/
- Navigate to Reports > Expenses
- Copy this: type:expense-report action:submit from:me (note: any query using from:me does not work)
- Paste it on the search field 'Search for something' and press Enter, or select the first highlighted option.
Expected Result:
After pasting type:expense-report action:submit from:me and selecting the first highlighted option or pressing Enter, me should turn green, and the system should correctly apply the filter, returning only the expense reports submitted by the current user.
Actual Result:
When the query type:expense-report action:submit from:me is used, me does not turn green, meaning it is not detected. The system redirects to the expected page but fails to filter by me, showing unfiltered results instead
Workaround:
Unknown
Platforms:
- Android: App
- Android: mWeb Chrome
- iOS: App
- iOS: mWeb Safari
- iOS: mWeb Chrome
- Windows: Chrome
- MacOS: Chrome / Safari
Screenshots/Videos
Video.mp4
Issue Owner
Current Issue Owner: @mallenexpensifyUpwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022037804379216972874
- Upwork Job ID: 2037804379216972874
- Last Price Increase: 2026-05-02
- Automatic offers:
- wildan-m | Contributor | 111364060
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
MelvinBot commentedon Mar 28, 2026
Proposal
What is the root cause of that problem?
The
mekeyword in search queries (e.g.,from:me) is not a grammar-level construct — it's purely a display-layer convention. The entiremeworkflow depends on the substitution map being populated when the user selects themselves from the autocomplete dropdown.When using autocomplete (works): Selecting "me" from the dropdown triggers
SearchRouter.tsx:283-285to add{"from:me": "<accountID>"}to the substitution map. The validation functionfilterOutRangesWithCorrectValueatSearchAutocompleteUtils.ts:190then finds the substitution entry, turns "me" green, and on submitgetQueryWithSubstitutionsreplaces "me" with the actual accountID.When pasting/typing directly (broken): No autocomplete interaction occurs, so the substitution map is never populated. Two things fail:
Highlighting fails —
filterOutRangesWithCorrectValue(SearchAutocompleteUtils.ts:190) checkssubstitutionMap["from:me"](undefined) anduserLogins.includes("me")(false, since userLogins contains emails). So "me" never turns green. Notably,parseForLiveMarkdownat line 280 does check forCONST.SEARCH.ME, but it runs in.map()after the.filter()that already rejected the range.Query substitution fails —
getQueryWithSubstitutionsfinds no substitution entry, so "me" passes through literally. ThengetUpdatedFilterValue(SearchQueryUtils.ts:309-310) callsgetPersonalDetailByEmail("me")which returns undefined because "me" is not a real email. The literal string "me" gets sent to the backend instead of the user's accountID.What changes do you think we should make in order to solve the problem?
Two changes are needed:
1. Fix highlighting — In
filterOutRangesWithCorrectValue(src/libs/SearchAutocompleteUtils.ts:190), add|| range.value === CONST.SEARCH.MEto the return condition for the personal filter keys (FROM,TO,ASSIGNEE,PAYER,EXPORTER,ATTENDEE). This ensures "me" turns green even when typed/pasted without autocomplete.2. Fix query substitution — In
getUpdatedFilterValue(src/libs/SearchQueryUtils.ts:309-310), add a check: iffilterValue === CONST.SEARCH.ME, resolve it to the current user's accountID (available viacurrentUserAccountID$Onyx value orgetCurrentUserAccountID()) before falling through to the email lookup. This ensures the query sends the numeric accountID to the backend instead of the literal string "me".What alternative solutions did you explore? (Optional)
An alternative would be to handle this in
buildSubstitutionsMapby detecting when a raw query containsfrom:meand auto-populating the substitution map entry. However, this would be more complex and fragile sincebuildSubstitutionsMapis designed for the reverse direction (accountID → display value). The proposed fix addresses the problem at the two exact points of failure with minimal changes.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 Mar 28, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jayeshmangwani (
External)melvin-bot commentedon Mar 28, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022037804379216972874
[-]Reports - type:expense-report query not applied when from:me[/-][+][$250] Reports - type:expense-report query not applied when from:me[/+]wildan-m commentedon Mar 28, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-04-22 01:56:33 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When pasting or typing
from:me(or any user filter withme) in the search input,medoes not turn green and the filter is not applied. The search results are unfiltered because the backend receives the literal stringmeinstead of the current user's account ID.What is the root cause of that problem?
There are two failure points when
meis typed/pasted directly (without autocomplete selection):1. Highlighting validation rejects
mefilterOutRangesWithCorrectValuevalidates whether a filter value should be highlighted (turn green). For user-based filters, it only checks the substitution map and theuserLoginslist — neither containsmewhen typed/pasted without autocomplete:App/src/libs/SearchAutocompleteUtils.ts
Lines 184 to 190 in e427128
The substitution map is empty because no autocomplete selection populated it. And
userLoginscontains real email addresses, not the specialmekeyword. So the range is filtered out before it even reachesparseForLiveMarkdownline 280 which does check forCONST.SEARCH.ME— but only in.map()after.filter()already rejected it.2. Query substitution cannot resolve
meto an account IDgetQueryWithSubstitutionsreplaces display values with internal IDs (e.g.,from:@johndoe→from:9876) using the substitution map. Whenmeis pasted directly, the substitution map has no entry for it, somepasses through literally togetUpdatedFilterValue, which then callsgetPersonalDetailByEmail("me")— returnsundefinedbecausemeis not an email — and the literal stringmeis sent to the backend:https://github.com/Expensify/App/blob/e42712830efb4e3bae9e9569769c4ee508dc71c2/src/components/Search/SearchRouter/getQueryWithSubstitutions.ts#L30-L78
The autocomplete flow avoids this because selecting
mefrom the dropdown populates the substitution map withfrom:me → <accountID>before submit. But when pasting, the substitution map is empty, somepasses through unresolved.What changes do you think we should make in order to solve the problem?
1. Fix highlighting — In
filterOutRangesWithCorrectValue(src/libs/SearchAutocompleteUtils.tsline 190), add|| range.value === CONST.SEARCH.MEto the return condition for user-based filter keys (FROM,TO,ASSIGNEE,PAYER,EXPORTER,ATTENDEE). This ensuresmeturns green immediately when typed/pasted, consistent with howparseForLiveMarkdownat line 280 already treats it as a valid current-user mention.2. Fix query substitution — Add an optional
currentUserAccountIDparameter togetQueryWithSubstitutions. When a parsed range hasvalue === CONST.SEARCH.MEon a user-based filter key and has no existing substitution entry, fall back to the account ID. Update the two existing call sites (useSearchPageInput.tsxline 121 andSearchRouter.tsxline 242) to passcurrentUserAccountID— both components already read it viauseOnyx(ONYXKEYS.SESSION, {selector: accountIDSelector}). This threads the session context through without violating therulesdir/no-onyx-connectlint rule that bans new module-level Onyx subscriptions.Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/86603-from-me-search-filter?expand=1
Per @luacmartins's clarification,
from:mefilters onreport.accountIDregardless of state/action — resolvingmeto the session account ID for ALL user-based filters (rather than gating by action likesubmit/approve/pay/export) matches the intended semantics. The backend handles the per-filter interpretation (from = report accountID; payer/exporter/approver = their respective fields).What alternative solutions did you explore? (Optional)
Fix in
buildSubstitutionsMapby auto-populatingfrom:me → accountIDwhen parsing a query. This would fix the page-reload case (URL containingfrom:me), but not the initial paste-and-submit case —buildSubstitutionsMapruns in auseEffecttied to the URL query, so it has not run for the pasted text by the time the user presses Enter. A centralized fix ingetQueryWithSubstitutionscovers both paths.Fix in
getUpdatedFilterValue(inSearchQueryUtils.ts) by resolvingmeto the account ID there. This would also work, butgetUpdatedFilterValueis a pure utility with no hook or parameter access tocurrentUserAccountID, so it would require either adding a parameter through multiple call chains or adding anOnyx.connectsubscription. The newrulesdir/no-onyx-connectrule discourages the latter. Fixing at the substitution layer stays within the component code path that already has the session account ID.Fix from:me search filter not applied when pasted
wildan-m commentedon Mar 28, 2026
Proposal
Updated
Added compare branch with implementation.
anobie commentedon Mar 28, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
github-actions commentedon Mar 28, 2026
87 remaining items
huult commentedon May 18, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
It seems this is a new feature.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/639578
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-dd42-a7ff-7068-5c80419eb834melvin-bot commentedon May 19, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)mallenexpensify commentedon May 21, 2026
Payment Summary
Contributor: @wildan-m paid $250 via Upwork
Contributor+: @huult due $250 via NewDot
^ Test case created. Thx
Thx
JmillsExpensify commentedon Jun 2, 2026
$250 approved for @huult