Skip to content

Add search filters for Custom Field 1, Custom Field 2, and International Reimbursement IDs - #97337

Draft
MelvinBot wants to merge 2 commits into
mainfrom
claude-searchFilterCustomFields
Draft

Add search filters for Custom Field 1, Custom Field 2, and International Reimbursement IDs#97337
MelvinBot wants to merge 2 commits into
mainfrom
claude-searchFilterCustomFields

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

PR #90937 added Custom Field 1 (report.submitterUserID), Custom Field 2 (report.submitterPayrollID) and International Reimbursement IDs (report.orderDealNumbers) as display columns on the reports/expense search page, but there was no way to filter results by these fields.

This PR registers the three fields as text filters, reusing the existing string-filter machinery (modeled on title / reportID / description) so they appear as filter rows in the advanced-filters UI and can be typed directly in the search bar. Concretely:

  • Filter keys — added submitterUserID, submitterPayrollID, orderDealNumbers to SYNTAX_FILTER_KEYS plus kebab-case aliases in SEARCH_USER_FRIENDLY_KEYS (src/CONST/index.ts).
  • Parser — added token rules in baseRules.peggy and key alternations in searchParser.peggy + autocompleteParser.peggy, then regenerated the committed .js parsers with npm run generate-search-parser and npm run generate-autocomplete-parser.
  • Query ⇄ form conversion — added the keys to the text-filter branches of buildQueryStringFromFilterFormValues and buildFilterFormValuesFromQuery (src/libs/SearchQueryUtils.ts).
  • Form types — added the keys (with _NOT variants) to TEXT_FILTER_KEYS, FILTER_KEYS, the EXPENSE/EXPENSE_REPORT allowed-filter sets, and the form value type (src/types/form/SearchAdvancedFiltersForm.ts), plus the SearchTextFilterKeys union (src/components/Search/types.ts).
  • UI wiring — added the keys to the EXPENSE and EXPENSE_REPORT sections of useAdvancedSearchFilters.ts and added FILTER_VIEW_MAP entries (label + icon) in src/libs/SearchUIUtils.ts, reusing the existing localized labels workspace.common.customField1, workspace.common.customField2 and common.internationalReimbursementIDs.

No new routes, screens or components are needed — advanced filters are param-driven through the generic SEARCH_ADVANCED_FILTERS_CONTENT route + TextInputFilterContent.

Backend dependency: the server-side Search support for these three keys was handled separately in Auth PR #23009 (now merged).

Fixed Issues

$ #95389
PROPOSAL: #95389 (comment)

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • 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

…nal Reimbursement IDs

Co-authored-by: Shubham Agrawal <shubham1206agra@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team July 29, 2026 12:53
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 I created this PR from an upstream branch (claude-searchFilterCustomFields) since I don't have push access to your fork.

If you can't push to the upstream branch directly and want to take ownership of it from your fork, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-searchFilterCustomFields
git checkout -b claude-searchFilterCustomFields upstream/claude-searchFilterCustomFields
git push -u origin claude-searchFilterCustomFields

Then you can close this PR and open a new one from your fork.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I looked into the failing checks. All code/CI checks now pass — when your request came in, the test jobs, typecheck, and the perf tests were still running, and they've since all completed successfully (test (jobs 1–8), typecheck, ESLint, Oxfmt, Bun tests, baseline-perf-tests + branch-perf-testsvalidate-perf-tests, etc.).

The only remaining failure is PR Author Checklist / checklist, which reports:

You completed 0 out of 38 checklist items with 38 unfinished items

