feat(chat): projection-aware find-in-chat search - #989
Draft
beruro wants to merge 7 commits into
Draft
Conversation
Replace the integration shim with a projection-indexed search hook that scrolls to matches via flat-item targets, syncs highlights across panes, and fixes non-paginated mode where turn page slices clipped scroll indices. Pre-commit hook ran. Total eslint: 0, total circular: 0
Re-wire assistantCopyEventIds and resolveAssistantTurnCopyContent from group meta through ChatHistoryList into AgentTurnContext so AgentMessageBlock no longer crashes when rendering the copy-turn footer. Pre-commit hook ran. Total eslint: 0, total circular: 0
Render ChatSearchBar in the pinned header portal above turn pagination instead of inside the scrollable transcript so it no longer overlays messages. Pre-commit hook ran. Total eslint: 0, total circular: 0
Rust EventStore search can return no hits while the rendered transcript still contains the query (evicted store or id drift). Fall back to scanning the already-loaded chatHistory so result counts match DOM highlights. Pre-commit hook ran. Total eslint: 0, total circular: 0
ChatHistory passes setTurnPageSelection into useChatSearch but the projection hook omitted it from its return object after the search refactor. Pre-commit hook ran. Total eslint: 0, total circular: 0
Search refactor regressed ChatHistoryList by deriving virtualizer keys from body content and splitting static/virtual into early returns. Restore buildChatGroupRenderKeys, keep one scroll container for both modes, forward null through measureVirtualRow, and mock ResizeObserver in the identity regression test. Pre-commit hook ran. Total eslint: 0, total circular: 0
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.
Problem
Find-in-chat search could not reliably scroll to or highlight matches when turn pagination was disabled. The scroll path reused turn-page slices (
pages[currentPageIndex]) to compute Virtuoso flat indices even though the non-paginated view renders the full flat list. Matches outside the first turn page therefore resolved tonulldisplay indices and search appeared broken.The previous
useChatSearchIntegrationshim also duplicated navigation, DOM highlighting, and visibility wiring without a shared projection index or cross-pane sync contract.Solution
Replace the integration shim with a projection-aware
useChatSearchhook and extracted helpers:chatSearchProjection).ChatHistoryList.scrollToChatTargetusing DOM search-target attributes on rendered rows.toDisplayFlatIndexso global flat indices are preserved.chatFindInChatOpenAtomFamily) and publish live query/active match viachatSearchSyncAtomFamilyfor ChatHistory ↔ My Station MessageViewer highlight sync.Potential risks
es_search_chat_eventsIPC must stay in sync with frontend session scoping (sessionIdargument).Verification
pnpm exec vitest run src/engines/ChatPanel/ChatHistory/hooks/__tests__/chatSearchProjection.test.ts src/engines/ChatPanel/ChatHistory/hooks/__tests__/chatSearchHelpers.test.ts src/engines/ChatPanel/hooks/useSessionHeaderActions.test.ts src/engines/ChatPanel/ChatPanelContent.test.ts— 17 passed