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
[$250] Android - Spend - No error shown for Report ID and Keyword fields #95540
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Version Number: v9.4.29-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#94013 Email or phone of affected tester (no customers):sintayewhaylu01@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Samsung A16/ Android 15 App Component: Other
Action Performed:
Open the Hybrid app.
Go to Spend.
Enter a very long text in the Keyword and Report ID fields.
Expected Result:
An error message is displayed when the text reaches the 15,000-character limit in both fields
Actual Result:
No error message is shown. The app simply stops accepting additional text after a long input.
📣 @kovodokagu! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
The Keyword and Report ID advanced-search filters render through the shared TextInputFilterContent, which relies entirely on useTextFilterValidation to surface a character-limit error. Two things combine to hide the error:
Neither field has a dedicated limit. The FILTER_MAX_LENGTH map only defines limits for DESCRIPTION, MERCHANT, and TITLE. KEYWORD and REPORT_ID fall through to the default ?? CONST.MAX_COMMENT_LENGTH = 15000.
The boundary is inclusive.isValidInputLength returns isValid when valueByteLength <= byteLength. So at exactly 15,000 bytes the input is still "valid" → error is undefined → no errorText/hasError is shown. The characterLimitExceedCounter error only fires at 15,001+ bytes.
The result matches the report: the user reaches ~15,000 characters and no error appears, because the field is treated as valid right up to the limit.
Note on "the app stops accepting text"
The TextInput in TextInputFilterContent sets no maxLength prop (lines 49-64), and BaseTextInput doesn't default one either, so there is no explicit code-level truncation. The "stops accepting additional text after a long input" symptom is therefore most likely native/browser behavior when a single field holds a very large string, rather than an app-enforced cap. This is the one part of the report I couldn't tie to a specific line — hence medium confidence. Regardless of that detail, the missing-error behavior is fully explained by the two points above.
What changes do you think we should make in order to solve the problem?
Give KEYWORD and REPORT_ID explicit, sensible limits in FILTER_MAX_LENGTH so the existing characterLimitExceedCounter error path is reached well before the field silently maxes out — exactly like DESCRIPTION/MERCHANT/TITLE do today:
REPORT_ID should use a small limit (report IDs are short numeric strings, so 15,000 is nonsensical here).
KEYWORD should get a defined limit rather than the 15,000 comment fallback.
This reuses the wired-up error copy and needs no new component logic. The exact limit values are a product decision.
If the intent is truly to error at 15,000 for these fields specifically, note that the <= boundary in isValidInputLength is shared by many fields, so changing it there is out of scope — adding per-field limits is the safer, pattern-consistent fix.
What alternative solutions did you explore? (Optional)
Setting a maxLength prop on the TextInput would hard-cap input but would not satisfy the expected result (an explicit error message) — it would just silently truncate, which is closer to the current buggy behavior than the fix.
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/95540) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-07 20:39:18 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the advanced search filters, the Keyword and Report ID fields never show a character-limit error. You just type until the input silently stops accepting more characters (on Android the native keyboard field cuts you off), so the "you've hit the 15,000-character limit" message the tester expected never appears.
What is the root cause of that problem?
The validation lives in useTextFilterValidation (src/components/Search/hooks/useTextFilterValidation.tsx). It looks up a per-field limit in FILTER_MAX_LENGTH, and if the field isn't in that map it falls back to CONST.MAX_COMMENT_LENGTH (15,000):
The map only has entries for DESCRIPTION, MERCHANT, and TITLE. Keyword and Report ID have no entry, so both resolve to 15,000. The error only fires once the trimmed byte length exceeds that (isValidInputLength uses <=). That's the whole problem: 15,000 bytes is not something you reach by typing on a phone, so the branch that would surface the error is effectively dead for these two fields. The fields that DO show an error (Merchant at 255, Description at 1,000, Title at 10,000) work through this exact same hook precisely because their limits are low enough to actually hit.
There's a second half to it. The filter <TextInput> in TextInputFilterContent.tsx gets no maxLength prop, so on the App side nothing caps the input. Elsewhere in the app the 15,000 limit is made reachable by capping the native input at MAX_COMMENT_LENGTH + 1 (see RNMarkdownTextInput.tsx) and the main search bar caps at SEARCH_QUERY_LIMIT (1,000) — but these advanced-filter inputs are plain RNTextInput (type='default') with no cap, so what stops the typing is Android's native EditText, not our code, and no error is ever rendered. Worth noting the same dropdown path (TextFilterPopup.tsx) shares the hook and has the same gap, and WITHDRAWAL_ID is a third filter key with the identical latent hole.
One thing to be careful about: I don't think 15,000 is a bug. Git history shows [REPORT_ID]: 1000 was added and then deliberately removed in commit 3cffd1411ca ("fix wrong length"), and the pre-refactor SearchFiltersKeywordPage/SearchFiltersReportIDPage both used characterLimit={CONST.MAX_COMMENT_LENGTH}. So 15,000 is the intended limit — the bug is that it's unreachable and produces no feedback, not that it's the wrong number.
What changes do you think we should make in order to solve the problem?
Return the resolved maxLength from useTextFilterValidation alongside the error, then pass maxLength={limit + 1} to the <TextInput> in both TextInputFilterContent.tsx and TextFilterPopup.tsx. The +1 matches the pattern already used for MAX_COMMENT_LENGTH inputs across the app: it lets the user type one character past the limit so the validation hook fires and renders the error, instead of the native field silently swallowing the keystroke. This keeps 15,000 as the limit for Keyword/Report ID (and covers Withdrawal ID for free) while making the error actually appear on Android and everywhere else.
There's a real product choice buried here, so I want to flag it rather than assume. maxLength={limit + 1} shows the error the tester asked for. maxLength={limit} would hard-cap silently with no error — cleaner, but it contradicts the "expected: error message" in the report. I'd go with +1 to match the reported expectation, but happy to switch to a silent cap if that's the preferred behavior.
This area has no test asserting that Keyword/Report ID surface a limit error, which is how the gap survived #94013's validation restore. I'd add a case: value at the limit → no error, value at limit+1 → error shown.
What alternative solutions did you explore? (Optional)
Lowering Keyword/Report ID to a small limit like 1,000 — rejected, because 15,000 is the restored original and the 1,000 value for Report ID was explicitly pulled out as "wrong length," so that would be reintroducing a known-bad change. Changing isValidInputLength from <= to >= — rejected, it's a shared utility with a wide blast radius and it still wouldn't help, since the input would need to reach 15,000 for it to matter anyway.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-07 20:28:14 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Reports > Spend filters, entering a very long value in the Report ID or Keyword field never shows the character-limit error. The field silently stops accepting input instead, while the sibling text filters (Description, Merchant) show their limit errors correctly.
What is the root cause of that problem?
#94013 (merged 2026-07-07, the PR this regression QA ran against) added length validation for text filters. The error only fires when the value strictly EXCEEDS the limit — isValidInputLength treats byteLength <= maxLength as valid:
FILTER_MAX_LENGTH has explicit entries only for description (1,000), merchant (255) and title (10,000). Report ID and Keyword are not in the map, so they fall back to CONST.MAX_COMMENT_LENGTH = 15,000 bytes:
These filter inputs are plain text inputs with no maxLength — type defaults to 'default', so BaseTextInput renders a plain RNTextInput with maxLength={undefined} (this is not the markdown input, which would cap at MAX_COMMENT_LENGTH + 1):
So the error can only ever appear if the user physically gets MORE than 15,000 bytes into the field.
On Android that is impossible: the native field stops accepting input around 5,000 characters. #94013's own QA steps acknowledge this ("NOTE: Android natively has a max length of 5000"). That saturation is exactly the reported "app simply stops accepting additional text": byteLength plateaus at ~5,000, stays ≤ 15,000, isValid stays true, and the error never renders.
The structural cause: the 15,000 fallback is not a real contract for these fields — it is unreachable on Android and 15× larger than what the search pipeline itself accepts. Every text-filter value is serialized into the search query string, and both places a query is typed or re-edited are hard-capped at CONST.SEARCH_QUERY_LIMIT = 1,000:
Worse, SearchPageInput loads the current keyword filter back into that 1,000-capped input, so a keyword over 1,000 chars silently truncates on the next edit/submit:
Fields hitting the buggy fallback: reportID and keyword (reported), plus withdrawalID, limit and per-policy report-field text filters — same latent bug:
This chain explains every symptom: no error (threshold unreachable), input "stops accepting text" (native saturation, Samsung A16), and why only the two fallback fields were flagged while Description/Merchant errored fine (their explicit limits sit far below the saturation point).
What changes do you think we should make in order to solve the problem?
One line in the hook — fall back to the query pipeline's real contract instead of MAX_COMMENT_LENGTH:
// src/components/Search/hooks/useTextFilterValidation.tsxconstmaxLength=FILTER_MAX_LENGTH[filterKey]??CONST.SEARCH_QUERY_LIMIT;// was CONST.MAX_COMMENT_LENGTH
Any Report ID / Keyword (and withdrawalID / limit / report-field) value over 1,000 bytes now shows common.error.characterLimitExceedCounter (e.g. "1,050/1,000") on every platform — 1,000 is comfortably below Android's ~5,000 input ceiling, so the error is actually reachable, and Confirm/Apply stays blocked because all three consumers already gate on error. Update the fallback unit test at:
Regression safety: Description/Merchant/Title keep their explicit limits, nothing else reads the fallback, and values ≤ 1,000 behave exactly as today.
Why the obvious spot fix fails: adding explicit reportID/keyword: 15000 map entries, or maxLength={15000} on the TextInput, cannot surface the error — it fires only when the value EXCEEDS the threshold, and on Android the field saturates near 5,000 chars so 15,000 is unreachable; a maxLength cap makes exceeding impossible on every platform (value ≤ cap ⇒ isValid always true), which reproduces the reported behavior verbatim. Changing the comparator to >= ("error when the text reaches the limit") doesn't fix the reported device either — the input never reaches 15,000 on Android — and it leaves validation blessing a 14,999-char keyword that the 1,000-capped query editor then silently truncates.
What alternative solutions did you explore? (Optional)
Explicit FILTER_MAX_LENGTH entries per key (e.g. a much smaller reportID limit, since report IDs are ~20 digits). Reasonable, but the fallback itself stays broken for withdrawalID, limit and report-field filters — the one-line fallback change covers them all, and tighter per-field caps can be layered on later.
>= comparator at 15,000 — rejected above: unreachable on Android, so it does not fix the bug.
Clamp every limit with Math.min(limit, SEARCH_QUERY_LIMIT) — would also make Title (10,000, likewise unreachable on Android's ~5,000 ceiling) consistent, but that changes an explicit mapping #94013 chose deliberately, so I'd keep it as a design follow-up rather than bundle it here.
Please re-state the problem that we are trying to solve in this issue.
On Android (Hybrid app) and Windows Chrome, when a user enters very long text in the Keyword or Report ID advanced-filter fields, no error message is shown. Instead, the app silently stops accepting additional characters near the 15,000-character limit. The expected behavior is a visible error (matching the pattern already working for Description and Merchant filters) when the byte length of the input reaches or exceeds CONST.MAX_COMMENT_LENGTH (15 000).
What is the root cause of that problem?
FILTER_MAX_LENGTH in [src/components/Search/hooks/useTextFilterValidation.tsx:11](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/hooks/useTextFilterValidation.tsx#L11)–15 maps filter keys to their byte-length thresholds:
Bug 1 — off-by-one in the validator. The byte-length check in [src/libs/ValidationUtils.ts:760](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/libs/ValidationUtils.ts#L760)–763 uses <=:
This means a value whose byte length equals byteLength (e.g., exactly 15 000 bytes) is considered valid, so the error never fires at the limit boundary — only for input that has already exceeded it.
Bug 2 — Android input wall prevents exceeding the limit. On Android, the native EditText underlying React Native's TextInput (which has no explicit maxLength prop in these filter components) degrades in performance and effectively stops accepting new characters at roughly 15 000 characters. At that point the React-controlled value state is capped at ≤ 15 000 bytes; isValidInputLength(value, 15000) returns isValid: true for every render (because of the <= comparison), and the errorText prop in the TextInput is never set.
The two bugs interact: Bug 1 means the error cannot fire exactly at the limit; Bug 2 means typed ASCII input can never exceed it. Together they ensure the error never fires for typed input on Android or for ASCII input on any platform.
For the working filters (Description = 1 000, Merchant = 255), their limits are well below the Android input wall, so users can type past the threshold and the error fires normally.
Two render surfaces share this bug:
Mobile full-screen filter page — [src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx:49](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx#L49)–64, rendered via TextInputFilterContentPageWrapper (native) and TextInputFilterContentPopupWrapper (desktop advanced-filters sheet). The TextInput at line 49 carries errorText={error} and hasError={!!error} but no maxLength.
Web filter-bar dropdown — [src/components/Search/FilterDropdowns/TextFilterPopup.tsx:44](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/FilterDropdowns/TextFilterPopup.tsx#L44)–53, rendered by useSearchFiltersBar.tsx:115–119 for all isTextFilterKey entries (which includes KEYWORD and REPORT_ID). This TextInput also passes errorText={error} and hasError={!!error} but no maxLength. This is the Windows: Chrome path checked in the issue.
What changes do you think we should make in order to solve the problem?
1. [src/libs/ValidationUtils.ts:760](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/libs/ValidationUtils.ts#L760)–763 — change <= to < so the validator returns isValid: false when the byte length exactly equals the limit:
This is the root fix. Once the validator treats value.length === limit as invalid, the error can fire the moment the user's input reaches the threshold — which is exactly what happens on Android (input walls at ~15 000 bytes) and is also the correct semantic (the limit is the maximum allowed, not an allowed value).
2. [src/components/Search/hooks/useTextFilterValidation.tsx:11](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/hooks/useTextFilterValidation.tsx#L11)–15 — add explicit entries for REPORT_ID, KEYWORD, and WITHDRAWAL_ID (also handled by TextInputFilterContent but currently absent):
This makes the intent explicit, eliminates silent reliance on the ?? fallback, and ensures future changes to the default cannot silently change these fields' limits.
3. src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx — forward maxLength to <TextInput> so the native component surfaces a visible cap and, together with the fix in step 1, allows the error to fire the moment input reaches the byte threshold:
const{maxLength}=useTextFilterValidation(filterKey,value);// export maxLength from hook, or re-derive it inline// ...<TextInputmaxLength={maxLength}errorText={error}hasError={!!error}.../>
With the < fix in place, when typed input fills the native TextInput to exactly maxLength characters the validator now returns isValid: false and the error renders immediately.
4. src/components/Search/FilterDropdowns/TextFilterPopup.tsx — apply the same maxLength forwarding to the <TextInput> here. This is the web filter-bar popup (via useSearchFiltersBar) and is the surface affected on Windows: Chrome:
consterror=useTextFilterValidation(filterKey,value);// derive maxLength from same FILTER_MAX_LENGTH lookup or export it from hook<TextInputmaxLength={maxLength}errorText={error}hasError={!!error}.../>
5. TextInputFilterContentPopupWrapper (src/components/Search/FilterDropdowns/SearchAdvancedFiltersPopup/TextInputFilterContentPopupWrapper.tsx) renders TextInputFilterContent, so it gets the fix from step 3 for free. No direct change needed.
6. Unit tests — add/extend tests for useTextFilterValidation and isValidInputLength asserting:
REPORT_ID and KEYWORD produce an error string when value byte length equals CONST.MAX_COMMENT_LENGTH (the at-limit case, now fixed by the < change).
REPORT_ID and KEYWORD produce an error string when value byte length exceeds CONST.MAX_COMMENT_LENGTH.
REPORT_ID and KEYWORD return undefined when value byte length is strictly below the limit.
isValidInputLength returns isValid: false for input whose byte length equals byteLength (regression guard for the off-by-one fix).
What alternative solutions did you explore? (Optional)
No-op explicit entries without fixing the validator — adding REPORT_ID/KEYWORD to FILTER_MAX_LENGTH without changing <= to < in isValidInputLength still produces no error for typed ASCII input: the Android wall caps the value at exactly 15 000 bytes, and isValidInputLength(value, 15000) returns isValid: true because 15000 <= 15000. The fix to the comparator is required.
No-op explicit entries without maxLength forwarding — adding REPORT_ID/KEYWORD to FILTER_MAX_LENGTH without passing maxLength to TextInput documents intent but does not change runtime behavior: the ?? fallback already produces 15 000, and the Android input wall prevents the value from exceeding 15 000 bytes, so the error still never fires.
Smaller limit for KEYWORD/REPORT_ID — not appropriate; the issue specification explicitly cites the 15 000-character limit as correct.
Validation on blur only — would require a different hook design and deviates from the per-keystroke pattern used by all other text filter fields; not pursued.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-08 01:45:49 UTC.
Proposal
What is the root cause of that problem?
When we open Spend > Advanced filters and type in the Keyword or Report ID field, the app should show an error after 15,000 characters. Instead, typing just stops and nothing is shown.
These two fields use shared components, not old separate pages:
Both already call useTextFilterValidation. That hook knows how to show characterLimitExceedCounter when text is over 15,000 characters.
The problem is timing. The error only shows when the value goes past 15,000 (15,001+). On Android, the native text field often stops accepting input around the limit before the value ever gets to 15,001. So the hook thinks the text is still valid and never shows an error.
Other inputs in the app (like comments) avoid this by setting maxLength to limit + 1 (15,001). That lets the user type one extra character, which triggers the validation error instead of a silent stop.
Keyword and Report ID never got that + 1 cap.
What changes do you think we should make in order to solve the problem?
Keep the existing useTextFilterValidation hook as-is. Only add a maxLength of CONST.MAX_COMMENT_LENGTH + 1 (15,001) on the TextInput for Keyword and Report ID in both places where users can edit those fields.
When the user types the 15,001st character, the hook returns an error, the input shows it, and the Confirm / Apply button stays blocked.
No changes are needed in useTextFilterValidation.tsx. Keyword and Report ID already fall back to CONST.MAX_COMMENT_LENGTH (15,000) there.
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
PR #94013 added client-side validation for text search filters, but the rendered text-filter inputs do not provide an input window beyond the validation limit. The validation hook only produces an error after the value exceeds the max length, and Keyword / Report ID fall back to CONST.MAX_COMMENT_LENGTH (15,000).
The advanced filter content, filter popup, and report-field text input all render errorText from useTextFilterValidation and block apply/confirm when error exists, but none of them passes a maxLength that allows the value to go past the validation limit. On Android, once input stops at the limit, the hook never sees an invalid value, so no error is shown.
The shared BaseTextInput is not the right layer for this behavior because it just forwards the caller's maxLength to the native/web input, and many other callers intentionally use maxLength as a hard cap.
What changes do you think we should make in order to solve the problem?
Expose the search text-filter max length from useTextFilterValidation.tsx, for example getTextFilterMaxLength(filterKey), and have the hook use that helper so validation and input caps share the same source of truth.
Then update all three useTextFilterValidation call sites:
TextInputFilterContent: compute the text filter limit and pass maxLength={limit + CONST.ADDITIONAL_ALLOWED_CHARACTERS} to the TextInput.
TextFilterPopup: do the same for the filter-chip popup input.
ReportFieldText: do the same for dynamic text report-field filters, since it uses the same validation hook and onError flow.
CONST.ADDITIONAL_ALLOWED_CHARACTERS already exists for the "allow a little past the search limit" pattern, so Keyword and Report ID can accept 15,001-15,020 characters, render Character limit exceeded (15001/15000), and keep Apply/Confirm blocked through the existing error checks.
* The count of characters we'll allow the user to type after reaching SEARCH_MAX_LENGTH in an input.
*/
ADDITIONAL_ALLOWED_CHARACTERS: 20,
Test coverage:
Update useTextFilterValidation tests to cover Report ID / Keyword defaulting to CONST.MAX_COMMENT_LENGTH and the exported max-length helper.
Add focused component coverage for TextInputFilterContent and TextFilterPopup verifying the rendered TextInput receives maxLength = validationLimit + CONST.ADDITIONAL_ALLOWED_CHARACTERS, shows the validation error at validationLimit + 1, and does not apply while invalid.
Manually verify on Android that Spend > Keyword and Report ID fields show the character-limit error after the 15,000-character limit instead of silently refusing more input.
What alternative solutions did you explore? (Optional)
I considered changing BaseTextInput to automatically allow extra characters whenever maxLength is set, but that would affect unrelated inputs that need a strict cap, such as codes, SSN fields, and numeric inputs. Keeping the overflow allowance in the search text-filter layer fixes the validated search fields without weakening hard caps elsewhere.
In the Advanced Search Filters for Keyword, Report ID, and other text-based filters, the underlying TextInput lacks a maximum length validation. When a user pastes or types a very long string (> 15,000 characters) into these fields, the app's input buffer either hangs or silently stops accepting characters natively. Furthermore, no validation error is shown in the UI because TextInputFilterComponents and its parent TextInputFilterContent do not check the input length against CONST.MAX_COMMENT_LENGTH (15,000 characters) nor pass any errorText to the TextInput.
What changes do you think we should make in order to solve the problem?
We should add character limit validation for text-based Advanced Search Filters by checking if the value exceeds CONST.MAX_COMMENT_LENGTH (15,000 characters).
In src/components/Search/FilterComponents/index.tsx:
Update TextInputFilterComponents to evaluate if the input length exceeds CONST.MAX_COMMENT_LENGTH and pass the standard Expensify character limit error to the errorText prop of the TextInput:
In src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx:
Update TextInputFilterContent to disable the "Confirm" button when the TextInput has an error, preventing the user from submitting a filter that exceeds the maximum length.
This ensures the user sees a clear, localized error message when the character limit is reached, and correctly disables submission.
What alternative solutions did you explore? (Optional)
We could enforce maxLength={CONST.MAX_COMMENT_LENGTH} directly on the TextInput. However, this would silently block the user from typing past the limit and fail to display the expected error message indicating why their input is blocked, violating the expected result detailed in the bug report. Using errorText and isDisabled provides a better UX and aligns with how Expensify handles length validation on other comment/input fields.
🚨 Edited by proposal-police: This proposal was edited at 2026-07-07 20:31:45 UTC.
Proposal
What is the root cause of that problem?
This is a gap in #94013 ("Add text-based filter length validation"), which merged on 2026-07-07, hours before this bug was filed.
That PR routes every text filter through the new useTextFilterValidation hook, which shows a "Character limit exceeded" error once the value's byte length exceeds a per-filter max. But FILTER_MAX_LENGTH only defines three keys — Description, Merchant, Title — and everything else falls through to CONST.MAX_COMMENT_LENGTH:
So Keyword and Report ID (neither is mapped) inherit a 15000-byte ceiling. The error only fires when the trimmed byte length is strictly greater than that — isValidInputLength treats anything <= maxLength as valid:
The catch: 15000 bytes is never reachable inside the field. TextInputFilterContent passes no maxLength to lower that threshold, and the underlying input stops accepting text well before 15000 — the PR author flagged a native Android cap in the QA steps ("NOTE: Android natively has a max length of 5000"), and the reporter observed exactly this ("The app simply stops accepting additional text after a long input"):
So the value can never exceed 15000, isValid stays true, and no error is ever shown. Merchant (255) and Description (1000) work because their limits sit far below what the input accepts, so those thresholds are reachable and their errors fire — which is also the proof that a ~1000 limit is reachable on the affected device.
Two more keys share this exact fallback and are silently broken the same way: Withdrawal ID, and every report-field text filter (the dynamic report-field-* keys, which route through the same hook via ReportFieldText). They can't be enumerated in FILTER_MAX_LENGTH, so they all collapse onto the unreachable 15000 default:
What changes do you think we should make in order to solve the problem?
Config layer, one line, in useTextFilterValidation: change the fallback from CONST.MAX_COMMENT_LENGTH to CONST.SEARCH_QUERY_LIMIT (keep the explicit Merchant/Description/Title entries as-is).
Why SEARCH_QUERY_LIMIT (1000) is the right, safe number rather than an invented one:
It's the app's own existing ceiling for search query text — the main search bar already hard-caps the entire query at it via maxLength={CONST.SEARCH_QUERY_LIMIT} (SearchAutocompleteInput, SearchPageInput). A single filter value that feeds into that query should never be allowed to exceed the query itself, so this also removes an existing inconsistency.
It's provably reachable on the affected platform: DESCRIPTION_LIMIT is the same 1000 and its error already shows correctly (here), so the fix can't reintroduce the "unreachable threshold" bug.
It's generous — a report ID is a short numeric ID and a keyword search never needs 1000+ characters — so it won't produce false positives on realistic input.
Changing the fallback (rather than adding two explicit map entries) is deliberate: it fixes Keyword, Report ID, Withdrawal ID and the open-ended report-field-* text filters in one place. Adding only KEYWORD/REPORT_ID to FILTER_MAX_LENGTH would leave the report-field text filters still broken, since their keys are dynamic and can't be listed.
Regression to fix alongside it: the PR's own unit test pins Keyword to the old fallback and expects MAX_COMMENT_LENGTH — update it to expect SEARCH_QUERY_LIMIT (and/or point it at a genuinely unmapped key), otherwise it fails:
No offline/optimistic surface — this is pure client-side validation. The only edge case touched is the empty/whitespace value, which the hook already trims before measuring, and the numeric limit: filter, which is far too short to ever hit 1000.
What alternative solutions did you explore? (Optional)
Hard-cap the filter input with maxLength equal to the validation limit. Rejected — the app's pattern here is to let the value exceed the limit and then surface the characterLimitExceedCounter counter (that's precisely why Merchant/Description/Title pass no maxLength). Capping the input at the limit means it can never be exceeded, which suppresses the error for every text filter — reproducing this exact "no error" bug everywhere instead of fixing it.
Add explicit KEYWORD/REPORT_ID entries to FILTER_MAX_LENGTH and leave the fallback as MAX_COMMENT_LENGTH. Rejected as incomplete — it fixes the two reported fields but leaves Withdrawal ID and all report-field-* text filters (which can't be enumerated in the static map) still validating against the unreachable 15000. Fixing the fallback covers the whole family with less code.
Suspecting Keyword/Report ID were never wired into the hook. Refuted by the code: SearchTextFilterKeys explicitly lists REPORT_ID and KEYWORD, isTextFilterKey routes them into TextInputFilterContent/TextFilterPopup, and the hook runs for them every keystroke. The hook fires fine — its error just never becomes truthy because the threshold is out of reach. So the defect is the limit value, not the wiring.
Please re-state the problem that we are trying to solve in this issue.
In the advanced search filters, the Keyword and Report ID fields never surface the "character limit exceeded" error. You keep typing until the field silently stops accepting more characters (on Android the native field walls out first), and the error the tester expected at the limit never appears — even though sibling fields like Description and Merchant show it correctly.
What is the root cause of that problem?
All text filters were routed through the useTextFilterValidation hook added in #94013. The hook looks up a per-field byte limit in FILTER_MAX_LENGTH, and only three keys are defined — Description, Merchant, Title. Keyword and Report ID aren't in the map, so they fall through to ?? CONST.MAX_COMMENT_LENGTH (15,000):
That 15,000 threshold is effectively unreachable, for two compounding reasons:
The error only fires when the byte length is strictly greater than the limit — isValidInputLength treats valueByteLength <= byteLength as valid, so nothing shows until 15,001+ bytes:
None of the filter inputs pass a maxLength, and on Android the native field stops accepting input well before 15,000 — Add text-based filter length validation #94013's own QA flags this ("NOTE: Android natively has a max length of 5000"), and the reporter observed exactly that ("the app simply stops accepting additional text after a long input"). So the value plateaus below 15,000, isValid stays true, and no error ever renders.
This is also why Description (1,000) and Merchant (255) work through the same hook: their thresholds sit far below what the input accepts, so they are actually reachable. Keyword/Report ID's 15,000 is not — that is the entire gap.
A second tell that 15,000 is the wrong number for these fields: every filter value is serialized into the search query string, which is hard-capped at CONST.SEARCH_QUERY_LIMIT (1,000) in both the autocomplete input and the search page input, and the keyword filter is even reloaded back into that 1,000-capped input — so a keyword over 1,000 chars is silently truncated downstream anyway:
MAX_COMMENT_LENGTH is the chat-message limit and was never a real contract for search filters.
Note on history: Report ID used to have an explicit limit; it was removed in 3cffd1411ca "fix wrong length" (it had been set to DESCRIPTION_LIMIT, a semantically wrong source), which is what dropped it onto the 15,000 fallback. So the exact number is maintainer-owned — I recommend a reachable value below rather than asserting one.
Affected keys — all fall through the same fallback and read this one hook: keyword, reportID (reported), plus withdrawalID, limit, and the per-policy report-field text filters (ReportFieldText). Same latent gap everywhere.
What changes do you think we should make in order to solve the problem?
Give Keyword and Report ID explicit entries in FILTER_MAX_LENGTH, exactly like Description/Merchant/Title already have, set to a limit that is actually reachable. I'd use CONST.SEARCH_QUERY_LIMIT (1,000) — the cap the query pipeline already enforces on every filter value — added right next to the existing entries:
With this, the fields behave identically to how Description works today: the moment the input passes the limit, useTextFilterValidation returns the error, the input renders it, and Confirm/Apply stays blocked — all three consumers already gate on error:
No maxLength prop is needed. The only reason Description surfaces its error and Keyword doesn't is that Description's threshold is reachable and Keyword's isn't. Lowering the threshold below the native input ceiling is sufficient — this keeps the change to one file and reuses the wired-up error path unchanged.
Using SEARCH_QUERY_LIMIT (not DESCRIPTION_LIMIT) gives Report ID a correct semantic source — the query cap that already bounds these values — which addresses why the previous DESCRIPTION_LIMIT entry was pulled as "wrong length."
Exact values are a product call. Report ID could be even tighter (report IDs are short numeric strings); I'd keep Keyword at SEARCH_QUERY_LIMIT since that is the real query cap.
Note: I'd add a unit test to useTextFilterValidation asserting Keyword/Report ID return an error above the limit and undefined at/below it — this gap slipped through Add text-based filter length validation #94013 precisely because there was no such assertion.
What alternative solutions did you explore? (Optional)
Change the fallback itself from CONST.MAX_COMMENT_LENGTH to CONST.SEARCH_QUERY_LIMIT (one line at L19). This fixes every fallback field at once (withdrawalID/limit/report-fields included). I ranked it second only because it changes those extra fields silently and re-imposes a cap on Report ID that was deliberately removed in "fix wrong length" — explicit per-field entries are more surgical and self-documenting. Happy to take this route if covering the whole class in one line is preferred.
Keep 15,000 and add maxLength = limit + 1 (or + N) on the inputs so the user can overflow and trip the error. Rejected: on the reported device this does not help — Android's native field walls out around ~5,000, so the user can never reach 15,001, and the error still never appears. It also does not satisfy "error at the 15,000 limit."
Change isValidInputLength from <= to < so the error fires exactly at the limit. Rejected: it is a shared validator with a wide blast radius across the app, and it still would not fix the reported case — the input never reaches 15,000 on Android regardless of the comparator.
@thesahindia
Fix for #95540 — the "Character limit exceeded" error now shows for the Keyword and Report ID filters (previously they fell back to MAX_COMMENT_LENGTH = 15000, which was unreachable).
@thesahindia this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors
Activity
applause-bot commentedon Jul 7, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/b5be24a753a3c34b54d7ffec61cea9a2ba79b3f7dff1ae6ba7b5fd5b201cd768
melvin-bot commentedon Jul 7, 2026
📣 @kovodokagu! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
MelvinBot commentedon Jul 7, 2026
Proposal
What is the root cause of that problem?
The Keyword and Report ID advanced-search filters render through the shared
TextInputFilterContent, which relies entirely onuseTextFilterValidationto surface a character-limit error. Two things combine to hide the error:FILTER_MAX_LENGTHmap only defines limits forDESCRIPTION,MERCHANT, andTITLE.KEYWORDandREPORT_IDfall through to the default?? CONST.MAX_COMMENT_LENGTH=15000.isValidInputLengthreturnsisValidwhenvalueByteLength <= byteLength. So at exactly 15,000 bytes the input is still "valid" →errorisundefined→ noerrorText/hasErroris shown. ThecharacterLimitExceedCountererror only fires at 15,001+ bytes.The result matches the report: the user reaches ~15,000 characters and no error appears, because the field is treated as valid right up to the limit.
Note on "the app stops accepting text"
The
TextInputinTextInputFilterContentsets nomaxLengthprop (lines 49-64), andBaseTextInputdoesn't default one either, so there is no explicit code-level truncation. The "stops accepting additional text after a long input" symptom is therefore most likely native/browser behavior when a single field holds a very large string, rather than an app-enforced cap. This is the one part of the report I couldn't tie to a specific line — hence medium confidence. Regardless of that detail, the missing-error behavior is fully explained by the two points above.What changes do you think we should make in order to solve the problem?
Give
KEYWORDandREPORT_IDexplicit, sensible limits inFILTER_MAX_LENGTHso the existingcharacterLimitExceedCountererror path is reached well before the field silently maxes out — exactly likeDESCRIPTION/MERCHANT/TITLEdo today:REPORT_IDshould use a small limit (report IDs are short numeric strings, so 15,000 is nonsensical here).KEYWORDshould get a defined limit rather than the 15,000 comment fallback.This reuses the wired-up error copy and needs no new component logic. The exact limit values are a product decision.
If the intent is truly to error at 15,000 for these fields specifically, note that the
<=boundary inisValidInputLengthis shared by many fields, so changing it there is out of scope — adding per-field limits is the safer, pattern-consistent fix.What alternative solutions did you explore? (Optional)
Setting a
maxLengthprop on theTextInputwould hard-cap input but would not satisfy the expected result (an explicit error message) — it would just silently truncate, which is closer to the current buggy behavior than the fix.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/95540)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
shivang-goliyan commentedon Jul 7, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-07 20:39:18 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the advanced search filters, the Keyword and Report ID fields never show a character-limit error. You just type until the input silently stops accepting more characters (on Android the native keyboard field cuts you off), so the "you've hit the 15,000-character limit" message the tester expected never appears.
What is the root cause of that problem?
The validation lives in
useTextFilterValidation(src/components/Search/hooks/useTextFilterValidation.tsx). It looks up a per-field limit inFILTER_MAX_LENGTH, and if the field isn't in that map it falls back toCONST.MAX_COMMENT_LENGTH(15,000):The map only has entries for
DESCRIPTION,MERCHANT, andTITLE. Keyword and Report ID have no entry, so both resolve to 15,000. The error only fires once the trimmed byte length exceeds that (isValidInputLengthuses<=). That's the whole problem: 15,000 bytes is not something you reach by typing on a phone, so the branch that would surface the error is effectively dead for these two fields. The fields that DO show an error (Merchant at 255, Description at 1,000, Title at 10,000) work through this exact same hook precisely because their limits are low enough to actually hit.There's a second half to it. The filter
<TextInput>inTextInputFilterContent.tsxgets nomaxLengthprop, so on the App side nothing caps the input. Elsewhere in the app the 15,000 limit is made reachable by capping the native input atMAX_COMMENT_LENGTH + 1(seeRNMarkdownTextInput.tsx) and the main search bar caps atSEARCH_QUERY_LIMIT(1,000) — but these advanced-filter inputs are plainRNTextInput(type='default') with no cap, so what stops the typing is Android's native EditText, not our code, and no error is ever rendered. Worth noting the same dropdown path (TextFilterPopup.tsx) shares the hook and has the same gap, andWITHDRAWAL_IDis a third filter key with the identical latent hole.One thing to be careful about: I don't think 15,000 is a bug. Git history shows
[REPORT_ID]: 1000was added and then deliberately removed in commit3cffd1411ca("fix wrong length"), and the pre-refactorSearchFiltersKeywordPage/SearchFiltersReportIDPageboth usedcharacterLimit={CONST.MAX_COMMENT_LENGTH}. So 15,000 is the intended limit — the bug is that it's unreachable and produces no feedback, not that it's the wrong number.What changes do you think we should make in order to solve the problem?
Return the resolved
maxLengthfromuseTextFilterValidationalongside the error, then passmaxLength={limit + 1}to the<TextInput>in bothTextInputFilterContent.tsxandTextFilterPopup.tsx. The+1matches the pattern already used forMAX_COMMENT_LENGTHinputs across the app: it lets the user type one character past the limit so the validation hook fires and renders the error, instead of the native field silently swallowing the keystroke. This keeps 15,000 as the limit for Keyword/Report ID (and covers Withdrawal ID for free) while making the error actually appear on Android and everywhere else.There's a real product choice buried here, so I want to flag it rather than assume.
maxLength={limit + 1}shows the error the tester asked for.maxLength={limit}would hard-cap silently with no error — cleaner, but it contradicts the "expected: error message" in the report. I'd go with+1to match the reported expectation, but happy to switch to a silent cap if that's the preferred behavior.This area has no test asserting that Keyword/Report ID surface a limit error, which is how the gap survived #94013's validation restore. I'd add a case: value at the limit → no error, value at limit+1 → error shown.
What alternative solutions did you explore? (Optional)
Lowering Keyword/Report ID to a small limit like 1,000 — rejected, because 15,000 is the restored original and the 1,000 value for Report ID was explicitly pulled out as "wrong length," so that would be reintroducing a known-bad change. Changing
isValidInputLengthfrom<=to>=— rejected, it's a shared utility with a wide blast radius and it still wouldn't help, since the input would need to reach 15,000 for it to matter anyway.ahmdshrif commentedon Jul 7, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-07 20:28:14 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
In Reports > Spend filters, entering a very long value in the Report ID or Keyword field never shows the character-limit error. The field silently stops accepting input instead, while the sibling text filters (Description, Merchant) show their limit errors correctly.
What is the root cause of that problem?
#94013(merged 2026-07-07, the PR this regression QA ran against) added length validation for text filters. The error only fires when the value strictly EXCEEDS the limit —isValidInputLengthtreatsbyteLength <= maxLengthas valid:App/src/libs/ValidationUtils.ts
Lines 760 to 763 in c08f57f
FILTER_MAX_LENGTHhas explicit entries only for description (1,000), merchant (255) and title (10,000). Report ID and Keyword are not in the map, so they fall back toCONST.MAX_COMMENT_LENGTH= 15,000 bytes:App/src/components/Search/hooks/useTextFilterValidation.tsx
Lines 11 to 21 in c08f57f
App/src/CONST/index.ts
Line 5055 in c08f57f
These filter inputs are plain text inputs with no
maxLength—typedefaults to'default', so BaseTextInput renders a plainRNTextInputwithmaxLength={undefined}(this is not the markdown input, which would cap atMAX_COMMENT_LENGTH + 1):App/src/components/TextInput/BaseTextInput/implementation/index.native.tsx
Lines 101 to 102 in c08f57f
So the error can only ever appear if the user physically gets MORE than 15,000 bytes into the field.
On Android that is impossible: the native field stops accepting input around 5,000 characters.
#94013's own QA steps acknowledge this ("NOTE: Android natively has a max length of 5000"). That saturation is exactly the reported "app simply stops accepting additional text": byteLength plateaus at ~5,000, stays ≤ 15,000,isValidstays true, and the error never renders.The structural cause: the 15,000 fallback is not a real contract for these fields — it is unreachable on Android and 15× larger than what the search pipeline itself accepts. Every text-filter value is serialized into the search query string, and both places a query is typed or re-edited are hard-capped at
CONST.SEARCH_QUERY_LIMIT= 1,000:App/src/components/Search/SearchAutocompleteInput.tsx
Line 226 in c08f57f
App/src/components/Search/SearchPageHeader/SearchPageInput.tsx
Line 67 in c08f57f
Worse,
SearchPageInputloads the current keyword filter back into that 1,000-capped input, so a keyword over 1,000 chars silently truncates on the next edit/submit:App/src/components/Search/SearchPageHeader/SearchPageInput.tsx
Lines 36 to 43 in c08f57f
Affected paths — all of them read the same hook, so it is the single convergence point:
App/src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx
Line 45 in c08f57f
App/src/components/Search/FilterDropdowns/TextFilterPopup.tsx
Line 28 in c08f57f
App/src/components/Search/FilterComponents/ReportField/ReportFieldText.tsx
Line 22 in c08f57f
App/src/types/form/SearchAdvancedFiltersForm.ts
Lines 24 to 32 in c08f57f
This chain explains every symptom: no error (threshold unreachable), input "stops accepting text" (native saturation, Samsung A16), and why only the two fallback fields were flagged while Description/Merchant errored fine (their explicit limits sit far below the saturation point).
What changes do you think we should make in order to solve the problem?
One line in the hook — fall back to the query pipeline's real contract instead of
MAX_COMMENT_LENGTH:Any Report ID / Keyword (and withdrawalID / limit / report-field) value over 1,000 bytes now shows
common.error.characterLimitExceedCounter(e.g. "1,050/1,000") on every platform — 1,000 is comfortably below Android's ~5,000 input ceiling, so the error is actually reachable, and Confirm/Apply stays blocked because all three consumers already gate onerror. Update the fallback unit test at:App/tests/unit/hooks/useTextFilterValidation.test.tsx
Lines 68 to 73 in c08f57f
Regression safety: Description/Merchant/Title keep their explicit limits, nothing else reads the fallback, and values ≤ 1,000 behave exactly as today.
Why the obvious spot fix fails: adding explicit
reportID/keyword: 15000map entries, ormaxLength={15000}on the TextInput, cannot surface the error — it fires only when the value EXCEEDS the threshold, and on Android the field saturates near 5,000 chars so 15,000 is unreachable; amaxLengthcap makes exceeding impossible on every platform (value ≤ cap ⇒isValidalways true), which reproduces the reported behavior verbatim. Changing the comparator to>=("error when the text reaches the limit") doesn't fix the reported device either — the input never reaches 15,000 on Android — and it leaves validation blessing a 14,999-char keyword that the 1,000-capped query editor then silently truncates.What alternative solutions did you explore? (Optional)
FILTER_MAX_LENGTHentries per key (e.g. a much smaller reportID limit, since report IDs are ~20 digits). Reasonable, but the fallback itself stays broken for withdrawalID, limit and report-field filters — the one-line fallback change covers them all, and tighter per-field caps can be layered on later.>=comparator at 15,000 — rejected above: unreachable on Android, so it does not fix the bug.Math.min(limit, SEARCH_QUERY_LIMIT)— would also make Title (10,000, likewise unreachable on Android's ~5,000 ceiling) consistent, but that changes an explicit mapping#94013chose deliberately, so I'd keep it as a design follow-up rather than bundle it here.aswin-s commentedon Jul 7, 2026
Please re-state the problem that we are trying to solve in this issue.
On Android (Hybrid app) and Windows Chrome, when a user enters very long text in the Keyword or Report ID advanced-filter fields, no error message is shown. Instead, the app silently stops accepting additional characters near the 15,000-character limit. The expected behavior is a visible error (matching the pattern already working for Description and Merchant filters) when the byte length of the input reaches or exceeds
CONST.MAX_COMMENT_LENGTH(15 000).What is the root cause of that problem?
FILTER_MAX_LENGTHin[src/components/Search/hooks/useTextFilterValidation.tsx:11](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/hooks/useTextFilterValidation.tsx#L11)–15maps filter keys to their byte-length thresholds:REPORT_IDandKEYWORDare absent. The hook falls back toCONST.MAX_COMMENT_LENGTH(15 000) via the??operator at line 19:There are two compounding bugs:
Bug 1 — off-by-one in the validator. The byte-length check in
[src/libs/ValidationUtils.ts:760](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/libs/ValidationUtils.ts#L760)–763uses<=:This means a value whose byte length equals
byteLength(e.g., exactly 15 000 bytes) is considered valid, so the error never fires at the limit boundary — only for input that has already exceeded it.Bug 2 — Android input wall prevents exceeding the limit. On Android, the native
EditTextunderlying React Native'sTextInput(which has no explicitmaxLengthprop in these filter components) degrades in performance and effectively stops accepting new characters at roughly 15 000 characters. At that point the React-controlledvaluestate is capped at ≤ 15 000 bytes;isValidInputLength(value, 15000)returnsisValid: truefor every render (because of the<=comparison), and theerrorTextprop in theTextInputis never set.The two bugs interact: Bug 1 means the error cannot fire exactly at the limit; Bug 2 means typed ASCII input can never exceed it. Together they ensure the error never fires for typed input on Android or for ASCII input on any platform.
For the working filters (Description = 1 000, Merchant = 255), their limits are well below the Android input wall, so users can type past the threshold and the error fires normally.
Two render surfaces share this bug:
Mobile full-screen filter page —
[src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx:49](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx#L49)–64, rendered viaTextInputFilterContentPageWrapper(native) andTextInputFilterContentPopupWrapper(desktop advanced-filters sheet). TheTextInputat line 49 carrieserrorText={error}andhasError={!!error}but nomaxLength.Web filter-bar dropdown —
[src/components/Search/FilterDropdowns/TextFilterPopup.tsx:44](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/FilterDropdowns/TextFilterPopup.tsx#L44)–53, rendered byuseSearchFiltersBar.tsx:115–119for allisTextFilterKeyentries (which includesKEYWORDandREPORT_ID). ThisTextInputalso passeserrorText={error}andhasError={!!error}but nomaxLength. This is the Windows: Chrome path checked in the issue.What changes do you think we should make in order to solve the problem?
1.
[src/libs/ValidationUtils.ts:760](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/libs/ValidationUtils.ts#L760)–763— change<=to<so the validator returnsisValid: falsewhen the byte length exactly equals the limit:This is the root fix. Once the validator treats
value.length === limitas invalid, the error can fire the moment the user's input reaches the threshold — which is exactly what happens on Android (input walls at ~15 000 bytes) and is also the correct semantic (the limit is the maximum allowed, not an allowed value).2.
[src/components/Search/hooks/useTextFilterValidation.tsx:11](https://github.com/Expensify/App/blob/c08f57f132045c840f58d846dda99d9d0caaa779/src/components/Search/hooks/useTextFilterValidation.tsx#L11)–15— add explicit entries forREPORT_ID,KEYWORD, andWITHDRAWAL_ID(also handled byTextInputFilterContentbut currently absent):This makes the intent explicit, eliminates silent reliance on the
??fallback, and ensures future changes to the default cannot silently change these fields' limits.3.
src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx— forwardmaxLengthto<TextInput>so the native component surfaces a visible cap and, together with the fix in step 1, allows the error to fire the moment input reaches the byte threshold:With the
<fix in place, when typed input fills the nativeTextInputto exactlymaxLengthcharacters the validator now returnsisValid: falseand the error renders immediately.4.
src/components/Search/FilterDropdowns/TextFilterPopup.tsx— apply the samemaxLengthforwarding to the<TextInput>here. This is the web filter-bar popup (viauseSearchFiltersBar) and is the surface affected on Windows: Chrome:5.
TextInputFilterContentPopupWrapper(src/components/Search/FilterDropdowns/SearchAdvancedFiltersPopup/TextInputFilterContentPopupWrapper.tsx) rendersTextInputFilterContent, so it gets the fix from step 3 for free. No direct change needed.6. Unit tests — add/extend tests for
useTextFilterValidationandisValidInputLengthasserting:REPORT_IDandKEYWORDproduce an error string whenvaluebyte length equalsCONST.MAX_COMMENT_LENGTH(the at-limit case, now fixed by the<change).REPORT_IDandKEYWORDproduce an error string whenvaluebyte length exceedsCONST.MAX_COMMENT_LENGTH.REPORT_IDandKEYWORDreturnundefinedwhenvaluebyte length is strictly below the limit.isValidInputLengthreturnsisValid: falsefor input whose byte length equalsbyteLength(regression guard for the off-by-one fix).What alternative solutions did you explore? (Optional)
REPORT_ID/KEYWORDtoFILTER_MAX_LENGTHwithout changing<=to<inisValidInputLengthstill produces no error for typed ASCII input: the Android wall caps the value at exactly 15 000 bytes, andisValidInputLength(value, 15000)returnsisValid: truebecause15000 <= 15000. The fix to the comparator is required.REPORT_ID/KEYWORDtoFILTER_MAX_LENGTHwithout passingmaxLengthtoTextInputdocuments intent but does not change runtime behavior: the??fallback already produces 15 000, and the Android input wall prevents the value from exceeding 15 000 bytes, so the error still never fires.samranahm commentedon Jul 7, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-08 01:45:49 UTC.
Proposal
What is the root cause of that problem?
When we open Spend > Advanced filters and type in the Keyword or Report ID field, the app should show an error after 15,000 characters. Instead, typing just stops and nothing is shown.
These two fields use shared components, not old separate pages:
TextInputFilterContent.tsxTextFilterPopup.tsxBoth already call
useTextFilterValidation. That hook knows how to showcharacterLimitExceedCounterwhen text is over 15,000 characters.The problem is timing. The error only shows when the value goes past 15,000 (15,001+). On Android, the native text field often stops accepting input around the limit before the value ever gets to 15,001. So the hook thinks the text is still valid and never shows an error.
Other inputs in the app (like comments) avoid this by setting
maxLengthto limit + 1 (15,001). That lets the user type one extra character, which triggers the validation error instead of a silent stop.Keyword and Report ID never got that
+ 1cap.What changes do you think we should make in order to solve the problem?
Keep the existing
useTextFilterValidationhook as-is. Only add amaxLengthofCONST.MAX_COMMENT_LENGTH + 1(15,001) on theTextInputfor Keyword and Report ID in both places where users can edit those fields.When the user types the 15,001st character, the hook returns an error, the input shows it, and the Confirm / Apply button stays blocked.
File 1:
TextInputFilterContent.tsxAdd this line after
useTextFilterValidation:Pass it to the
TextInput:File 2:
TextFilterPopup.tsxAdd the same line after
useTextFilterValidation:Pass it to the
TextInput:No changes are needed in
useTextFilterValidation.tsx. Keyword and Report ID already fall back toCONST.MAX_COMMENT_LENGTH(15,000) there.What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Solution Verification Result
Android.Native.mp4
KJ21-ENG commentedon Jul 7, 2026
Proposal
What is the root cause of that problem?
PR #94013 added client-side validation for text search filters, but the rendered text-filter inputs do not provide an input window beyond the validation limit. The validation hook only produces an error after the value exceeds the max length, and Keyword / Report ID fall back to
CONST.MAX_COMMENT_LENGTH(15,000).App/src/components/Search/hooks/useTextFilterValidation.tsx
Lines 11 to 21 in c08f57f
The advanced filter content, filter popup, and report-field text input all render
errorTextfromuseTextFilterValidationand block apply/confirm whenerrorexists, but none of them passes amaxLengththat allows the value to go past the validation limit. On Android, once input stops at the limit, the hook never sees an invalid value, so no error is shown.App/src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx
Lines 43 to 75 in c08f57f
App/src/components/Search/FilterDropdowns/TextFilterPopup.tsx
Lines 28 to 53 in c08f57f
App/src/components/Search/FilterComponents/ReportField/ReportFieldText.tsx
Lines 20 to 34 in c08f57f
The shared
BaseTextInputis not the right layer for this behavior because it just forwards the caller'smaxLengthto the native/web input, and many other callers intentionally usemaxLengthas a hard cap.App/src/components/TextInput/BaseTextInput/implementation/index.native.tsx
Lines 436 to 440 in c08f57f
App/src/components/TextInput/BaseTextInput/implementation/index.tsx
Lines 519 to 523 in c08f57f
What changes do you think we should make in order to solve the problem?
Expose the search text-filter max length from
useTextFilterValidation.tsx, for examplegetTextFilterMaxLength(filterKey), and have the hook use that helper so validation and input caps share the same source of truth.Then update all three
useTextFilterValidationcall sites:TextInputFilterContent: compute the text filter limit and passmaxLength={limit + CONST.ADDITIONAL_ALLOWED_CHARACTERS}to theTextInput.TextFilterPopup: do the same for the filter-chip popup input.ReportFieldText: do the same for dynamic text report-field filters, since it uses the same validation hook andonErrorflow.CONST.ADDITIONAL_ALLOWED_CHARACTERSalready exists for the "allow a little past the search limit" pattern, so Keyword and Report ID can accept 15,001-15,020 characters, renderCharacter limit exceeded (15001/15000), and keep Apply/Confirm blocked through the existingerrorchecks.App/src/CONST/index.ts
Lines 6041 to 6045 in c08f57f
Test coverage:
useTextFilterValidationtests to cover Report ID / Keyword defaulting toCONST.MAX_COMMENT_LENGTHand the exported max-length helper.TextInputFilterContentandTextFilterPopupverifying the renderedTextInputreceivesmaxLength = validationLimit + CONST.ADDITIONAL_ALLOWED_CHARACTERS, shows the validation error atvalidationLimit + 1, and does not apply while invalid.What alternative solutions did you explore? (Optional)
I considered changing
BaseTextInputto automatically allow extra characters whenevermaxLengthis set, but that would affect unrelated inputs that need a strict cap, such as codes, SSN fields, and numeric inputs. Keeping the overflow allowance in the search text-filter layer fixes the validated search fields without weakening hard caps elsewhere.ashu75575 commentedon Jul 7, 2026
Proposal
What is the root cause of that problem?
In the Advanced Search Filters for
Keyword,Report ID, and other text-based filters, the underlyingTextInputlacks a maximum length validation. When a user pastes or types a very long string (> 15,000 characters) into these fields, the app's input buffer either hangs or silently stops accepting characters natively. Furthermore, no validation error is shown in the UI becauseTextInputFilterComponentsand its parentTextInputFilterContentdo not check the input length againstCONST.MAX_COMMENT_LENGTH(15,000 characters) nor pass anyerrorTextto theTextInput.TextInputFilterContent.tsx
index.tsx (FilterComponents)
What changes do you think we should make in order to solve the problem?
We should add character limit validation for text-based Advanced Search Filters by checking if the value exceeds
CONST.MAX_COMMENT_LENGTH(15,000 characters).src/components/Search/FilterComponents/index.tsx:Update
TextInputFilterComponentsto evaluate if the input length exceedsCONST.MAX_COMMENT_LENGTHand pass the standard Expensify character limit error to theerrorTextprop of theTextInput:src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx:Update
TextInputFilterContentto disable the "Confirm" button when theTextInputhas an error, preventing the user from submitting a filter that exceeds the maximum length.This ensures the user sees a clear, localized error message when the character limit is reached, and correctly disables submission.
What alternative solutions did you explore? (Optional)
We could enforce
maxLength={CONST.MAX_COMMENT_LENGTH}directly on theTextInput. However, this would silently block the user from typing past the limit and fail to display the expected error message indicating why their input is blocked, violating the expected result detailed in the bug report. UsingerrorTextandisDisabledprovides a better UX and aligns with how Expensify handles length validation on other comment/input fields.Abdulloh0109 commentedon Jul 7, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-07-07 20:31:45 UTC.
Proposal
What is the root cause of that problem?
This is a gap in #94013 ("Add text-based filter length validation"), which merged on 2026-07-07, hours before this bug was filed.
That PR routes every text filter through the new
useTextFilterValidationhook, which shows a "Character limit exceeded" error once the value's byte length exceeds a per-filter max. ButFILTER_MAX_LENGTHonly defines three keys — Description, Merchant, Title — and everything else falls through toCONST.MAX_COMMENT_LENGTH:App/src/components/Search/hooks/useTextFilterValidation.tsx
Lines 11 to 21 in c08f57f
MAX_COMMENT_LENGTHis 15000 — the chat-message limit, which has nothing to do with search filters:App/src/CONST/index.ts
Line 5055 in c08f57f
So Keyword and Report ID (neither is mapped) inherit a 15000-byte ceiling. The error only fires when the trimmed byte length is strictly greater than that —
isValidInputLengthtreats anything<= maxLengthas valid:App/src/libs/ValidationUtils.ts
Lines 760 to 763 in c08f57f
The catch: 15000 bytes is never reachable inside the field.
TextInputFilterContentpasses nomaxLengthto lower that threshold, and the underlying input stops accepting text well before 15000 — the PR author flagged a native Android cap in the QA steps ("NOTE: Android natively has a max length of 5000"), and the reporter observed exactly this ("The app simply stops accepting additional text after a long input"):App/src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx
Lines 45 to 60 in c08f57f
So the value can never exceed 15000,
isValidstaystrue, and no error is ever shown. Merchant (255) and Description (1000) work because their limits sit far below what the input accepts, so those thresholds are reachable and their errors fire — which is also the proof that a ~1000 limit is reachable on the affected device.Two more keys share this exact fallback and are silently broken the same way: Withdrawal ID, and every report-field text filter (the dynamic
report-field-*keys, which route through the same hook viaReportFieldText). They can't be enumerated inFILTER_MAX_LENGTH, so they all collapse onto the unreachable 15000 default:App/src/components/Search/types.ts
Lines 292 to 301 in c08f57f
What changes do you think we should make in order to solve the problem?
Config layer, one line, in
useTextFilterValidation: change the fallback fromCONST.MAX_COMMENT_LENGTHtoCONST.SEARCH_QUERY_LIMIT(keep the explicit Merchant/Description/Title entries as-is).Why
SEARCH_QUERY_LIMIT(1000) is the right, safe number rather than an invented one:maxLength={CONST.SEARCH_QUERY_LIMIT}(SearchAutocompleteInput, SearchPageInput). A single filter value that feeds into that query should never be allowed to exceed the query itself, so this also removes an existing inconsistency.DESCRIPTION_LIMITis the same 1000 and its error already shows correctly (here), so the fix can't reintroduce the "unreachable threshold" bug.Changing the fallback (rather than adding two explicit map entries) is deliberate: it fixes Keyword, Report ID, Withdrawal ID and the open-ended
report-field-*text filters in one place. Adding onlyKEYWORD/REPORT_IDtoFILTER_MAX_LENGTHwould leave the report-field text filters still broken, since their keys are dynamic and can't be listed.Regression to fix alongside it: the PR's own unit test pins Keyword to the old fallback and expects
MAX_COMMENT_LENGTH— update it to expectSEARCH_QUERY_LIMIT(and/or point it at a genuinely unmapped key), otherwise it fails:App/tests/unit/hooks/useTextFilterValidation.test.tsx
Lines 68 to 72 in c08f57f
No offline/optimistic surface — this is pure client-side validation. The only edge case touched is the empty/whitespace value, which the hook already trims before measuring, and the numeric
limit:filter, which is far too short to ever hit 1000.What alternative solutions did you explore? (Optional)
Hard-cap the filter input with
maxLengthequal to the validation limit. Rejected — the app's pattern here is to let the value exceed the limit and then surface thecharacterLimitExceedCountercounter (that's precisely why Merchant/Description/Title pass nomaxLength). Capping the input at the limit means it can never be exceeded, which suppresses the error for every text filter — reproducing this exact "no error" bug everywhere instead of fixing it.Add explicit
KEYWORD/REPORT_IDentries toFILTER_MAX_LENGTHand leave the fallback asMAX_COMMENT_LENGTH. Rejected as incomplete — it fixes the two reported fields but leaves Withdrawal ID and allreport-field-*text filters (which can't be enumerated in the static map) still validating against the unreachable 15000. Fixing the fallback covers the whole family with less code.Suspecting Keyword/Report ID were never wired into the hook. Refuted by the code:
SearchTextFilterKeysexplicitly listsREPORT_IDandKEYWORD,isTextFilterKeyroutes them intoTextInputFilterContent/TextFilterPopup, and the hook runs for them every keystroke. The hook fires fine — itserrorjust never becomes truthy because the threshold is out of reach. So the defect is the limit value, not the wiring.21 remaining items
yusufdeveloper2903 commentedon Jul 8, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
In the advanced search filters, the Keyword and Report ID fields never surface the "character limit exceeded" error. You keep typing until the field silently stops accepting more characters (on Android the native field walls out first), and the error the tester expected at the limit never appears — even though sibling fields like Description and Merchant show it correctly.
What is the root cause of that problem?
All text filters were routed through the
useTextFilterValidationhook added in #94013. The hook looks up a per-field byte limit inFILTER_MAX_LENGTH, and only three keys are defined — Description, Merchant, Title. Keyword and Report ID aren't in the map, so they fall through to?? CONST.MAX_COMMENT_LENGTH(15,000):App/src/components/Search/hooks/useTextFilterValidation.tsx
Lines 11 to 19 in 92303dd
That 15,000 threshold is effectively unreachable, for two compounding reasons:
isValidInputLengthtreatsvalueByteLength <= byteLengthas valid, so nothing shows until 15,001+ bytes:App/src/libs/ValidationUtils.ts
Lines 760 to 762 in 92303dd
maxLength, and on Android the native field stops accepting input well before 15,000 — Add text-based filter length validation #94013's own QA flags this ("NOTE: Android natively has a max length of 5000"), and the reporter observed exactly that ("the app simply stops accepting additional text after a long input"). So the value plateaus below 15,000,isValidstaystrue, and no error ever renders.This is also why Description (1,000) and Merchant (255) work through the same hook: their thresholds sit far below what the input accepts, so they are actually reachable. Keyword/Report ID's 15,000 is not — that is the entire gap.
A second tell that 15,000 is the wrong number for these fields: every filter value is serialized into the search query string, which is hard-capped at
CONST.SEARCH_QUERY_LIMIT(1,000) in both the autocomplete input and the search page input, and the keyword filter is even reloaded back into that 1,000-capped input — so a keyword over 1,000 chars is silently truncated downstream anyway:App/src/components/Search/SearchAutocompleteInput.tsx
Line 226 in 92303dd
App/src/components/Search/SearchPageHeader/SearchPageInput.tsx
Lines 36 to 41 in 92303dd
App/src/components/Search/SearchPageHeader/SearchPageInput.tsx
Line 67 in 92303dd
MAX_COMMENT_LENGTHis the chat-message limit and was never a real contract for search filters.Note on history: Report ID used to have an explicit limit; it was removed in
3cffd1411ca"fix wrong length" (it had been set toDESCRIPTION_LIMIT, a semantically wrong source), which is what dropped it onto the 15,000 fallback. So the exact number is maintainer-owned — I recommend a reachable value below rather than asserting one.Affected keys — all fall through the same fallback and read this one hook:
keyword,reportID(reported), pluswithdrawalID,limit, and the per-policy report-field text filters (ReportFieldText). Same latent gap everywhere.What changes do you think we should make in order to solve the problem?
Give Keyword and Report ID explicit entries in
FILTER_MAX_LENGTH, exactly like Description/Merchant/Title already have, set to a limit that is actually reachable. I'd useCONST.SEARCH_QUERY_LIMIT(1,000) — the cap the query pipeline already enforces on every filter value — added right next to the existing entries:App/src/components/Search/hooks/useTextFilterValidation.tsx
Lines 11 to 14 in 92303dd
With this, the fields behave identically to how Description works today: the moment the input passes the limit,
useTextFilterValidationreturns the error, the input renders it, and Confirm/Apply stays blocked — all three consumers already gate onerror:App/src/components/Search/FilterComponents/AdvancedFilters/TextInputFilterContent.tsx
Line 72 in 92303dd
App/src/components/Search/FilterDropdowns/TextFilterPopup.tsx
Line 31 in 92303dd
App/src/components/Search/FilterComponents/ReportField/ReportFieldText.tsx
Line 22 in 92303dd
Why this is safe and minimal:
maxLengthprop is needed. The only reason Description surfaces its error and Keyword doesn't is that Description's threshold is reachable and Keyword's isn't. Lowering the threshold below the native input ceiling is sufficient — this keeps the change to one file and reuses the wired-up error path unchanged.SEARCH_QUERY_LIMIT(notDESCRIPTION_LIMIT) gives Report ID a correct semantic source — the query cap that already bounds these values — which addresses why the previousDESCRIPTION_LIMITentry was pulled as "wrong length."SEARCH_QUERY_LIMITsince that is the real query cap.useTextFilterValidationasserting Keyword/Report ID return an error above the limit andundefinedat/below it — this gap slipped through Add text-based filter length validation #94013 precisely because there was no such assertion.What alternative solutions did you explore? (Optional)
CONST.MAX_COMMENT_LENGTHtoCONST.SEARCH_QUERY_LIMIT(one line at L19). This fixes every fallback field at once (withdrawalID/limit/report-fields included). I ranked it second only because it changes those extra fields silently and re-imposes a cap on Report ID that was deliberately removed in "fix wrong length" — explicit per-field entries are more surgical and self-documenting. Happy to take this route if covering the whole class in one line is preferred.maxLength = limit + 1(or+ N) on the inputs so the user can overflow and trip the error. Rejected: on the reported device this does not help — Android's native field walls out around ~5,000, so the user can never reach 15,001, and the error still never appears. It also does not satisfy "error at the 15,000 limit."isValidInputLengthfrom<=to<so the error fires exactly at the limit. Rejected: it is a shared validator with a wide blast radius across the app, and it still would not fix the reported case — the input never reaches 15,000 on Android regardless of the comparator.Abdulloh0109 commentedon Jul 8, 2026
@thesahindia
Fix for #95540 — the "Character limit exceeded" error now shows for the Keyword and Report ID filters (previously they fell back to
MAX_COMMENT_LENGTH= 15000, which was unreachable).Test branch (diff): Abdulloh0109@9e249d7
Windows:
windows.mp4
Android:
android.mp4
melvin-bot commentedon Jul 10, 2026
@thesahindia Whoops! This issue is 2 days overdue. Let's get this updated quick!
Abdulloh0109 commentedon Jul 14, 2026
@thesahindia Could you please assign me to the issue?
aimane-chnaif commentedon Jul 14, 2026
We can close this as expected.
Ref: #94013 (comment)
melvin-bot commentedon Jul 14, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Jul 14, 2026
@thesahindia Still overdue 6 days?! Let's take care of this!
melvin-bot commentedon Jul 16, 2026
@thesahindia 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
melvin-bot commentedon Jul 20, 2026
@thesahindia 12 days overdue now... This issue's end is nigh!
melvin-bot commentedon Jul 21, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Jul 21, 2026
@thesahindia this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!