That's the manual PR Author Checklist — it fails because the checklist boxes aren't ticked and the Tests / QA Steps sections still contain the placeholder // TODO. This isn't a code issue, so there's nothing for me to fix or push. It just needs a human to complete it:

  • Check off the author-checklist items in the PR body.
  • Fill in the Tests and QA Steps sections (or add [No QA] to the title if QA isn't applicable).

I intentionally don't fill out the human author checklist or the Tests/QA sections on your behalf. Once you complete them, the checklist check will pass and the PR should be green. 👍

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

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.

Files with missing lines Coverage Δ
src/CONST/index.ts 94.81% <ø> (ø)
src/hooks/useAdvancedSearchFilters.ts 97.50% <ø> (ø)
src/libs/SearchUIUtils.ts 65.13% <ø> (ø)
src/types/form/SearchAdvancedFiltersForm.ts 100.00% <ø> (ø)
src/libs/SearchQueryUtils.ts 87.30% <87.50%> (+<0.01%) ⬆️
src/libs/SearchParser/searchParser.js 85.37% <93.50%> (-0.01%) ⬇️
src/libs/SearchParser/autocompleteParser.js 59.63% <73.95%> (+0.62%) ⬆️
... and 11 files with indirect coverage changes

Comment on lines +198 to +205
SUBMITTER_USER_ID_NOT: 'submitterUserIDNot',
SUBMITTER_USER_ID: 'submitterUserID',

SUBMITTER_PAYROLL_ID_NOT: 'submitterPayrollIDNot',
SUBMITTER_PAYROLL_ID: 'submitterPayrollID',

ORDER_DEAL_NUMBERS_NOT: 'orderDealNumbersNot',
ORDER_DEAL_NUMBERS: 'orderDealNumbers',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c3024 Are we supporting all these keys?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only failing checks are the PR Author Checklist and PR Reviewer Checklist — there's nothing for me to fix in code here.

These aren't code/test failures. They fail because the checklists haven't been completed yet:

  • PR Author Checklist — needs the author to check off the items in the PR description's author checklist.
  • PR Reviewer Checklist — fails with No PR Reviewer Checklist was found; a reviewer (or the C+/reviewer bot) still needs to post the reviewer checklist comment.

All actual CI (Bun tests, Jest test jobs, ESLint, Oxfmt, TypeScript build, Storybook, perf, etc.) is passing. Once the author checklist boxes are completed and a reviewer posts their checklist, both checks will go green. I'm intentionally not pushing any commit since these can't be resolved by a code change.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

The only two failing checks are the PR Author Checklist and PR Reviewer Checklist — neither is a code/CI failure, so there's nothing for me to fix or push here. Every actual check (Jest test jobs 1–8, typecheck, ESLint, Oxfmt, Bun tests, Storybook, React Compiler, perf tests, build, spellcheck, etc.) is passing.

These two checks require manual, human action:

  • PR Author Checklist — fails because the checklist items in the PR description aren't ticked. The PR author needs to complete them.
  • PR Reviewer Checklist — fails with No PR Reviewer Checklist was found; a reviewer (C+/assigned reviewer) still needs to post the reviewer checklist comment.

I can't complete either of these on your behalf — checking the author boxes and posting the reviewer checklist are actions the author and reviewer need to take. Once those are done, both checks will pass and the PR will be green.

@shubham1206agra

Copy link
Copy Markdown
Contributor

@MelvinBot Merge main please

…stomFields

Co-authored-by: Shubham Agrawal <shubham1206agra@users.noreply.github.com>
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Merged main into claude-searchFilterCustomFields — no conflicts. The merge commit (5e8faed3ada) has been pushed to the branch.

@shubham1206agra

Copy link
Copy Markdown
Contributor

@c3024 Can you look into a24b02cadec68adf-DEL? Not sure why the result contains rows with no custom field 2 in this.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No code fix is needed — every automated check on this PR passes. The only red check is checklist (PR Author Checklist), which isn't a code failure: it fails because the checklist boxes in the PR description aren't ticked (0 out of 38 completed). That's a human attestation I can't complete on your behalf — please check the boxes in the PR body once you've verified each item.

I also reproduced the substantive checks locally on the branch to be sure nothing real is broken:

Local verification
  • Parsers — reran generate-search-parser and generate-autocomplete-parser; git status shows no diff, so the committed searchParser.js / autocompleteParser.js are in sync with the .peggy sources.
  • Typechecknpm run typecheck passes (exit 0, no error TS).
  • Jest — the 6 Search suites covering the changed files (SearchQueryUtilsTest, SearchUIUtilsTest, SearchParserTest, SearchAutocompleteParserTest, SearchAutocompleteUtilsTest, SearchRouterUtilsTest) pass: 941/941.
  • React Compilercheck mode over the changed files passes (the changed useAdvancedSearchFilters.ts hook compiles cleanly).

So there's nothing to push. Once you fill out the PR Author Checklist, this PR should be all green.

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.

3 participants