fix(sidebar): preserve relevance order in active-session search results - #2299
Conversation
be40d13 to
d216bd7
Compare
|
CI triage — the Frontend Tests / Coverage Gate failures on be40d13 were main-side, not from this PR. The failing test was |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSAdvisory design-level review of Design-Verdict: PASS Targeted fix that restores an intentional backend contract, aligned with the #2226 companion and command palette — all three search surfaces now agree. [DESIGN-REVIEWED] d216bd7 |
UX Review (Fable 5, fork) — 🟡 CONCERNSAdvisory UX-level review of I have what I need. One real UX regression surfaced: the flat-view lane renders date-segment headers ( UX-Verdict: CONCERNS Relevance ordering lands, but flat view still paints date-segment headers over the now non-date-ordered results — headers repeat and mislead. Watch
Suggestions
[UX-REVIEWED] d216bd7 |
Problem
The sessions sidebar's active-session search ("Search sessions…") discards the backend's relevance ranking.
/api/sessions/searchdeliberately ranks results —search_sessionsinhistory.pygives title hits a 10x field boost (_TITLE_BOOST) precisely so a session named after the query outranks sessions that merely mention it in message content. But the sidebar collapsed the ranked response into a membershipSetand re-sorted the matches withcomparePinnedThenSort(pinned first, then date-desc by default).Observable defect: type
overlwhile a session titled "managing kiro crew session overload" exists. During the 250ms debounce the client-side title-substring fallback shows it as the only match — then the server response lands and the pin/date re-sort buries it below every fresher session whose body happens to contain "overl…" (overly, overlap, …). The best match visibly "falls down" the list mid-keystroke.Fix
useDebouncedSessionSearch's slots transform now returns aMap<slotKey, rank>(first-wins on canonical-key collisions) instead of aSet, andfilteredSlotsorders by that rank while a content search is active — falling back to the existing pinned+sort ordering otherwise. Filtering semantics are unchanged (same membership test, same substring fallback while the response is in flight or belowSEARCH_MIN_CHARS).This is the exact companion of #2226, which fixed the same bug in the Older Sessions lane (
sortedHistoryre-sorting relevance-ranked results by date). The command palette's sessions provider already preserves backend order and biases title matches upward — the three surfaces now agree.Pinned rows intentionally do NOT float above search results: pinning is a reachability promise for browsing (per
sessionOrder.ts's own comment), not a ranking hint inside an explicit search — the regression test locks this with a pinned decoy.Tests
ChatSidebar.slotSearchOrder.test.tsx, mirroringChatSidebar.historySearchOrder.test.tsx(fix(sidebar): preserve relevance order in history search results #2226): a ranked mock response whose title match is the oldest and unpinned slot, with a pinned decoy and a fresher decoy ranked below it. Asserts rendered DOM order equals backend order, plus a fixture-validity guard proving the old pin+date sort would have inverted the fixture.ChatSidebar.tsx.tsc -bclean, eslint 0 errors, full vitest suite green apart from the pre-existingcatalogParityko failure (29 missingpages.sessionStorage.*keys), which reproduces identically on cleanorigin/main.