Public: anyone can read this; the crew can change it.

/talk searches across a person's conversations #9484

Parked opened this
Closed without merging

/talk now has a search box above the conversation list. It finds your conversations by title and by words in their turns, and a result opens the conversation at the matching turn. tsc, the gate, design-lint and the talk, conversation, hot-read and schema tests pass.

Notes

stopped parked by the crew deploy e7cdfe2

opened this

/talk now has a search box above the conversation list. It finds your conversations by title and by words in their turns, and a result opens the conversation at the matching turn. tsc, the gate, design-lint and the talk, conversation, hot-read and schema tests pass. I did not run the whole suite; scripts/fast.ts named 1425 files for this diff, so the forge's check runs it on this push. I did not run the app in a browser either, so the scroll to the matching turn is untried.

What changed

  • Index: a new migration, 20261108110000-conversation-find, adds an FTS5 table (conversation_find) with a row per standing person or agent turn and one per non-empty title. It also backfills existing conversations and carries its pin. Triggers keep it current on turn insert, delete, set-aside and restore, on title changes and on conversation deletion. A turn that was replaced stops matching. I used FTS5 because the forge's search is LIKE-based, which would scan the turn text on every keystroke.
  • Search: findConversations and findQuery in src/core/conversations.ts do the lookup.
    • Typed text is reduced to quoted letter and digit words, all required, with the last as a prefix, so search syntax a person types never reaches the engine.
    • Results are limited to the caller's own user_id, best match first and at most 20.
    • Each result carries a snippet and the turn to open.
  • Page: the search is a plain GET form at /talk?find=…, so it needs no script. A result links to /talk/:id?turn=ID#t-ID. pageAround shows that turn with about nine turns after it, so an old turn opens on the right page. That view is the paged one: no stream, and a "Latest" link.
  • Tests:
    • test/conversations.test.ts: a word in an old turn finds its conversation and opens at its page; title search and rename; another person's conversations never appear; set-aside, restore and delete; hostile query syntax.
    • test/talk-conversations.test.ts: the page links a result to its turn, opens at that turn, and leaves out other people's conversations.

Left out

  • There is no highlight on the target turn. talkCss has a byte budget in test/talk-page.test.ts, and a :target outline went over it.
  • Search covers person and agent turns and titles, not tool cards or confirms.
  • It searches archived and active conversations together.
  • There is no search as you type.
  • The index filters by owner after matching. That is fine for one forge's volume, but a heavy-use deployment would want the owner in the index.

Try it

  • Open /talk, type a word from an old message into "Search conversations", and follow the result.

Closes #8823

6 earlier comments · 1 event
commented

/talk now has a search box above the conversation list. It finds your conversations by title and by words in their turns, and a result opens the conversation at the matching turn. tsc, the gate, design-lint and the talk, conversation, hot-read and schema tests pass. I did not run the whole suite; scripts/fast.ts named 1425 files for this diff, so the forge's check runs it on this push. I did not run the app in a browser either, so the scroll to the matching turn is untried.

What changed

  • Index: a new migration, 20261108110000-conversation-find, adds an FTS5 table (conversation_find) with a row per standing person or agent turn and one per non-empty title. It also backfills existing conversations and carries its pin. Triggers keep it current on turn insert, delete, set-aside and restore, on title changes and on conversation deletion. A turn that was replaced stops matching. I used FTS5 because the forge's search is LIKE-based, which would scan the turn text on every keystroke.
  • Search: findConversations and findQuery in src/core/conversations.ts do the lookup.
    • Typed text is reduced to quoted letter and digit words, all required, with the last as a prefix, so search syntax a person types never reaches the engine.
    • Results are limited to the caller's own user_id, best match first and at most 20.
    • Each result carries a snippet and the turn to open.
  • Page: the search is a plain GET form at /talk?find=…, so it needs no script. A result links to /talk/:id?turn=ID#t-ID. pageAround shows that turn with about nine turns after it, so an old turn opens on the right page. That view is the paged one: no stream, and a "Latest" link.
  • Tests:
    • test/conversations.test.ts: a word in an old turn finds its conversation and opens at its page; title search and rename; another person's conversations never appear; set-aside, restore and delete; hostile query syntax.
    • test/talk-conversations.test.ts: the page links a result to its turn, opens at that turn, and leaves out other people's conversations.

Left out

  • There is no highlight on the target turn. talkCss has a byte budget in test/talk-page.test.ts, and a :target outline went over it.
  • Search covers person and agent turns and titles, not tool cards or confirms.
  • It searches archived and active conversations together.
  • There is no search as you type.
  • The index filters by owner after matching. That is fine for one forge's volume, but a heavy-use deployment would want the owner in the index.

Try it

  • Open /talk, type a word from an old message into "Search conversations", and follow the result.
commented

I found nothing to fix, so I pushed nothing.

The deploy log you pasted doesn't show a failure. The app started, the log says ready and done, and the preview is serving. I checked the running preview: /healthz and / both return 200 at https://lab--9484--forge-trevato-apps.open-platform.sh.

"No tests declared, none run" is a note about the preview step, not an error. forge.json declares no test command for it, and my branch leaves forge.json unchanged. The tests are in the forge's check. The check.fast and check.run commands in forge.json run the gate and tsc on the push, and check.verify runs the test shards.

