Skip to content

fix(hub): source merged-mode search from the server - #657

Open
RonenMars wants to merge 1 commit into
mainfrom
fix/hub-merged-search-server-source
Open

fix(hub): source merged-mode search from the server#657
RonenMars wants to merge 1 commit into
mainfrom
fix/hub-merged-search-server-source

Conversation

@RonenMars

Copy link
Copy Markdown
Owner

Searching the hub in merged mode only filtered conversations that had already been paged in, so anything past the current page was unfindable no matter how specific the query.
This is the default experience — stores/settings.ts:133 sets mergeChats to true.

The asymmetry

mergedClassicItems built its conversation rows from the paged set and never consulted convSearchData, while the non-merged branch at app/index.tsx:510 was already wired to it.
One branch reached the server, the other did not.

useConversationSearch hits GET /api/search?q=…&limit=50, which matches message bodies — exactly the reach a client-side filter over loaded pages does not have.

Verified

On an iPhone 17 Pro Max simulator, Release build, against the mock suite.

e2e/06_search_anchor.yaml previously failed at conversation-row-conv-search-anchor.
With this change that assertion and the tap that follows it both pass — the anchor conversation is found, is tappable, and opens.

npx tsc --noEmit --pretty false holds at the 14-error TS2345 baseline tracked in #606.
ESLint clean on the changed file.

06_search_anchor still fails one step later on search-match-nav, the in-conversation match navigator.
That is a different surface and is not addressed here.

This is half the fix, deliberately

MergedClassicList still re-filters the server's results in filteredItems, matching title and preview only.
A conversation the server matched deep in its message history, whose title and preview contain none of the query terms, is fetched and then silently discarded on the client.

That is the exact case server-side search exists to serve, so the feature still fails where it is most valuable.

The e2e suite cannot detect it. e2e/fixtures/search-results.json gives the anchor a preview of "Where did we set the wombat timeout for the retry loop?", which contains the query, so the flow goes green either way.
Closing that half needs a unit test where the query appears in neither title nor preview.

The remaining work is written up in docs/prompts/, and #646 stays open for it.

Refs #646.

Searching the hub in merged mode only filtered conversations that had already been paged in, so anything past the current page was unfindable no matter how specific the query.
This is the default experience — stores/settings.ts:133 sets mergeChats to true.

mergedClassicItems built its conversation rows from the paged set and never consulted convSearchData, while the non-merged branch at app/index.tsx:510 was already wired to it.
That asymmetry was the bug: one branch reached the server, the other did not.

Take conversations from useConversationSearch while a query is active, since GET /api/search matches message bodies and so finds conversations the client has never loaded.

Verified on an iPhone 17 Pro Max simulator, Release build, against the mock suite: e2e/06_search_anchor.yaml previously failed at conversation-row-conv-search-anchor, and that assertion and the tap that follows it now both pass.
tsc holds at the 14-error TS2345 baseline tracked in #606; eslint clean.

This fixes the source of the list but not the filtering of it.
MergedClassicList still re-filters the server's results on title and preview only, so a conversation matched deep in its message history can be fetched and then dropped on the client.
The shared e2e fixture cannot detect that, because its preview contains the query.

Refs #646.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant