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] "Take a test drive" not displayed in suggestions #90861
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: 9.3.75-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#83138 Email or phone of affected tester (no customers):jsat@applausemail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Macbook Pro/iOS 13.7.8, iPhone 13/18.6.2, Samsung S21/Android 15 App Component: Other
Action Performed:
Launch the app
Login with a new Gmail account
Tap the search icon
Enter In: and select take a test drive from suggestions
Expected Result:
"in:take a test drive" is displayed in the suggestions list and can be selected
Actual Result:
"in:take a test drive" is not displayed in the suggestions list after typing "in"
PR #83138 (referenced in this issue) is not the cause — it only changed getQueryWithUpdatedValues which runs at search submission time, not during autocomplete suggestion population.
After tracing the full in: autocomplete path (useAutocompleteSuggestions → getSearchOptions → getValidOptions → optionsOrderAndGroupBy), the filtering logic correctly handles task reports:
Task reports bypass the excludeHidden filter (exempted at L2504 via !report.isTaskReport)
The most likely root cause is that the "Take a test drive" task report does not exist in Onyx when the user opens search. This happens when:
Followups-instead-of-tasks path: Users who select MANAGE_TEAM during onboarding with a micro company size (or with the suggestedFollowups beta) trigger shouldUseFollowupsInsteadOfTasks, which sets tasks = [] at L11778 — no task reports are created at all, including "Take a test drive".
Onboarding timing: If the user accesses search before completeOnboarding runs (which creates tasks optimistically), the task won't exist in the report collection that useFilteredOptions reads from.
For a new Gmail user (classified as individual), the available onboarding choices are EMPLOYER, TRACK_BUSINESS, and TRACK_PERSONAL — all of which include a VIEW_TOUR task ("Take a test drive"). However, if the user's work email merge step associates them with a private domain, they may end up on the MANAGE_TEAM path where the followups suppression activates.
What changes do you think we should make in order to solve the problem?
This needs production evidence to confirm which scenario applies. Specifically:
Check whether the test account completed onboarding and which engagementChoice was sent to CompleteGuidedSetup
Check whether shouldUseFollowupsInsteadOfTasks was true for the account (micro company size + MANAGE_TEAM)
Check whether the task report exists in the account's Onyx store when search is opened
If the root cause is the followups path suppressing tasks, the fix would be in prepareOnboardingOnyxData to ensure the "Take a test drive" task is always created regardless of the followups path (or the search autocomplete should source "Take a test drive" from a different mechanism for followups users).
If the root cause is timing, the fix would be to ensure completeOnboarding runs before the search bar becomes accessible, or to handle the case where onboarding tasks haven't been created yet.
What alternative solutions did you explore? (Optional)
I also investigated whether:
The Peggy parser fails to parse "In:" (case-insensitive) — it handles it correctly via the i flag
The task report could be filtered by processReport due to empty participants — the task has valid participants (owner + assignee)
The maxResults: 10 limit could push the task out — unlikely for a new account with few reports
The chat.text filter at L281 could filter it — getReportName correctly converts the HTML task name to "Take a test drive" via Parser.htmlToText
None of these explain the bug, reinforcing that the task report likely doesn't exist in Onyx at the time of search.
Possibly related:#79952 (the issue PR #83138 fixed) is about in: autocompleting with type:expense incorrectly — different symptom but same search area.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Please re-state the problem that we are trying to solve in this issue.
The search router should show and allow selecting the in:take a test drive autocomplete suggestion, but that report does not appear in the suggestions list.
What is the root cause of that problem?
The in: autocomplete branch only ranks reports that are already present in the local options list. In useAutocompleteSuggestions, the IN case calls getSearchOptions(...).recentReports with searchQuery: autocompleteValue, so it can only suggest reports already loaded into listOptions.
At the same time, SearchAutocompleteList triggers the server report search with getQueryWithoutFilters(autocompleteQueryValue). For an input like in:take, getQueryWithoutFilters returns an empty string because take is a filter value, not a keyword. The debounced search then exits without calling handleSearch, so reports such as the onboarding task "Take a test drive" are never fetched before the local in: suggestions are built.
What changes do you think we should make in order to solve the problem?
In SearchAutocompleteList, derive the server-search term from the active autocomplete filter before falling back to getQueryWithoutFilters. When parseForAutocomplete(autocompleteQueryValue) reports autocomplete.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.IN, use the autocomplete value as the debounced handleSearch input. This lets the existing SearchForReports path hydrate matching reports into Onyx, after which the existing useAutocompleteSuggestionsIN branch can produce in:take a test drive with the reportID substitution.
Keep the existing keyword-only behavior for normal free-text search and for filter keys that should not search reports. Add a regression test that verifies typing in:take causes the autocomplete list to search for take, and that once a matching task/report option exists, the suggestion row is rendered with filterKey: in, text Take a test drive, and mapKey: in.
Scope boundaries:
Files touched (with call sites): src/components/Search/SearchAutocompleteList.tsx — server-search term calculation and debounceHandleSearch (around lines 317 and 383); tests/unit/hooks/useAutocompleteSuggestions.test.ts or a focused SearchAutocompleteList test — in: report suggestion regression.
Platforms: all platforms using the shared search router/autocomplete components.
Code paths / callers explicitly NOT touched: final query normalization in SearchQueryUtils.getQueryWithUpdatedValues, search parser grammar, backend search APIs.
API contracts or backend behavior changes: no.
What alternative solutions did you explore? (Optional)
Changing getQueryWithoutFilters to return filter values would be broader than this bug because that helper is documented as returning only core keyword text. Expanding useAutocompleteSuggestions to call the API directly would also duplicate the existing debounced handleSearch path in SearchAutocompleteList.
Please re-state the problem that we are trying to solve in this issue.
When a brand-new Gmail user signs in, opens the search router (magnifier icon), and types in: to see chat-based suggestions, the autocomplete dropdown does NOT include the onboarding admin task "Take a test drive" even though that task report exists in the user's data after onboarding. The expected suggestion in:take a test drive never appears, so the user cannot pick the test-drive task as a chat-scope filter.
What is the root cause of that problem?
The in: autocomplete entry point lives in useAutocompleteSuggestions and produces suggestions by reading getSearchOptions(...).recentReports and mapping each entry's chat.text to the dropdown row text:
// Set core display properties that are used in SearchOption context
result.text=reportName;
For a task report, getReportName returns the raw stored reportName unless it is detected as HTML, in which case it converts it to plain text. The detection and conversion happen here:
The onboarding admin task that backs "Take a test drive" is created in OnboardingFlow with a Markdown-formatted title Take a [test drive](<testDriveURL>):
The optimistic task report stores that title in reportName after passing it through getParsedComment, which converts Markdown to HTML and lets the getReportName HTML path run cleanly. But the title is also propagated to the server-acknowledged task report, and the value the receiving (newly-signed-in) account ends up reading from Onyx for the test-drive admin task is the Markdown form Take a [test drive](<url>), not the HTML form Take a <a href="<url>">test drive</a>. Because that string contains no <> tags and no &...; entities, Parser.isHTML returns false, the conversion branch is skipped, and getReportName returns the raw Markdown string verbatim.
That raw Markdown string is what arrives at the in: autocomplete row as chat.text. The dropdown then displays a row whose text reads in:Take a [test drive](https://...) rather than in:take a test drive. From the user's perspective the expected suggestion is "not displayed" — the row that should appear as a clean in:take a test drive chip is instead a long Markdown-link blob that doesn't match what they typed (in) and isn't visually recognizable as the test-drive option. Selecting it is also unhelpful because the substitution-map pipeline keyed on the displayed text cannot resolve a Markdown-link string back to the task report.
The bug therefore lives in the isTaskReport branch of getReportName: it only normalizes HTML-shaped task titles and leaves Markdown-shaped task titles raw. Any place that consumes getReportName for a task whose stored reportName is Markdown — the in: autocomplete dropdown is the user-visible case here — gets the unrendered Markdown back.
What changes do you think we should make in order to solve the problem?
Change the task-report branch of getReportName (src/libs/ReportUtils.ts around lines 5778-5781) so that the returned title is always reduced to plain user-visible text, regardless of whether the stored reportName is HTML or Markdown.
Concretely:
If the stored task reportName already contains HTML (tags or entities), keep the existing behavior of running it through Parser.htmlToText(...).trim(). That preserves the working code path that other callers rely on.
If Parser.isHTML returns false, do not return the raw string. Instead, first render the Markdown to HTML using Parser.replace(taskName, {...}) (with the same TASK_TITLE_DISABLED_RULES already applied at task-create time, so we don't expand image syntax), then feed the resulting HTML through Parser.htmlToText(...).trim(). The render-then-strip pass collapses [test drive](<url>) into the plain test drive text, yielding Take a test drive.
The two paths converge on the same shape — plain user-facing text — so callers of getReportName for a task no longer have to know which serialization the backend happened to send. The fix is contained to one function, does not change the reportName storage format, and does not require any change in OptionsListUtils, useAutocompleteSuggestions, or the search router. Every other consumer of getReportName for tasks (LHN row labels, search results header, share-target labels, etc.) also benefits and will stop surfacing raw Markdown brackets in the rare cases they currently can.
After the change, the in: autocomplete will receive chat.text = "Take a test drive", the dropdown renders the suggestion in:Take a test drive, the row is recognizable to the user, and selecting it produces the expected in:take a test drive filter chip. The same fix transparently handles future onboarding tasks whose titles use Markdown formatting (e.g. createTestDriveAdminWorkspaceTask).
A regression-proof unit test belongs in tests/unit/ReportUtilsTest exercising getReportName with a task report whose reportName is the literal Markdown Take a [test drive](https://example.com) and asserting the result is Take a test drive.
What alternative solutions did you explore? (Optional)
Normalizing the task title at the autocomplete edge (inside the IN case of useAutocompleteSuggestions) was considered, but it would only fix the dropdown symptom and leave every other getReportName consumer exposed to the same Markdown-bracket leakage. Fixing the bug centrally in getReportName is the smaller and more consistent change.
Forcing the task reportName to always be HTML at write time was also considered — either at the optimistic creation site or by re-parsing whatever the backend returns. That is broader scope (it touches Onyx data shape and would need a migration story for users who already have Markdown-shaped task names persisted), and getReportName is meant to be the single point where stored-shape variability gets normalized for display, so fixing it there is the right architectural layer.
Please re-state the problem that we are trying to solve in this issue.
When a user launches the app on a new account and navigates to the search input, typing "in:" does not display the onboarding "Take a test drive" task report in the suggestion list. The expected behavior is that "in:take a test drive" should appear in the autocomplete suggestions and be selectable. This prevents users from easily filtering their chats by this task report using the IN search operator.
What is the root cause of that problem?
The bug originates in src/hooks/useAutocompleteSuggestions.ts in the useAutocompleteSuggestions function at lines 252–292. When the IN autocomplete branch calls getSearchOptions to retrieve recent reports, it returns the report's chat.text field which contains markdown link syntax (e.g., Take a [test drive](https://...)). The substring matching logic applied by getValidOptions attempts to match this raw markdown text against the user's input, causing the match to fail because the plain text "take a test drive" does not match the markdown-formatted string.
Additionally, even when rendered, the suggestion text displays the raw markdown rather than a friendly title, making the entry unrecognizable to users. The working analog in the CARD_ID case (lines shown in the same file) demonstrates the pattern of filtering and deduplicating by a normalized, user-readable text value before returning suggestions.
What changes do you think we should make in order to solve the problem?
File:src/hooks/useAutocompleteSuggestions.ts Function:useAutocompleteSuggestions Description: Within the SYNTAX_FILTER_KEYS.IN case, add a helper function to strip markdown link syntax. After retrieving recentReports from getSearchOptions, map each report to normalize its text field by removing markdown before using it for matching, deduplication, and display.
The helper should safely handle null/undefined values and malformed markdown:
functionstripMarkdownLinks(text: string|null|undefined): string{if(!text){return'';}// Replace [label](url) with label; if pattern doesn't match, return text as-isreturntext.replace(/\[([^\]]*)\]\([^)]*\)/g,'$1').trim();}
This regex is deliberately non-greedy and handles malformed markdown gracefully — if the pattern does not match (e.g., plain text with no brackets), replace returns the original string unchanged. The null/undefined guard ensures no runtime errors when report.text or the chat.text field is absent.
After retrieving recentReports, normalize each entry before matching:
Use normalizedReports for: (a) the substring match against autocompleteValue.toLowerCase(), (b) the alreadyAutocompletedKeys dedupe check, and (c) the returned text field in the suggestion object. This ensures the suggestion list displays "Take a test drive" verbatim and a user typing "in:take a test drive" will see and be able to select it.
This fix applies uniformly across Android, iOS, and web (including HybridApp) because useAutocompleteSuggestions is a shared hook with no platform-specific branches in the IN filter path. The markdown stripping happens before any platform-specific rendering, so all surfaces receive the already-normalized plain text string.
What alternative solutions did you explore?
Strip markdown inside getValidOptions/getReportName globally: Rejected because chat.text is consumed by many call sites (LHN, chat finder, mentions) which already render markdown-aware UI. Changing the canonical report name string would risk regressions in those flows. The narrow fix at the IN autocomplete branch only affects the search suggestion list assembly, which is the actual user-visible symptom.
⚠️@aswin-s Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
🚨 Edited by proposal-police: This proposal was edited at 2026-05-17 07:40:22 UTC.
Proposal
What is the root cause of that problem?
The OP repro is the literal QA plan from PR #83138 (Tests / QA Steps 1–6) — "Login with new gmail account → tap search → enter In: → select take a test drive from suggestions". In the attached repro video the new Gmail account selects "Something else" on the onboarding purpose modal, which maps to LOOKING_AROUND (src/CONST/index.ts:112, label "Something else" at src/languages/en.ts:3027) — also independently confirmed by Applause's recording.
The defect is one line of data, not parsing or rendering. onboardingLookingAroundMessage is the only onboarding message whose tasks array is empty:
Every other choice (EMPLOYER, SUBMIT, MANAGE_TEAM, TRACK_WORKSPACE, TRACK_PERSONAL, PERSONAL_SPEND, CHAT_SPLIT, ADMIN, TEST_DRIVE_RECEIVER) attaches either testDriveAdminTask or testDriveEmployeeTask — see OnboardingFlow.ts:301-364. prepareOnboardingOnyxData iterates onboardingMessage.tasks to call buildOptimisticTaskReport (ReportUtils.ts:11828-11840) — empty input → no task report is ever written to Onyx. The IN branch of useAutocompleteSuggestions builds its rows from getSearchOptions(...).recentReports (useAutocompleteSuggestions.ts:259-292), which can only ever surface reports that exist locally. No backing report → no suggestion possible, on any platform.
tasks: [] has been there since the June 2025 refactor commit ec3886fc456 and was untouched by the March 2026 cleanup cb5deac9fe6 ("Remove stale LOOKING_AROUND onboarding message and suppress sign-off"), which only emptied the intro message string and intentionally left tasks alone — i.e. there is no deliberate product decision to deny test drive to "Something else" users. PR #83138 (referenced in the issue body) only adds an in:→type:chat coercion at search submission time (SearchQueryUtils.ts:1867-1879); it is not in the autocomplete population path and is not the cause.
Disproving the competing mechanisms I traced before settling here:
Raw Markdown in getReportName (proposed by another contributor): buildOptimisticTaskReport writes reportName through getParsedComment (ReportUtils.ts:8644), which runs ExpensiMark.replace and stores HTML (Take a <a href="…">test drive</a>). Parser.isHTML returns true for that string (Parser.ts:67-69), so the task branch of getReportName returns clean "Take a test drive". The stored value is not Markdown.
excludeHidden filters out the task report (HIDDEN-preference mechanism): the filter at OptionsListUtils/index.ts:2498-2514 is gated by !report.isTaskReport on line 2504 — task reports are explicitly exempted, regardless of notificationPreference.
Multi-word continuation gap in CONTINUATION_DETECTION_SEARCH_FILTER_KEYS (my own earlier draft, and another contributor's angle): real adjacent bug, but the OP types only In:. The parser returns autocomplete = {key:'in', value:''} directly (useAutocompleteSuggestions.ts:120-138) — autocomplete is not null, the continuation recovery branch is never entered, and the empty-value guard at line 255 only short-circuits when something is already autocompleted (not the case here). The continuation gap does not explain this OP and should be filed separately.
environmentURL async race in buildOptimisticTaskReport: prepareOnboardingOnyxData runs from CompleteGuidedSetup after the user submits the purpose modal — many seconds after app boot, after getEnvironmentURL().then(...) (ReportUtils.ts:1012-1013) has resolved. And even if it did race, LOOKING_AROUND never reaches that code path because tasks is empty.
Followups path / onboarding-timing speculation: deterministically ruled out — LOOKING_AROUND's tasks: [] is the immediate, unconditional explanation; shouldUseFollowupsInsteadOfTasks never enters the picture for this choice.
What changes do you think we should make in order to solve the problem?
End-to-end trace post-fix (no other file needs editing):
New Gmail user picks "Something else" → engagementChoice = LOOKING_AROUND.
prepareOnboardingOnyxData reaches the .filter() at ReportUtils.ts:11791-11824. The VIEW_TOUR-skip block on lines 11801-11814 only fires when introSelected.choice ∈ {EMPLOYER, PERSONAL_SPEND, TRACK_PERSONAL, SUBMIT, CHAT_SPLIT, MANAGE_TEAM}andengagementChoice === MANAGE_TEAM — LOOKING_AROUND is in neither set, so testDriveAdminTask is kept.
buildOptimisticTaskReport (ReportUtils.ts:8621-8660) writes a task report with type: TASK, reportName set via getParsedComment(...) → HTML, and notificationPreference: HIDDEN. The HIDDEN preference is the right thing here — it keeps the task out of the LHN exactly as the other onboarding paths do today (so this fix does not add LHN noise), while the !report.isTaskReport exemption at OptionsListUtils/index.ts:2504 keeps it visible to in: autocomplete.
User taps search, types In:. The IN branch (useAutocompleteSuggestions.ts:252-292) calls getSearchOptions({searchQuery: ''}).recentReports; the new task report has chat.text = "Take a test drive" via createOption → getReportName and is returned in the top 10 recent reports.
A unit-test in tests/unit/OnboardingFlowTest asserting getOnboardingMessages().onboardingMessages[CONST.ONBOARDING_CHOICES.LOOKING_AROUND].tasks contains a task of type CONST.ONBOARDING_TASK_TYPE.VIEW_TOUR locks the regression in.
What alternative solutions did you explore? (Optional)
Inject a synthetic "Take a test drive" suggestion in the IN branch even without a backing task report — rejected: in: chips require an autocompleteID that resolves to a real reportID to filter chats by; without a backing task report the chip selection produces no scope, and the existing test-drive UX (the testDriveAdminTask itself, with its [Take](testDriveURL) link into TestDriveModal) is what the user is actually trying to reach.
Lazy-create the test drive task on first search-router open — heavier surface area, race-prone, and inconsistent with the rest of the onboarding-tasks pipeline. The minimal fix is to keep task provisioning in one place (onboardingMessages.LOOKING_AROUND.tasks) like every other choice.
Add IN to CONTINUATION_DETECTION_SEARCH_FILTER_KEYS (src/CONST/index.ts:9844-9851) — fixes a real but separate latent defect where multi-word in:<chat name> queries drop autocomplete after the first space; worth a follow-up issue, but not what this OP demonstrates.
⚠️@yusufdeveloper2903 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
I reviewed the repro and confirmed “Something else” was selected during onboarding. That path maps to LOOKING_AROUND, which intentionally creates no onboarding tasks, so there is no “Take a test drive” task report available for in: autocomplete.
Given that, the expected result is inconsistent with the selected onboarding flow. Reaching out internally to confirm this behaviour is expected
I am curious about the test steps on the linked PR. Tester suggests that those steps were removed so not sure why it was sent to QA like that cc @annaweber830@sobitneupane#83138 (comment)
I am curious about the test steps on the linked PR.
@marcaaron For the linked PR, "Take a test drive" is not required. The original issue was reported in that context, but the problem itself is not specific to it.
We can update the steps in the PR to:
Launch the app
Login with new gmail account
Tap the search icon
Enter In: and select any chat from the suggestions
Tap enter
Verify that type:chat in included in the search query.
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
MelvinBot commentedon May 16, 2026
Proposal
What is the root cause of that problem?
PR #83138 (referenced in this issue) is not the cause — it only changed
getQueryWithUpdatedValueswhich runs at search submission time, not during autocomplete suggestion population.After tracing the full
in:autocomplete path (useAutocompleteSuggestions→getSearchOptions→getValidOptions→optionsOrderAndGroupBy), the filtering logic correctly handles task reports:excludeHiddenfilter (exempted at L2504 via!report.isTaskReport)includeTasks: trueis set ingetSearchOptionsshouldReportBeInOptionListreturnsDEFAULTfor task reports that exist in OnyxThe most likely root cause is that the "Take a test drive" task report does not exist in Onyx when the user opens search. This happens when:
Followups-instead-of-tasks path: Users who select
MANAGE_TEAMduring onboarding with a micro company size (or with thesuggestedFollowupsbeta) triggershouldUseFollowupsInsteadOfTasks, which setstasks = []at L11778 — no task reports are created at all, including "Take a test drive".Onboarding timing: If the user accesses search before
completeOnboardingruns (which creates tasks optimistically), the task won't exist in the report collection thatuseFilteredOptionsreads from.For a new Gmail user (classified as
individual), the available onboarding choices areEMPLOYER,TRACK_BUSINESS, andTRACK_PERSONAL— all of which include aVIEW_TOURtask ("Take a test drive"). However, if the user's work email merge step associates them with a private domain, they may end up on theMANAGE_TEAMpath where the followups suppression activates.What changes do you think we should make in order to solve the problem?
This needs production evidence to confirm which scenario applies. Specifically:
engagementChoicewas sent toCompleteGuidedSetupshouldUseFollowupsInsteadOfTaskswas true for the account (micro company size + MANAGE_TEAM)If the root cause is the followups path suppressing tasks, the fix would be in
prepareOnboardingOnyxDatato ensure the "Take a test drive" task is always created regardless of the followups path (or the search autocomplete should source "Take a test drive" from a different mechanism for followups users).If the root cause is timing, the fix would be to ensure
completeOnboardingruns before the search bar becomes accessible, or to handle the case where onboarding tasks haven't been created yet.What alternative solutions did you explore? (Optional)
I also investigated whether:
iflagprocessReportdue to empty participants — the task has valid participants (owner + assignee)maxResults: 10limit could push the task out — unlikely for a new account with few reportschat.textfilter at L281 could filter it —getReportNamecorrectly converts the HTML task name to "Take a test drive" viaParser.htmlToTextNone of these explain the bug, reinforcing that the task report likely doesn't exist in Onyx at the time of search.
Possibly related: #79952 (the issue PR #83138 fixed) is about
in:autocompleting withtype:expenseincorrectly — different symptom but same search area.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.KJ21-ENG commentedon May 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
The search router should show and allow selecting the
in:take a test driveautocomplete suggestion, but that report does not appear in the suggestions list.What is the root cause of that problem?
The
in:autocomplete branch only ranks reports that are already present in the local options list. InuseAutocompleteSuggestions, theINcase callsgetSearchOptions(...).recentReportswithsearchQuery: autocompleteValue, so it can only suggest reports already loaded intolistOptions.At the same time,
SearchAutocompleteListtriggers the server report search withgetQueryWithoutFilters(autocompleteQueryValue). For an input likein:take,getQueryWithoutFiltersreturns an empty string becausetakeis a filter value, not a keyword. The debounced search then exits without callinghandleSearch, so reports such as the onboarding task "Take a test drive" are never fetched before the localin:suggestions are built.What changes do you think we should make in order to solve the problem?
In
SearchAutocompleteList, derive the server-search term from the active autocomplete filter before falling back togetQueryWithoutFilters. WhenparseForAutocomplete(autocompleteQueryValue)reportsautocomplete.key === CONST.SEARCH.SYNTAX_FILTER_KEYS.IN, use the autocomplete value as the debouncedhandleSearchinput. This lets the existingSearchForReportspath hydrate matching reports into Onyx, after which the existinguseAutocompleteSuggestionsINbranch can producein:take a test drivewith the reportID substitution.Keep the existing keyword-only behavior for normal free-text search and for filter keys that should not search reports. Add a regression test that verifies typing
in:takecauses the autocomplete list to search fortake, and that once a matching task/report option exists, the suggestion row is rendered withfilterKey: in, textTake a test drive, andmapKey: in.Scope boundaries:
src/components/Search/SearchAutocompleteList.tsx— server-search term calculation anddebounceHandleSearch(around lines 317 and 383);tests/unit/hooks/useAutocompleteSuggestions.test.tsor a focused SearchAutocompleteList test —in:report suggestion regression.SearchQueryUtils.getQueryWithUpdatedValues, search parser grammar, backend search APIs.What alternative solutions did you explore? (Optional)
Changing
getQueryWithoutFiltersto return filter values would be broader than this bug because that helper is documented as returning only core keyword text. ExpandinguseAutocompleteSuggestionsto call the API directly would also duplicate the existing debouncedhandleSearchpath inSearchAutocompleteList.melvin-bot commentedon May 16, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abzokhattab (
External)wildan-m commentedon May 16, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a brand-new Gmail user signs in, opens the search router (magnifier icon), and types
in:to see chat-based suggestions, the autocomplete dropdown does NOT include the onboarding admin task "Take a test drive" even though that task report exists in the user's data after onboarding. The expected suggestionin:take a test drivenever appears, so the user cannot pick the test-drive task as a chat-scope filter.What is the root cause of that problem?
The
in:autocomplete entry point lives inuseAutocompleteSuggestionsand produces suggestions by readinggetSearchOptions(...).recentReportsand mapping each entry'schat.textto the dropdown row text:App/src/hooks/useAutocompleteSuggestions.ts
Lines 252 to 292 in 809efef
chat.textfor a report row is set insidecreateOptionto the value returned bygetReportNamefor that report:App/src/libs/OptionsListUtils/index.ts
Lines 1114 to 1129 in 809efef
For a task report,
getReportNamereturns the raw storedreportNameunless it is detected as HTML, in which case it converts it to plain text. The detection and conversion happen here:App/src/libs/ReportUtils.ts
Lines 5778 to 5781 in 809efef
Parser.isHTMLis intentionally narrow — it only returns true when the input contains an HTML tag (<...>) or a numeric/named HTML entity (&...;):App/src/libs/Parser.ts
Lines 67 to 69 in 809efef
The onboarding admin task that backs "Take a test drive" is created in
OnboardingFlowwith a Markdown-formatted titleTake a [test drive](<testDriveURL>):App/src/libs/actions/Welcome/OnboardingFlow.ts
Lines 190 to 195 in 809efef
The optimistic task report stores that title in
reportNameafter passing it throughgetParsedComment, which converts Markdown to HTML and lets thegetReportNameHTML path run cleanly. But the title is also propagated to the server-acknowledged task report, and the value the receiving (newly-signed-in) account ends up reading from Onyx for the test-drive admin task is the Markdown formTake a [test drive](<url>), not the HTML formTake a <a href="<url>">test drive</a>. Because that string contains no<>tags and no&...;entities,Parser.isHTMLreturnsfalse, the conversion branch is skipped, andgetReportNamereturns the raw Markdown string verbatim.That raw Markdown string is what arrives at the
in:autocomplete row aschat.text. The dropdown then displays a row whose text readsin:Take a [test drive](https://...)rather thanin:take a test drive. From the user's perspective the expected suggestion is "not displayed" — the row that should appear as a cleanin:take a test drivechip is instead a long Markdown-link blob that doesn't match what they typed (in) and isn't visually recognizable as the test-drive option. Selecting it is also unhelpful because the substitution-map pipeline keyed on the displayed text cannot resolve a Markdown-link string back to the task report.The bug therefore lives in the
isTaskReportbranch ofgetReportName: it only normalizes HTML-shaped task titles and leaves Markdown-shaped task titles raw. Any place that consumesgetReportNamefor a task whose storedreportNameis Markdown — thein:autocomplete dropdown is the user-visible case here — gets the unrendered Markdown back.What changes do you think we should make in order to solve the problem?
Change the task-report branch of
getReportName(src/libs/ReportUtils.tsaround lines 5778-5781) so that the returned title is always reduced to plain user-visible text, regardless of whether the storedreportNameis HTML or Markdown.Concretely:
reportNamealready contains HTML (tags or entities), keep the existing behavior of running it throughParser.htmlToText(...).trim(). That preserves the working code path that other callers rely on.Parser.isHTMLreturns false, do not return the raw string. Instead, first render the Markdown to HTML usingParser.replace(taskName, {...})(with the sameTASK_TITLE_DISABLED_RULESalready applied at task-create time, so we don't expand image syntax), then feed the resulting HTML throughParser.htmlToText(...).trim(). The render-then-strip pass collapses[test drive](<url>)into the plaintest drivetext, yieldingTake a test drive.The two paths converge on the same shape — plain user-facing text — so callers of
getReportNamefor a task no longer have to know which serialization the backend happened to send. The fix is contained to one function, does not change thereportNamestorage format, and does not require any change inOptionsListUtils,useAutocompleteSuggestions, or the search router. Every other consumer ofgetReportNamefor tasks (LHN row labels, search results header, share-target labels, etc.) also benefits and will stop surfacing raw Markdown brackets in the rare cases they currently can.After the change, the
in:autocomplete will receivechat.text = "Take a test drive", the dropdown renders the suggestionin:Take a test drive, the row is recognizable to the user, and selecting it produces the expectedin:take a test drivefilter chip. The same fix transparently handles future onboarding tasks whose titles use Markdown formatting (e.g.createTestDriveAdminWorkspaceTask).A regression-proof unit test belongs in
tests/unit/ReportUtilsTestexercisinggetReportNamewith a task report whosereportNameis the literal MarkdownTake a [test drive](https://example.com)and asserting the result isTake a test drive.Compare branch: https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/90861-task-report-name-markdown?expand=1
What alternative solutions did you explore? (Optional)
Normalizing the task title at the autocomplete edge (inside the
INcase ofuseAutocompleteSuggestions) was considered, but it would only fix the dropdown symptom and leave every othergetReportNameconsumer exposed to the same Markdown-bracket leakage. Fixing the bug centrally ingetReportNameis the smaller and more consistent change.Forcing the task
reportNameto always be HTML at write time was also considered — either at the optimistic creation site or by re-parsing whatever the backend returns. That is broader scope (it touches Onyx data shape and would need a migration story for users who already have Markdown-shaped task names persisted), andgetReportNameis meant to be the single point where stored-shape variability gets normalized for display, so fixing it there is the right architectural layer.melvin-bot commentedon May 16, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022055509075834961534
[-]"Take a test drive" not displayed in suggestions[/-][+][$250] "Take a test drive" not displayed in suggestions[/+]aswin-s commentedon May 16, 2026
Please re-state the problem that we are trying to solve in this issue.
When a user launches the app on a new account and navigates to the search input, typing "in:" does not display the onboarding "Take a test drive" task report in the suggestion list. The expected behavior is that "in:take a test drive" should appear in the autocomplete suggestions and be selectable. This prevents users from easily filtering their chats by this task report using the IN search operator.
What is the root cause of that problem?
The bug originates in
src/hooks/useAutocompleteSuggestions.tsin theuseAutocompleteSuggestionsfunction at lines 252–292. When the IN autocomplete branch callsgetSearchOptionsto retrieve recent reports, it returns the report'schat.textfield which contains markdown link syntax (e.g.,Take a [test drive](https://...)). The substring matching logic applied bygetValidOptionsattempts to match this raw markdown text against the user's input, causing the match to fail because the plain text "take a test drive" does not match the markdown-formatted string.Additionally, even when rendered, the suggestion text displays the raw markdown rather than a friendly title, making the entry unrecognizable to users. The working analog in the CARD_ID case (lines shown in the same file) demonstrates the pattern of filtering and deduplicating by a normalized, user-readable text value before returning suggestions.
App/src/hooks/useAutocompleteSuggestions.ts
Lines 252 to 292 in 809efef
What changes do you think we should make in order to solve the problem?
File:
src/hooks/useAutocompleteSuggestions.tsFunction:
useAutocompleteSuggestionsDescription: Within the
SYNTAX_FILTER_KEYS.INcase, add a helper function to strip markdown link syntax. After retrievingrecentReportsfromgetSearchOptions, map each report to normalize itstextfield by removing markdown before using it for matching, deduplication, and display.The helper should safely handle null/undefined values and malformed markdown:
This regex is deliberately non-greedy and handles malformed markdown gracefully — if the pattern does not match (e.g., plain text with no brackets),
replacereturns the original string unchanged. The null/undefined guard ensures no runtime errors whenreport.textor thechat.textfield is absent.After retrieving
recentReports, normalize each entry before matching:Use
normalizedReportsfor: (a) the substring match againstautocompleteValue.toLowerCase(), (b) thealreadyAutocompletedKeysdedupe check, and (c) the returnedtextfield in the suggestion object. This ensures the suggestion list displays "Take a test drive" verbatim and a user typing "in:take a test drive" will see and be able to select it.This fix applies uniformly across Android, iOS, and web (including HybridApp) because
useAutocompleteSuggestionsis a shared hook with no platform-specific branches in the IN filter path. The markdown stripping happens before any platform-specific rendering, so all surfaces receive the already-normalized plain text string.What alternative solutions did you explore?
getValidOptions/getReportNameglobally: Rejected becausechat.textis consumed by many call sites (LHN, chat finder, mentions) which already render markdown-aware UI. Changing the canonical report name string would risk regressions in those flows. The narrow fix at the IN autocomplete branch only affects the search suggestion list assembly, which is the actual user-visible symptom.github-actions commentedon May 16, 2026
aswin-s commentedon May 16, 2026
Updated the proposal above to tighten 3 edge cases (additional guards and broader coverage).
18 remaining items
Fix Expensify#90861: preserve test drive suggestion when in: typed wi…
zaghouri commentedon May 16, 2026
Contributor details
Your Expensify account email: abderrahim.zaghouri@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01de4d792ed0b4759b
melvin-bot commentedon May 16, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
yusufdeveloper2903 commentedon May 17, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-05-17 07:40:22 UTC.
Proposal
What is the root cause of that problem?
The OP repro is the literal QA plan from PR #83138 (Tests / QA Steps 1–6) — "Login with new gmail account → tap search → enter
In:→ select take a test drive from suggestions". In the attached repro video the new Gmail account selects "Something else" on the onboarding purpose modal, which maps toLOOKING_AROUND(src/CONST/index.ts:112, label"Something else"atsrc/languages/en.ts:3027) — also independently confirmed by Applause's recording.The defect is one line of data, not parsing or rendering.
onboardingLookingAroundMessageis the only onboarding message whosetasksarray is empty:App/src/libs/actions/Welcome/OnboardingFlow.ts
Lines 357 to 360 in 45f992d
Every other choice (
EMPLOYER,SUBMIT,MANAGE_TEAM,TRACK_WORKSPACE,TRACK_PERSONAL,PERSONAL_SPEND,CHAT_SPLIT,ADMIN,TEST_DRIVE_RECEIVER) attaches eithertestDriveAdminTaskortestDriveEmployeeTask— seeOnboardingFlow.ts:301-364.prepareOnboardingOnyxDataiteratesonboardingMessage.tasksto callbuildOptimisticTaskReport(ReportUtils.ts:11828-11840) — empty input → no task report is ever written to Onyx. The IN branch ofuseAutocompleteSuggestionsbuilds its rows fromgetSearchOptions(...).recentReports(useAutocompleteSuggestions.ts:259-292), which can only ever surface reports that exist locally. No backing report → no suggestion possible, on any platform.tasks: []has been there since the June 2025 refactor commitec3886fc456and was untouched by the March 2026 cleanupcb5deac9fe6("Remove stale LOOKING_AROUND onboarding message and suppress sign-off"), which only emptied the intromessagestring and intentionally lefttasksalone — i.e. there is no deliberate product decision to deny test drive to "Something else" users. PR #83138 (referenced in the issue body) only adds anin:→type:chatcoercion at search submission time (SearchQueryUtils.ts:1867-1879); it is not in the autocomplete population path and is not the cause.Disproving the competing mechanisms I traced before settling here:
getReportName(proposed by another contributor):buildOptimisticTaskReportwritesreportNamethroughgetParsedComment(ReportUtils.ts:8644), which runsExpensiMark.replaceand stores HTML (Take a <a href="…">test drive</a>).Parser.isHTMLreturnstruefor that string (Parser.ts:67-69), so the task branch ofgetReportNamereturns clean"Take a test drive". The stored value is not Markdown.excludeHiddenfilters out the task report (HIDDEN-preference mechanism): the filter atOptionsListUtils/index.ts:2498-2514is gated by!report.isTaskReporton line 2504 — task reports are explicitly exempted, regardless ofnotificationPreference.CONTINUATION_DETECTION_SEARCH_FILTER_KEYS(my own earlier draft, and another contributor's angle): real adjacent bug, but the OP types onlyIn:. The parser returnsautocomplete = {key:'in', value:''}directly (useAutocompleteSuggestions.ts:120-138) —autocompleteis notnull, the continuation recovery branch is never entered, and the empty-value guard at line 255 only short-circuits when something is already autocompleted (not the case here). The continuation gap does not explain this OP and should be filed separately.environmentURLasync race inbuildOptimisticTaskReport:prepareOnboardingOnyxDataruns fromCompleteGuidedSetupafter the user submits the purpose modal — many seconds after app boot, aftergetEnvironmentURL().then(...)(ReportUtils.ts:1012-1013) has resolved. And even if it did race,LOOKING_AROUNDnever reaches that code path becausetasksis empty.LOOKING_AROUND'stasks: []is the immediate, unconditional explanation;shouldUseFollowupsInsteadOfTasksnever enters the picture for this choice.What changes do you think we should make in order to solve the problem?
Attach the existing
testDriveAdminTaskto theLOOKING_AROUNDonboarding message atsrc/libs/actions/Welcome/OnboardingFlow.ts:357-360:const onboardingLookingAroundMessage: OnboardingMessage = { message: '', - tasks: [], + tasks: [testDriveAdminTask], };End-to-end trace post-fix (no other file needs editing):
engagementChoice = LOOKING_AROUND.prepareOnboardingOnyxDatareaches the.filter()atReportUtils.ts:11791-11824. TheVIEW_TOUR-skip block on lines 11801-11814 only fires whenintroSelected.choice ∈ {EMPLOYER, PERSONAL_SPEND, TRACK_PERSONAL, SUBMIT, CHAT_SPLIT, MANAGE_TEAM}andengagementChoice === MANAGE_TEAM—LOOKING_AROUNDis in neither set, sotestDriveAdminTaskis kept.buildOptimisticTaskReport(ReportUtils.ts:8621-8660) writes a task report withtype: TASK,reportNameset viagetParsedComment(...)→ HTML, andnotificationPreference: HIDDEN. The HIDDEN preference is the right thing here — it keeps the task out of the LHN exactly as the other onboarding paths do today (so this fix does not add LHN noise), while the!report.isTaskReportexemption atOptionsListUtils/index.ts:2504keeps it visible toin:autocomplete.In:. The IN branch (useAutocompleteSuggestions.ts:252-292) callsgetSearchOptions({searchQuery: ''}).recentReports; the new task report haschat.text = "Take a test drive"viacreateOption → getReportNameand is returned in the top 10 recent reports.in:Take a test drivewithautocompleteID = <taskReportID>,mapKey = 'in'. Selecting it produces the substituted chip and, via PR fix: Report - Searching "in" auto completes syntax with type:expense incorrectly. #83138's coercion atSearchQueryUtils.ts:1867-1879, the submitted query becomestype:chat in:take a test drive— exactly matching step 6 of fix: Report - Searching "in" auto completes syntax with type:expense incorrectly. #83138's QA expectation.A unit-test in
tests/unit/OnboardingFlowTestassertinggetOnboardingMessages().onboardingMessages[CONST.ONBOARDING_CHOICES.LOOKING_AROUND].taskscontains a task of typeCONST.ONBOARDING_TASK_TYPE.VIEW_TOURlocks the regression in.What alternative solutions did you explore? (Optional)
in:chips require anautocompleteIDthat resolves to a realreportIDto filter chats by; without a backing task report the chip selection produces no scope, and the existing test-drive UX (thetestDriveAdminTaskitself, with its[Take](testDriveURL)link intoTestDriveModal) is what the user is actually trying to reach.onboardingMessages.LOOKING_AROUND.tasks) like every other choice.INtoCONTINUATION_DETECTION_SEARCH_FILTER_KEYS(src/CONST/index.ts:9844-9851) — fixes a real but separate latent defect where multi-wordin:<chat name>queries drop autocomplete after the first space; worth a follow-up issue, but not what this OP demonstrates.github-actions commentedon May 17, 2026
abzokhattab commentedon May 17, 2026
I reviewed the repro and confirmed “Something else” was selected during onboarding. That path maps to
LOOKING_AROUND, which intentionally creates no onboarding tasks, so there is no “Take a test drive” task report available forin:autocomplete.Given that, the expected result is inconsistent with the selected onboarding flow. Reaching out internally to confirm this behaviour is expected
abzokhattab commentedon May 18, 2026
Tagging an internal engineer to confirm
🎀 👀 🎀 C+ reviewed
melvin-bot commentedon May 18, 2026
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
marcaaron commentedon May 19, 2026
I am curious about the test steps on the linked PR. Tester suggests that those steps were removed so not sure why it was sent to QA like that cc @annaweber830 @sobitneupane #83138 (comment)
Can we close this?
sobitneupane commentedon May 19, 2026
@marcaaron For the linked PR, "Take a test drive" is not required. The original issue was reported in that context, but the problem itself is not specific to it.
We can update the steps in the PR to:
type:chatin included in the search query.marcaaron commentedon May 20, 2026
Ok, but also seems like there is no problem because this being removed is the expected behavior? Do you agree?
marcaaron commentedon May 20, 2026
I am pretty sure there is nothing to fix here so going to close this out.