Match chat document search on file names and clear dropdown divider artifacts - #1260
Merged
Merged
Conversation
The chat grounded-search document picker built its searchable text from itle || file_name, so a file name became unsearchable as soon as a document had extracted title metadata. Filtering also left orphaned section separator lines behind, commonly two stacked rules under the Select All row, because divider visibility scanned for the nearest visible sibling while skipping other dividers and counting the always-visible action row as content. - Add shared ormalizeSearchText and matchesSearchTokens helpers so every typed word must appear and _, -, . act as word breaks - Include the file name in the document search label and render it as a muted second line when it differs from the title - Make divider visibility section-aware and collapse leading, trailing, and adjacent separator lines - Read the title span when syncing the dropdown button label Fixes #1256 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Paul Lizer (paullizer)
force-pushed
the
paullizer-legendary-memory
branch
from
August 18, 2026 01:12
37c34bd to
ab9fb8d
Compare
This was referenced Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1256
What was broken
Two defects in the chat page grounded-search document picker.
File names were unsearchable.
buildDocumentDescriptor()built the searchable text from the display name (title || file_name) plus the section label, so the file name never reached the matcher for any document that had extracted title metadata. Searching200forQuarterly_Report_200_final.pdfreturned "No Matching Documents".Filtering left orphaned separator lines.
updateDropdownStructure()resolved divider visibility by scanning for the nearest visible sibling, butisVisibleItem()reported dividers as not visible, so the scan walked straight through them — and the always-visibledata-search-role="action"row counted as valid content. Every orphaned divider found the same action row above it and the first surviving header below it, so all of them stayed visible.What changed
chat-searchable-select.jsnormalizeSearchText()/matchesSearchTokens(): text and query are lowercased with_,-,.treated as word breaks, and a row matches when every typed token appears somewhere. Matching stays position-independent, so200still matches mid-file-name andreport 200now matchesQuarterly_Report_200_final.pdf..dropdown-header) follows that header and requires visible section content before it; an unbound divider (the static rule under "All" / "Clear All") requires visible content before and visible section content after. Always-visible action rows never count as section content. A finalcollapseRedundantDividers()pass guarantees no leading, trailing, or stacked separator lines regardless of future markup.chat-documents.js/chat-onload.js/chats.csstextContent; both lines go into the row tooltip..chat-document-option-titleinstead of the first descendantspan, which would otherwise concatenate title and file name.No backend change was needed —
/api/documents,/api/group_documents, and/api/public_workspace_documentsalready returnfile_name, and the backend workspace list already matched on title or file name. No new browser assets, so the local-only asset policy and CSP are unaffected.Blast radius
chat-messages.jsrelocates the same#document-dropdownfield into#document-comparison-picker-controls.createSearchableSingleSelect, so the prompt, model, and agent selectors gain multi-word matching. This is intentional for consistency..means a query likea.bmatches text containingaandbseparately. Acceptable for a filename-oriented picker, and it is what makesreport 200work.Validation
functional_tests/test_chat_document_search_filename_matching.py— 8/8 pass. The divider and matching checks are executable, not static: the test loads the productionchat-searchable-select.jsinto a minimal DOM shim through Node and asserts the exact filtered output for the document, scope, and tags dropdowns, including that no leading, trailing, or adjacent separator lines survive. Skips the executable section with a warning when Node.js is unavailable.ui_tests/test_chat_document_search_filename_and_dividers.py— 4/4 pass. Mounts the real modules with production CSS, stubsfetchwith personal/group/public documents, and drivesloadAllDocs(). Covers the muted file-name line (stacking, smaller font, tooltip, suppressed when it duplicates the title), file-name/multi-word/literal/title matching, no orphaned separators plus structure restored on clear, and the mobile drawer without horizontal overflow. All four fail against the pre-fix source (file-name search returnsNo Matching Documents), so this is genuine regression coverage.Regression suite —
test_chat_search_panel_document_row_layout.py,test_chat_document_dropdown_viewport_fit.py,test_chat_scope_selector_sync.py,test_chat_document_action_selector_labels.py,test_chat_grouped_selectors.py,test_chat_compare_modal_document_picker.pyall pass (skips requireSIMPLECHAT_UI_BASE_URL).Pre-existing failures, unchanged by this PR (verified by running them against a pristine
HEAD):functional_tests/test_chat_searchable_selectors.py7/11,functional_tests/test_workspace_scope_prompts_fix.py1/2, andui_tests/test_workflow_cancellation_controls.pywhen run in a batch (a Playwright sync/asyncio isolation issue — it passes alone both with and without these changes).Version bumped to
0.250.209, with fix documentation indocs/explanation/fixes/CHAT_DOCUMENT_SEARCH_FILENAME_AND_DIVIDER_FIX.mdand release notes updated.