You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-05-15] [$250] Extra two significant figures are added to amount when searched from Recent searches #87285
Version Number: 9.3.53-7 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://github.com/Expensify/Expensify/issues/567981 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Windows 10 - Chrome App Component: Other
Action Performed:
Go to staging.new.expensify.com
Go to Reports > Expenses.
Search with amount:123.
Clear the search field.
Click on the search field.
Click type:expense amount:123 under Recent searches.
Expected Result:
The amount in "type:expense amount:123" will remain unchanged.
Actual Result:
The amount in "type:expense amount:123" changes to 12300.
When a recent search is clicked from the search page header, submitSearch in useSearchPageInput.tsx:116-129 correctly skips amount conversion for the query param (via shouldSkipAmountConversion = true), but unconditionally passes queryWithSubstitutions as rawQuery — which already contains amounts in cents (e.g., amount:12300 for a user-entered amount:123).
Later, getSanitizedRawFilters processes rawQuery and calls getUpdatedFilterValue at line 707 without a shouldSkipAmountConversion flag, so it calls convertToBackendAmount(12300) → 1230000. This double conversion (×100 twice) causes the displayed amount to show 12300 instead of 123.
What changes do you think we should make in order to solve the problem?
In useSearchPageInput.tsx and SearchPageHeaderInput.tsx, don't pass rawQuery when shouldSkipAmountConversion is true (i.e., when the query already has backend-format amounts). The rawQuery param exists to preserve the user's original typed input for display — recent searches don't need it since their amounts are already converted.
What alternative solutions did you explore? (Optional)
An alternative would be to thread a shouldSkipAmountConversion parameter through getSanitizedRawFilters → getUpdatedFilterValue. This is more invasive and less clean — the simpler fix is to not pass rawQuery when the query is already in backend format, since rawQuery is only meant for preserving user-typed input.
Investigation details
Data flow (bug scenario):
User searches amount:123 → converted to amount:12300 (cents) in q URL param
Stored as type:expense amount:12300 in nvp_recentSearches
src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx:204 — same issue
src/libs/SearchQueryUtils.ts:707 — unconditional conversion in getSanitizedRawFilters
src/libs/CurrencyUtils.ts:71-73 — convertToBackendAmount multiplies by 100
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
changed the title [-]Extra two significant figures are added to amount when searched from Recent searches[/-][+][$250] Extra two significant figures are added to amount when searched from Recent searches[/+]on Apr 7, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user selects a recent search like type:expense amount:123, the amount should remain 123 in the query UI. Instead, after selecting the recent search, it becomes 12300
What is the root cause of that problem?
Recent searches are displayed with a user-readable label, but the selected query uses the stored backend query (amount already in minor units).
Then amount normalization is applied again in the query parsing flow.
In SearchAutocompleteList, recent-search items are built like this:
What changes do you think we should make in order to solve the problem?
Make recent-search selection submit the user-readable query string (the same one shown in UI), not the raw stored backend query. That ensures one consistent conversion path and keeps visible amount stable.
Optional hardening (if needed): for recent-search items, pass shouldSkipAmountConversion = false explicitly in the submit path, so readable amounts are converted exactly once.
What alternative solutions did you explore? (Optional)
Change buildSearchQueryJSON(rawQuery) sanitization to skip amount conversion for raw query inputs but its too broad/risky because it affects many search entry points. Secondly, you could keep using stored raw query but add explicit “already backend amount” detection. However this is Error-prone and ambiguous, especially across currencies/formatting.
Lastly, another thing you could do is Store both raw and readable recent-query variants in Onyx. But it is more invasive state/schema change than needed for this bug.
Please re-state the problem that we are trying to solve in this issue.
When a user clicks a recent search containing an amount filter (e.g., type:expense amount:123), the displayed amount gets multiplied by 100 — showing amount:12300 instead of amount:123.
What is the root cause of that problem?
Recent searches are stored in nvp_recentSearches with amounts already in backend format (cents). For example, a user search of amount:123 is stored as amount:12300. When the user clicks on this recent search from the search page header, submitSearch is invoked with shouldSkipAmountConversion = true, which correctly prevents getQueryWithUpdatedValues from converting the amount a second time for the query URL param. However, submitSearch unconditionally passes the same value as rawQuery:
When the search page processes this route, buildSearchQueryJSON receives the rawQuery and passes it through getRawFilterListFromQuery → getSanitizedRawFilters → getUpdatedFilterValue:
This call to getUpdatedFilterValue does NOT receive a shouldSkipAmountConversion flag, so it defaults to false and calls convertToBackendAmount on the already-backend-format value 12300, producing 1230000. The resulting rawFilterList is then used by buildUserReadableQueryString to render the query in the search input, where convertToFrontendAmountAsInteger(1230000) yields 12300 instead of the expected 123.
The SearchRouter path is unaffected because it does not pass rawQuery at all:
What changes do you think we should make in order to solve the problem?
In both useSearchPageInput.tsx and SearchPageHeaderInput.tsx, conditionally omit rawQuery when shouldSkipAmountConversion is true. The rawQuery parameter exists to preserve the user's original typed input for display purposes — recent searches have no user-typed input to preserve since their values are already in backend format.
When rawQuery is omitted, buildSearchQueryJSON falls back to deriving the filter list from the main query param, and buildUserReadableQueryString uses the flatFilters path which correctly converts backend amounts to frontend display via convertToFrontendAmountAsInteger.
What alternative solutions did you explore? (Optional)
I considered threading a shouldSkipAmountConversion parameter through getRawFilterListFromQuery → getSanitizedRawFilters → getUpdatedFilterValue so that the raw filter processing could skip amount conversion when appropriate. While this preserves the rawFilterList (which maintains the user's original filter ordering), it requires modifying three function signatures in SearchQueryUtils.ts for a problem that only manifests when rawQuery carries backend-format data — a scenario the rawQuery parameter was never designed for. The simpler approach of omitting rawQuery when no user-typed input exists is both minimal and semantically correct.
I also explored converting the recent search queries from backend to user-readable format before submission (using the already-computed readable text in SearchAutocompleteList). This would break non-amount filters like from/to/payer — getUpdatedFilterValue expects emails for these filters and converts them to account IDs, but the readable text contains display names instead, causing the lookup to fail silently.
⚠️@wildan-m Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
Please re-state the problem that we are trying to solve in this issue.
When a user selects a recent search like type:expense amount:123, the amount should remain 123 in the query UI. Instead, after selecting the recent search, it becomes 12300
What is the root cause of that problem?
When a recent-search item is selected, the query is already normalized for backend use, but we were still forwarding that same value as rawQuery. That lets the raw-query display path re-interpret normalized amount values and makes amount:123 show up as amount:12300.
@ProposalPolice This proposal is not a duplicate. The two proposals target completely different files and use different fix mechanisms:
My proposal modifies useSearchPageInput.tsx and SearchPageHeaderInput.tsx — conditionally omitting rawQuery when shouldSkipAmountConversion is true, preventing the double conversion in getSanitizedRawFilters.
The other proposal modifies SearchAutocompleteList.tsx — changing searchQuery from the stored backend query to the user-readable text.
These are distinct approaches at different layers of the codebase. Furthermore, the other approach of submitting the readable query string would break from/ to / payer filters, because getUpdatedFilterValue expects emails to convert to account IDs via getPersonalDetailByEmail(), but the readable text contains display names instead.
[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.
[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.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
MelvinBot commentedon Apr 7, 2026
Proposal
What is the root cause of that problem?
When a recent search is clicked from the search page header,
submitSearchinuseSearchPageInput.tsx:116-129correctly skips amount conversion for thequeryparam (viashouldSkipAmountConversion = true), but unconditionally passesqueryWithSubstitutionsasrawQuery— which already contains amounts in cents (e.g.,amount:12300for a user-enteredamount:123).Later,
getSanitizedRawFiltersprocessesrawQueryand callsgetUpdatedFilterValueat line 707 without ashouldSkipAmountConversionflag, so it callsconvertToBackendAmount(12300)→1230000. This double conversion (×100 twice) causes the displayed amount to show12300instead of123.The same issue exists in
SearchPageHeaderInput.tsx:191-206. The SearchRouter path is unaffected because it doesn't passrawQuery.What changes do you think we should make in order to solve the problem?
In
useSearchPageInput.tsxandSearchPageHeaderInput.tsx, don't passrawQuerywhenshouldSkipAmountConversionis true (i.e., when the query already has backend-format amounts). TherawQueryparam exists to preserve the user's original typed input for display — recent searches don't need it since their amounts are already converted.Change from:
to:
What alternative solutions did you explore? (Optional)
An alternative would be to thread a
shouldSkipAmountConversionparameter throughgetSanitizedRawFilters→getUpdatedFilterValue. This is more invasive and less clean — the simpler fix is to not passrawQuerywhen the query is already in backend format, sincerawQueryis only meant for preserving user-typed input.Investigation details
Data flow (bug scenario):
amount:123→ converted toamount:12300(cents) inqURL paramtype:expense amount:12300innvp_recentSearchessubmitSearch("amount:12300", true)—shouldSkipAmountConversion=trueupdatedQuery = "amount:12300"(correct, conversion skipped)rawQuery = "amount:12300"(already in cents — this is the bug)getSanitizedRawFiltersprocessesrawQuery, callingconvertToBackendAmount(12300)= 1230000amount:12300instead ofamount:123Key files:
src/components/Search/SearchPageHeader/useSearchPageInput.tsx:128— passesrawQuerysrc/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx:204— same issuesrc/libs/SearchQueryUtils.ts:707— unconditional conversion ingetSanitizedRawFilterssrc/libs/CurrencyUtils.ts:71-73—convertToBackendAmountmultiplies by 100Next 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 Apr 7, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (
External)[-]Extra two significant figures are added to amount when searched from Recent searches[/-][+][$250] Extra two significant figures are added to amount when searched from Recent searches[/+]melvin-bot commentedon Apr 7, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022041622122830675700
Abdullahtmk commentedon Apr 7, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user selects a recent search like type:expense amount:123, the amount should remain 123 in the query UI. Instead, after selecting the recent search, it becomes 12300
What is the root cause of that problem?
Recent searches are displayed with a user-readable label, but the selected query uses the stored backend query (amount already in minor units).
Then amount normalization is applied again in the query parsing flow.
In SearchAutocompleteList, recent-search items are built like this:
App/src/components/Search/SearchAutocompleteList.tsx
Lines 301 to 321 in 80b61a0
When selected, submitSearch() runs with that searchQuery:
App/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
Lines 236 to 237 in 80b61a0
And amount filters are normalized in SearchQueryUtils (convertToBackendAmount), which causes repeated scaling effects in this path:
App/src/libs/SearchQueryUtils.ts
Lines 389 to 401 in 80b61a0
What changes do you think we should make in order to solve the problem?
Make recent-search selection submit the user-readable query string (the same one shown in UI), not the raw stored backend query. That ensures one consistent conversion path and keeps visible amount stable.
Change this
App/src/components/Search/SearchAutocompleteList.tsx
Lines 301 to 326 in 80b61a0
To this
Optional hardening (if needed): for recent-search items, pass shouldSkipAmountConversion = false explicitly in the submit path, so readable amounts are converted exactly once.
What alternative solutions did you explore? (Optional)
Change buildSearchQueryJSON(rawQuery) sanitization to skip amount conversion for raw query inputs but its too broad/risky because it affects many search entry points. Secondly, you could keep using stored raw query but add explicit “already backend amount” detection. However this is Error-prone and ambiguous, especially across currencies/formatting.
Lastly, another thing you could do is Store both raw and readable recent-query variants in Onyx. But it is more invasive state/schema change than needed for this bug.
wildan-m commentedon Apr 7, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user clicks a recent search containing an amount filter (e.g.,
type:expense amount:123), the displayed amount gets multiplied by 100 — showingamount:12300instead ofamount:123.What is the root cause of that problem?
Recent searches are stored in
nvp_recentSearcheswith amounts already in backend format (cents). For example, a user search ofamount:123is stored asamount:12300. When the user clicks on this recent search from the search page header,submitSearchis invoked withshouldSkipAmountConversion = true, which correctly preventsgetQueryWithUpdatedValuesfrom converting the amount a second time for thequeryURL param. However,submitSearchunconditionally passes the same value asrawQuery:App/src/components/Search/SearchPageHeader/useSearchPageInput.tsx
Lines 125 to 129 in 80b61a0
The same pattern exists in the desktop variant:
App/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
Lines 201 to 205 in 80b61a0
When the search page processes this route,
buildSearchQueryJSONreceives therawQueryand passes it throughgetRawFilterListFromQuery→getSanitizedRawFilters→getUpdatedFilterValue:App/src/libs/SearchQueryUtils.ts
Lines 706 to 707 in 80b61a0
This call to
getUpdatedFilterValuedoes NOT receive ashouldSkipAmountConversionflag, so it defaults tofalseand callsconvertToBackendAmounton the already-backend-format value12300, producing1230000. The resultingrawFilterListis then used bybuildUserReadableQueryStringto render the query in the search input, whereconvertToFrontendAmountAsInteger(1230000)yields12300instead of the expected123.The SearchRouter path is unaffected because it does not pass
rawQueryat all:App/src/components/Search/SearchRouter/SearchRouter.tsx
Line 235 in 80b61a0
What changes do you think we should make in order to solve the problem?
In both
useSearchPageInput.tsxandSearchPageHeaderInput.tsx, conditionally omitrawQuerywhenshouldSkipAmountConversionis true. TherawQueryparameter exists to preserve the user's original typed input for display purposes — recent searches have no user-typed input to preserve since their values are already in backend format.When
rawQueryis omitted,buildSearchQueryJSONfalls back to deriving the filter list from the mainqueryparam, andbuildUserReadableQueryStringuses theflatFilterspath which correctly converts backend amounts to frontend display viaconvertToFrontendAmountAsInteger.In
submitSearchof both files, change:to:
What alternative solutions did you explore? (Optional)
I considered threading a
shouldSkipAmountConversionparameter throughgetRawFilterListFromQuery→getSanitizedRawFilters→getUpdatedFilterValueso that the raw filter processing could skip amount conversion when appropriate. While this preserves therawFilterList(which maintains the user's original filter ordering), it requires modifying three function signatures inSearchQueryUtils.tsfor a problem that only manifests whenrawQuerycarries backend-format data — a scenario therawQueryparameter was never designed for. The simpler approach of omittingrawQuerywhen no user-typed input exists is both minimal and semantically correct.I also explored converting the recent search queries from backend to user-readable format before submission (using the already-computed readable text in
SearchAutocompleteList). This would break non-amount filters likefrom/to/payer—getUpdatedFilterValueexpects emails for these filters and converts them to account IDs, but the readable text contains display names instead, causing the lookup to fail silently.Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/87285-fix-recent-search-amount?expand=1
github-actions commentedon Apr 7, 2026
abbasifaizan70 commentedon Apr 7, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user selects a recent search like type:expense amount:123, the amount should remain 123 in the query UI. Instead, after selecting the recent search, it becomes 12300
What is the root cause of that problem?
When a recent-search item is selected, the query is already normalized for backend use, but we were still forwarding that same value as
rawQuery. That lets the raw-query display path re-interpret normalized amount values and makesamount:123show up asamount:12300.App/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
Line 237 in 80b61a0
Recent-search selections are sent with
shouldSkipAmountConversion=true, meaning the selected query is already normalized.App/src/components/Search/SearchPageHeader/useSearchPageInput.tsx
Line 178 in 80b61a0
Same behavior in the shared search-page hook, so the issue exists in both header entry paths.
What changes do you think we should make in order to solve the problem?
App/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx
Line 204 in 80b61a0
App/src/components/Search/SearchPageHeader/useSearchPageInput.tsx
Line 128 in 80b61a0
Demo
Screen.Recording.2026-04-08.at.2.04.29.AM.mov
wildan-m commentedon Apr 7, 2026
@ProposalPolice This proposal is not a duplicate. The two proposals target completely different files and use different fix mechanisms:
useSearchPageInput.tsxandSearchPageHeaderInput.tsx— conditionally omittingrawQuerywhenshouldSkipAmountConversionis true, preventing the double conversion ingetSanitizedRawFilters.SearchAutocompleteList.tsx— changingsearchQueryfrom the stored backend query to the user-readable text.These are distinct approaches at different layers of the codebase. Furthermore, the other approach of submitting the readable query string would break
from/to/payerfilters, becausegetUpdatedFilterValueexpects emails to convert to account IDs viagetPersonalDetailByEmail(), but the readable text contains display names instead.120 remaining items
thesahindia commentedon May 11, 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.
Link to the comment on the PR: Maintain user defined order in search query #71075 (comment)
Link to the comment on the Issue: [$500] Don't change the order of user-entered search syntax #69394 (comment)
[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.
Regression Test Proposal Template
[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/638191
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-4813-ae99-2370-fba5c81e01e4melvin-bot commentedon May 14, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon May 15, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon May 18, 2026
Payment Summary
Contributor+: @thesahindia due $250 via NewDot
^ Test case created
garrettmknight commentedon Jul 28, 2026
$250 approved for @thesahindia