Skip to content

refactor: one module for the transcript window - #4

Merged
nerdstep merged 4 commits into
mainfrom
transcript-window
Nov 25, 2026
Merged

nerdstep merged 4 commits into
mainfrom
transcript-window

Conversation

@nerdstep

Copy link
Copy Markdown
Owner

Summary

The transcript (the messages shown, as far back as they're loaded) now lives in one module. Before, the store kept a messages array and a module-level loaded set in step by hand, in five places.

 ui/src/
 ├── store.ts            # holds the Transcript; its loaders fetch, then apply one function
+├── transcript.ts       # pure value + functions: add, update, prepend, fill, fromPage, gapTo, quoteOf, targetOf
+└── transcript.test.ts  # the UI's first tests (bun test)
reveal(target: Cursor)          # search hits and reply quotes, one path
  gap = gapTo(transcript, target)
  if gap: fill(transcript, await getMessagesBetween(gap))
  jump to target

Two fixes come with it:

  • A quoted message that vanishes says so right away. quoteOf builds the quote the way Db::show does. The live update used to leave out vanished, so the quote said "Deleted message".
  • Clicking a reply's quote reaches messages that aren't loaded yet. Quote gains hlc (None when the message isn't on this computer), so a quote goes through reveal like a search hit. jumpTo is gone.

The UI tests run with bun test, through @types/bun, the one new dev dependency. They run as bun run test locally and in CI's UI job. GLOSSARY.md adds Transcript.

Evidence

  • Before: the UI had no tests.
    After: 15 tests in transcript.test.ts cover:
    • display order
    • live messages: in order, once, and held back while older pages remain
    • pages: older pages before, live arrivals after the first page, starting over
    • gaps: to a search hit or a reply's quote, and nothing needed when it's loaded
    • updates: an edit, a delete, a vanish, and a message that isn't loaded
  • Vanish: the new test expects { text: null, deleted: true, vanished: true, file: null } on the quote. The old patch had no vanished.
  • Rust: a db.rs test checks Quote.hlc: Some(1) for a stored message, and None once it's cleared ("nowhere to jump to").
  • Checks: every commit passes bun run check, bun run test, cargo fmt --check, clippy -D warnings and cargo test on its own.
  • Not yet tried in the app: a reply jump with the window scrolled near the bottom of a long history.

Merge Danger

Door: two-way

There's no wire or schema change. Quote.hlc is part of the UI's view, which always ships with its own backend.

Blast Radius: transcript

The change touches everything that adds messages to the transcript or scrolls it: live messages, paging, search jumps, reply jumps and clearing. Rows still re-render only when their own message changes.

🤖 Generated with Claude Code

nerdstep and others added 4 commits November 25, 2026 10:25
transcript.ts holds the loaded messages, their keys and whether older
ones remain, with pure functions for a live message, an update, a page,
a gap and starting again. The store keeps the value; its loaders fetch
and then apply one. This replaces the messages array and the module-level
loaded set the store kept in step by hand in five places.

The UI's first tests run with bun test (@types/bun for tsc), as
`bun run test` locally and in CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
quoteOf builds a reply's quote the way Db::show does: a deleted or
vanished message shows no text or file, and a vanished one says it
vanished. The live update used to leave out vanished, so the reply said
"Deleted message" until the history was loaded again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reply's quote now carries the quoted message's place in display order
(Quote.hlc, None when it isn't on this computer), so clicking it goes
through reveal like a search hit: it loads the history back to the
message, then scrolls there. It used to do nothing unless the message
was already loaded. jumpTo in the transcript is gone; the scroll finds
the message through the transcript module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nerdstep
nerdstep merged commit 9a6c249 into main Nov 25, 2026
3 checks passed
@nerdstep
nerdstep deleted the transcript-window branch November 25, 2026 18:43
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