Skip to content

Fix Amount filter being multiplied by 100x when using the global search box - #99313

Merged
mjasikowski merged 2 commits into
mainfrom
claude-searchAmountFilter100xConversion
Aug 28, 2026
Merged

mjasikowski merged 2 commits into
mainfrom
claude-searchAmountFilter100xConversion

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

The Amount filter on the Spend > Expenses page was being multiplied by 100 every time a keyword was added to or cleared from the global Search box.

Amount filters are stored in the query in backend cents (e.g. $500 → amount>50000). When the global search box submits, SearchPageInput.submitSearch rebuilds the query via getKeywordQueryWithCurrentSearchContext — which preserves those amounts in cents — and then called getQueryWithUpdatedValues(queryWithContext) without the shouldSkipAmountConversion flag. That flag defaults to false, so getUpdatedFilterValue ran convertToBackendAmount (× 100) on a value that was already in cents (50000 → 5,000,000), which displays as $50,000. Every keyword add/clear multiplied it by 100 again.

This PR passes true as the second argument to getQueryWithUpdatedValues, since queryWithContext is derived from the current queryJSON whose amounts are already in backend cents. This matches how the sibling SearchRouter component already threads shouldSkipAmountConversion through for the same reason.

Fixed Issues

$ #99071
PROPOSAL: #99071 (comment)

Tests

  1. Navigate to Spend > Expenses.
  2. Add an Amount filter using Less than, Greater than, or Equal to, and enter an amount, e.g. $500.
  3. Add a keyword to the global Search box, or reset/clear the search box.
  4. Review the Amount filter value.
  5. Verify the Amount filter value stays $500 (it is NOT multiplied by 100 to $50,000).
  • Verify that no errors appear in the JS console

Offline tests

Same as tests.

QA Steps

  1. Navigate to Spend > Expenses.
  2. Add an Amount filter using Less than, Greater than, or Equal to, and enter an amount, e.g. $500.
  3. Add a keyword to the global Search box, or reset/clear the search box.
  4. Verify the Amount filter value stays $500 (it is NOT multiplied by 100 to $50,000).
  • 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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Co-authored-by: Yauheni Horbach <ZhenjaHorbach@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team August 24, 2026 08:58
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Aug 24, 2026
@codecov

codecov Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
...onents/Search/SearchPageHeader/SearchPageInput.tsx 78.12% <0.00%> (ø)
... and 10 files with indirect coverage changes

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I couldn't complete the testing steps on Web — the run was blocked by an environmental issue, not by the fix itself.

What happened: The fresh test account landed in Expensify's Test Drive onboarding overlay while navigating to Spend > Expenses. That overlay is full-screen and its only actions are "Get started" and "Go to Expensify" — there's no safe dismiss control, and both actions risk navigating the session off the app unrecoverably. Per the tester's safety rules I stopped rather than click either, so I never reached the Filters UI to set the Amount filter and exercise the global search box.

What was confirmed:

  • The PR branch claude-searchAmountFilter100xConversion (HEAD d3fd56d) was checked out and running — the correct fix commit.
  • Navigation reached the Expenses view (Filters/Display/Save/Create controls visible) before the overlay appeared.
  • No external navigation occurred (session stayed on the app origin).

The Amount-filter behavior (stays $500 vs. multiplied to $50,000) and the JS-console check could not be verified.

Recommendation: This needs a re-run on a session that doesn't hit the Test Drive onboarding (e.g. an account with an existing workspace/expenses, or one where the onboarding is already dismissed). The promo card and Test Drive empty-state sit close to the Filters controls on fresh accounts, which is what blocked this attempt.

Screenshots

Uploaded as evidence in a separate comment: the Expenses view with the Filters button, the Test Drive overlay that blocked the session, and confirmation the overlay had no safe dismiss control.


view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Android test: ✅ PASS — the Amount filter is no longer multiplied by 100x when using the global search box.

Ran the testing steps on standalone Android NewDot against branch claude-searchAmountFilter100xConversion (d3fd56d):

  1. Spend > Expenses → added an Amount filter Equal to $500 → chip shows Amount: Equal to 500.00.
  2. Added keyword coffee to the global search box and submitted → Amount chip still 500.00.
  3. Cleared the keyword → Amount chip still 500.00.
  4. Reopened the Amount filter → value shows Equal to / 500.00, not 50,000 — no 100x conversion.

No console errors observed during the flow.

Step Result
Set Amount filter to Equal to $500 ✅ chip Amount: Equal to 500.00
Add keyword to global search box ✅ Amount unchanged (500.00)
Clear the keyword ✅ Amount unchanged (500.00)
Reopen Amount filter ✅ shows 500.00, not 50,000

Screenshots are attached in a separate comment.


view run

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@MelvinBot
Can you fix conflicts?

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Conflicts resolved and merged main in.

One conflicting file: src/components/Search/SearchPageHeader/SearchPageInput.tsx. main added a policies argument to getQueryWithUpdatedValues, while this PR changed the second argument to true (skip amount conversion). I combined both:

const updatedQuery = getQueryWithUpdatedValues(queryWithContext, true, policies);

policies is already in scope via useOnyx, and this matches the current signature getQueryWithUpdatedValues(query, shouldSkipAmountConversion = false, policies?).

npm run typecheck passes and the PR is now mergeable.


