Skip to content

feat(search): turn results into a triage surface - #23

Merged
jack-arturo merged 3 commits into
mainfrom
feat/ux-search-triage
Jun 12, 2026
Merged

jack-arturo merged 3 commits into
mainfrom
feat/ux-search-triage

Conversation

@jack-arturo

Copy link
Copy Markdown
Member

What

PR-4 of the UX roadmap (after #19/#20): search results become a triage surface instead of a flat list of 80-char prefixes. For a 10k+ store, "which of these rows actually answers my question" is the whole game — and /recall already returned everything needed; the UI was discarding it.

Result rows

  • Snippet windowed around the first literal match, with every in-window occurrence highlighted (<mark>)
  • matched: tag-name chip when the hit is in tags rather than content (semantic-only hits show neither)
  • Thin importance bar in the node's type color — same encoding as node size in the scene
  • Compact relative date (13d, 8mo) with the absolute date on hover

Header

  • Sort strip: Relevance (backend order) | Recent | Important
  • Type pills with counts, filtering rendered rows client-side — pills reset when the query changes, so a stale refinement can never silently filter a new search (caught live during verification)
  • The 100-result cap shows a refinement banner instead of silence

Search bar

  • Remembers the last 5 settled queries (2.5s dwell — typing intermediates like "groo" → "groover cur" cancel the timer, so prefixes never pollute the list) and offers them with their last match counts on focus, portaled past the header's overflow clipping

Verification (live, 10k-memory local store)

  • ✅ 10 match highlights, 52 importance bars, relative dates, sort strip, type pills (Decision 18 / Memory 15 / Context 13 / Insight 4) on "railway deployment"
  • ✅ Important sort: top rows all importance 1.00; type pill → only that type renders; Clear restores
  • ✅ "stacyoffline" (tag-only term): 4 matched: stacyoffline chips + content highlights where the literal occurs
  • ✅ Recents: dropdown lists stacyoffline · 74 in store / memory · 99 / railway deployment · 43; clicking re-runs the search and closes the panel
  • ✅ Stale-pill bug found & fixed live (type filter persisted across query changes)
  • ⚠️ Capped banner verified by code review only — the dev store's relevance threshold tops out at 99 results, so results.length >= 100 can't trigger locally; it rides the same capped flag that already renders the "+" suffix
  • ✅ npm run lint (0 errors, 14 warnings = baseline) + npm run build green

🤖 Generated with Claude Code

Search is the entry point for every real question against a 10k+ store, and
results were flat 80-char prefixes that discarded most of what /recall
returns. Result rows now show: a snippet windowed around the first literal
match with every in-window occurrence highlighted; a 'matched: tag' chip when
the hit is in tags rather than content; a thin importance bar (same encoding
as node size in the scene); and a compact relative date. The header gains a
Relevance | Recent | Important sort strip and per-type filter pills with
counts — pills reset when the query changes so a stale refinement can never
silently filter a new search. The 100-result server cap gets a refinement
banner instead of silence. The search bar remembers the last 5 settled
queries (2.5s dwell so typing prefixes never pollute the list) and offers
them with their match counts on focus, portaled past the header's overflow
clipping.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 11, 2026 22:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the search UI from a flat prefix list into a richer “triage surface”, adding snippet highlighting, tag-hit signaling, relative dates, importance cues, client-side sorting/filtering controls, and a recent-searches affordance to make large-store search results more scannable and actionable.

Changes:

  • Add shared snippet/tag-match/relative-date helpers for consistent search-result presentation.
  • Enhance search results with sort modes, type-pill filtering, capped-results guidance, match-highlight snippets, tag-hit chips, importance bars, and relative timestamps.
  • Add persisted recent-search history (last 5, dwell-based) and a portaled dropdown in the search bar.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/lib/searchSnippet.ts Introduces pure helpers for windowed snippets + highlighting, matched-tag detection, and compact relative time formatting.
src/components/SearchResultsList.tsx Turns results into a triage UI with sorting, type pills, capped banner, richer rows (snippets/highlights/chips/bars/dates), and an empty-visible state.
src/components/SearchBar.tsx Adds a portaled recent-search dropdown and associated props/types for showing prior queries with counts.
src/App.tsx Persists and supplies recent searches using a dwell timer keyed off settled recall results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/SearchResultsList.tsx Resolved
Comment thread src/components/SearchResultsList.tsx Resolved
Comment thread src/App.tsx Resolved
Comment thread src/components/SearchBar.tsx Resolved
jack-arturo and others added 2 commits June 12, 2026 00:32
- Keyboard support for the recent-searches dropdown via the combobox
  pattern: ArrowDown/Up cycle a highlighted row, Enter selects, Escape
  closes — all handled on the input so focus never leaves it and blur can't
  race the selection. Panel gets role=listbox/option with aria-selected;
  input gets role=combobox + aria-expanded/controls/autocomplete.
- Skip recording zero-result searches (behavior now matches the comment —
  a query with nothing in store isn't worth offering as a shortcut).
- Type-filter reset keeps Set identity when already empty (no extra state
  update per keystroke).
- Zero-visible-rows message falls back to a generic 'No results.' when no
  type filter is active (defensive — that branch is unreachable today).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ene, pill-synced graph

Three pieces of review feedback on the triage surface:

- Match highlights were illegible: Tailwind opacity modifiers (bg-accent/25)
  silently drop when theme colors are CSS-var strings, so <mark> fell back to
  the UA's yellow with near-white text. Explicit rgba classes now give a
  near-white wash with white text (same fix for the matched-tag chip and the
  capped banner riding bg-warn/10).
- The spotlight never visually landed: matches brighten 2.0x into the bloom
  while non-matches keep their hue and recede into the void (multiplyScalar
  0.15 — no gray lerp; that read as mud). True per-instance alpha was tried
  and rejected: translucent spheres still write depth, punching silhouette
  holes in the edge web. The additive-blended cluster nebulas re-accumulate
  to full glow at any nonzero opacity and were drowning the dim — they hide
  during spotlight (their own fade animates the transition), ambient edge
  particles pause, and the ~7k-edge web recedes to 30%.
- The sidebar's type pills now drive the scene: the filter is lifted to App
  and gates the canvas matchingIds, so narrowing the list narrows the
  spotlight (and label priority) too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jack-arturo

Copy link
Copy Markdown
Member Author

Pushed 7a27917 addressing Jack's review feedback:

  1. Highlights are now legible — root cause was sneaky: Tailwind opacity modifiers (bg-accent/25) silently drop when theme colors are CSS-var strings, so <mark> fell back to the browser's default yellow with near-white text. Explicit rgba classes now render a near-white wash + white text. Same latent bug fixed on the matched-tag chip and capped banner.
  2. The spotlight actually lands now — matches brighten 2.0× into the bloom; non-matches keep their hue and recede into the void (no gray lerp — that read as mud). Per-instance alpha was tried and rejected: translucent instanced spheres still write depth, punching silhouette holes in the edge web. The real drowning culprit was the additive-blended cluster nebulas, which re-accumulate to full glow at any nonzero opacity — they now hide during spotlight, ambient particles pause, and the edge web recedes to 30%.
  3. Type pills drive the graph — the filter lives in App now and gates the canvas match set, so narrowing the list narrows the scene spotlight (verified live: Habit pill → only Habit matches stay lit).

🤖 Generated with Claude Code

@jack-arturo
jack-arturo merged commit f2c213f into main Jun 12, 2026
3 checks passed
@jack-arturo
jack-arturo deleted the feat/ux-search-triage branch June 12, 2026 12:38
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.

2 participants