Before my earlier push I ran these locally, and all passed:

  • The gate.
  • tsc --noEmit.
  • Design-lint.
  • The conversation tests.
  • The talk page tests.
  • The hot-read and schema tests.

If the forge's check on #9484 failed, send me that log and I'll fix what it names.

commented

The gate failed because no commit message on the pull had a Try: line. I added an empty commit that has one and pushed it. No code changed.

The line reads: "Try: open /talk on the preview, type a word from a conversation title or turn into the search box, and open a result to land at its turn".

bun scripts/gate.ts now passes locally. I didn't re-run tsc or the tests, since nothing in the code changed.

To try it, open /talk on the preview at https://lab--9484--forge-trevato-apps.open-platform.sh, search for a word from a conversation title or turn, and open a result. It should land on that turn.

Changes requested — before the latest push

Web search works as designed (own-user FTS5 index, quoted words, escaped output, GET form that works without JS, tests for the owner fence). Two required changes before it lands:

  1. Both doors: the terminal has no search. Nothing in src/tui/ changed (src/tui/screens/talk_chats.ts is where conversations are listed there). Add a search to that screen that calls findConversations/pageAround, scoped to the signed-in user, and test it.
  2. No how-to: add docs/features/talk.md (or a talk-search.md) describing the search; do not put it in README.

Smaller: (a) when pageAround returns undefined (hit within the last ~9 turns) the page is marked paged and shows a 'Latest' link plus no live stream/actions on what is actually the latest page; treat that case as unpaged. (b) The search form and result links hand-roll markup (ul/a with two spans) with no named component; use the DESIGN.md list/row component or name the new one in docs/design/areas/talk.md. (c) The matching turn has no visible highlight, so the landing is hard to see on a phone; find a way inside the CSS budget (e.g. trim elsewhere). (d) Results search archived conversations without saying so; label them.

commented

Talk search now works in the terminal as well as on the web, and the review's required changes and four smaller points are addressed. Gate, tsc, design-lint, and 281 tests across 20 talk, conversation, TUI and migration files all pass. The diff was too broad for scripts/fast.ts to name tests, so I picked those files myself and did not run the full suite.

What changed

  • Terminal search: in Conversations, / asks for words and the results replace the list. Archived hits are marked. Enter opens the chat on the page around the match, with that turn marked ▶, r goes back to the newest turns, and esc leaves the results. It calls findConversations and pageAround for the signed-in user. A new test covers the owner fence, archived hits, opening at the match, the empty result and esc.
  • Owner in the MATCH: user_id is now an indexed column in the FTS table, and the query names it (user_id : "<id>" AND text : (…)), so the 200-row limit counts only this person's rows. This is an edit to the not-yet-landed migration 20261108110000-conversation-find, with its pin regenerated. A test has another user with 250 matching rows who cannot crowd out this person's single hit.
  • Docs: I added a Search section to the existing docs/features/talk.md rather than a new file, and nothing goes in the README. It covers the web, the terminal, how it works and what is left out.
  • Latest page: when pageAround returns nothing, the page is now unpaged. It has no "Latest" link, the stream and actions are live, and the #t-… fragment still lands. A test covers it.
  • Design component: the results and the conversation list are now .list of row()s, so they use the existing DESIGN.md row component. docs/design/areas/talk.md says no new class was added.
  • Highlight: .talk-turn:target outlines the landed turn. It replaces the two .talk-chats li a rules that the rows made unnecessary, so the CSS stays inside the budget.
  • Archived label: web results show an "archived" badge on archived conversations, and the terminal marks them too.

Not done

  • The API and MCP don't search yet.
  • Words inside a turn aren't highlighted.
  • Ranking is FTS5's own.
  • In the terminal, n, r and x from the results list clear the results and return to the normal list.

To try: on the preview, search at /talk?find=<word>. In the terminal, open Conversations and press /.

commented

I haven't changed any code for the two failing tests. I think they are flaky, not caused by this pull, and I've pushed an empty commit to re-run the check.

  • Failures: "home waiting line > three asks show one line linking to /review" and "the runtime meters what it runs > deploy, sleep, wake and stop each open or close an interval". Both are in test/home-kpi-row.test.ts and test/meter.test.ts.
  • Local result: run alone, those two files pass (46 tests, 0 failures, 3.2 s).
  • Unrelated imports: neither file imports talk, conversation or migration code.
  • Likely cause: the meter test hit its 90-second timeout in shard 22, which looks like machine load. I did not find the cause of the home-waiting-line failure, and the check log doesn't show why it failed.
  • Check log wording: it says "not re-run alone: the pull changed a failed test or what it imports". Nothing here supports that, so the re-run should show whether the failure repeats.

If either test fails again on the re-run, I'll look at the log.

commented

Talk search is unchanged in this push. I made no code change for the two failing checks, and I haven't confirmed the re-run is green. I pushed an empty commit to trigger the check again.

  • What failed: "home waiting line > three asks show one line linking to /review" (test/home-kpi-row.test.ts) and "the runtime meters what it runs > deploy, sleep, wake and stop each open or close an interval" (test/meter.test.ts). The meter test hit its 90 s timeout, and both ran in shard 22.
  • Why I think they're unrelated: I ran both files alone here and all 46 tests passed. Neither file covers the talk search code. The previous check also failed on two unrelated tests under shard load, which fits a flake.
  • What to watch: if the same two tests fail again on this push, it isn't load and I'd need to look at them properly.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs