Skip to content

Search: in-channel FTS (/) and workspace search modal (ctrl+f)#85

Merged
gammons merged 28 commits into
mainfrom
feat/search
Jun 11, 2026
Merged

Search: in-channel FTS (/) and workspace search modal (ctrl+f)#85
gammons merged 28 commits into
mainfrom
feat/search

Conversation

@gammons

@gammons gammons commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • In-channel search (/): vim-style search over the current channel's cached history, backed by a new SQLite FTS5 index (messages_fts, external-content table with trigger sync + backfill; LIKE fallback if FTS5 is unavailable). Matches highlight in the message pane; n/N jump between them (wrapping), status line shows /query 3/17, Esc clears. Accent/case-insensitive word-prefix matching.
  • Workspace search (ctrl+f): modal backed by Slack's search.messages with raw query pass-through (from:@user, in:#channel, before: modifiers work). Results render as structured blocks — #channel author date, time header with indented 2-line snippets, searched terms highlighted, mrkdwn entities flattened (mentions/links/usergroups), DM names resolved. Modal sizes to 70% of the terminal; Enter jumps to the message (thread replies open the thread panel); hits in non-member channels toast instead of dead-ending.
  • Jump-to-message history loading (FetchAround): fetches a window around a target ts when it's outside the loaded buffer — used by search jumps and also upgrades the permalink-navigation path from Add 'o' keybinding to open links, with in-app Slack permalink navigation (#62) #71 (which previously toasted "older than loaded history").

Notable hardening along the way: ANSI/OSC-safe highlight renderer, generation-counter guards against stale async search results, anchor-guarded older-history prepends (fixes a latent buffer race), read-only user lookups on the search goroutine (avoids a concurrent map write), contiguous-window guarantee in GetHistoryAround.

Design doc: docs/superpowers/specs/2026-06-10-search-design.md
Plan: docs/superpowers/plans/2026-06-10-search.md

Test Plan

  • go test ./... (48 packages), go vet ./..., -race on the new search paths
  • Live verification against a real workspace: xoxc tokens work with search.messages; / highlights + n/N + off-buffer jumps; ctrl+f modifiers, cross-channel/thread jumps, non-member toast; permalink jump to old message
  • FTS migration smoke on a large existing cache.db (backfill runs once on first start)

Known v1 limitations (deliberate)

  • First 50 server results only ("showing K of N" footer)
  • No "load newer" path back to present after jumping deep into history (re-select the channel)
  • Live messages append to a historical window without a gap marker
  • Reply text is excluded from in-channel / search (replies aren't displayable in the channel pane); workspace search covers them

gammons added 28 commits June 10, 2026 18:27
@gammons gammons merged commit 17ed26c into main Jun 11, 2026
3 checks passed
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