view run

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@MelvinBot
Open this PR and remove a draft status

@MelvinBot
MelvinBot marked this pull request as ready for review August 28, 2026 12:02
@MelvinBot
MelvinBot requested a review from a team as a code owner August 28, 2026 12:02
@melvin-bot
melvin-bot Bot requested review from ZhenjaHorbach and removed request for a team August 28, 2026 12:02
@melvin-bot

melvin-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

@ZhenjaHorbach 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 requested a review from JmillsExpensify August 28, 2026 12:02
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Done — this PR is now marked Ready for review (draft status removed).


view run

@melvin-bot
melvin-bot Bot removed the request for review from a team August 28, 2026 12:02
@MelvinBot

Copy link
Copy Markdown
Contributor Author

Nothing to fix in code — all CI checks pass. The only red check is Check independent approval, and that isn't a code failure.

It fails because the PR has no reviews yet (REVIEW_REQUIRED, 0 reviews). That check just requires an approval from an independent reviewer before merge, so there's nothing for me to push. Once a reviewer approves, it will go green.

Check status
  • ✅ Bun tests, test (jobs 1–8), typecheck, ESLint, Oxfmt, spellcheck, Storybook, React Compiler, knip, unused styles, all builds, and perf tests — all pass.
  • ❌ Check independent approval — fails only because reviewDecision is REVIEW_REQUIRED with 0 reviews. Resolves once an independent reviewer approves.

Note: PR Author Checklist, PR Reviewer Checklist, and Check independent approval are approval/checklist gates, not something MelvinBot fixes with a commit.


view run

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible 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 checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (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 verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • 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 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.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
2026-08-28.14.07.02.mov
Android: mWeb Chrome
2026-08-28.14.07.02.mov
iOS: HybridApp
2026-08-28.14.04.06.mov
iOS: mWeb Safari
2026-08-28.14.05.21.mov
MacOS: Chrome / Safari
2026-08-28.14.03.34.mov

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

@MelvinBot
Paste this in the PR description

Explanation of Change

The Amount filter on the Spend > Expenses page was being multiplied by 100 every time a keyword was added to or cleared from the global Search box.

Amount filters are stored in the query in backend cents (e.g. $500 → amount>50000). When the global search box submits, SearchPageInput.submitSearch rebuilds the query via getKeywordQueryWithCurrentSearchContext — which preserves those amounts in cents — and then called getQueryWithUpdatedValues(queryWithContext) without the shouldSkipAmountConversion flag. That flag defaults to false, so getUpdatedFilterValue ran convertToBackendAmount (× 100) on a value that was already in cents (50000 → 5,000,000), which displays as $50,000. Every keyword add/clear multiplied it by 100 again.

This PR passes true as the second argument to getQueryWithUpdatedValues, since queryWithContext is derived from the current queryJSON whose amounts are already in backend cents. This matches how the sibling SearchRouter component already threads shouldSkipAmountConversion through for the same reason.

Fixed Issues

$ #99071
PROPOSAL: #99071 (comment)

Tests

  1. Navigate to Spend > Expenses.
  2. Add an Amount filter using Less than, Greater than, or Equal to, and enter an amount, e.g. $500.
  3. Add a keyword to the global Search box, or reset/clear the search box.
  4. Review the Amount filter value.
  5. Verify the Amount filter value stays $500 (it is NOT multiplied by 100 to $50,000).
  • Verify that no errors appear in the JS console

Offline tests

Same as tests.

QA Steps

  1. Navigate to Spend > Expenses.
  2. Add an Amount filter using Less than, Greater than, or Equal to, and enter an amount, e.g. $500.
  3. Add a keyword to the global Search box, or reset/clear the search box.
  4. Verify the Amount filter value stays $500 (it is NOT multiplied by 100 to $50,000).
  • 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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Done — I've updated the PR description with the content you provided.


view run

@melvin-bot

melvin-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

We did not find an internal engineer to review this PR, trying to assign a random engineer to #99071 as well as to this PR... Please reach out for help on Slack if no one gets assigned!

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

LGTM!

@melvin-bot
melvin-bot Bot requested a review from mjasikowski August 28, 2026 12:17
@mjasikowski
mjasikowski merged commit 553f291 into main Aug 28, 2026
49 of 51 checks passed
@mjasikowski
mjasikowski deleted the claude-searchAmountFilter100xConversion branch August 28, 2026 12:56
@github-actions

Copy link
Copy Markdown
Contributor

🚧 mjasikowski 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 OSBotify mentioned this pull request Aug 28, 2026
45 tasks done
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/mjasikowski in version: 9.4.64-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 No help site changes required. I did not create a draft PR.

This PR is a one-line bug fix: it stops the Amount filter on Spend > Expenses from being multiplied by 100 when a keyword is added to or cleared from the global search box. It restores the filter to show the value the user actually entered.

Because it only corrects buggy behavior — adding no feature and changing no UI label, tab, or documented workflow — there is nothing in App/docs/articles to update. I also confirmed no existing help article documents the Amount/Search filter behavior this change touches.

ZhenjaHorbach, since no docs changed there's no help site PR to review. If you think an article should be added or updated anyway, let me know which one and I'll draft it.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/francoisl in version: 9.4.64-3 🚀

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

Bundle Size Analysis (Sentry):

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants