Skip to content

fix(messages): show and index the text of rich messages (#178) - #186

Merged
neoromantic merged 3 commits into
mainfrom
land/178-rich-text
Nov 18, 2026
Merged

neoromantic merged 3 commits into
mainfrom
land/178-rich-text

Conversation

@neoromantic

Copy link
Copy Markdown
Owner

What and why

Lands #178 (rich messages printed as text: null and were not found by search) on the current main. #178 conflicted with #176/#177. This branch is its head ba0c2b9, unchanged, plus a merge of main. It is merged with a merge commit, so the original commit and its author stay in history and #178 closes as merged.

The merge commit resolves two conflicts:

One docs commit names messages_rich_text as the last migration in the cache_migrations example of docs/database-schema.md.

Behaviour kept from #178 as proposed: messageType stays text, there is no new flag, and the background migration messages_rich_text is included, so rich rows cached earlier become searchable.

How I checked it

  • bun run check: clean. bun run test: 2346 pass, 0 fail. bun run test:e2e: 453 pass, 0 fail. bun run build: dist/tg prints a rich message from the cache without credentials.

  • Migration on a made-up 0.13.1 cache, written by the code of main before this change. Account 1 had 100,000 messages, 10,000 of them rich. Account 2 had 500 messages, 50 rich.

    • Before the migration, messages get already prints the rendered text, and search finds 0.
    • tg db migrate killed with kill -9 at 12,000/100,000 rows: state running, and search finds exactly the 1,200 rows done.
    • A second run did the other 88,000 rows. A third did 0.
    • After it, search finds all 10,000. raw_json is unchanged on every row, and so is every non-empty text, including a message with both a text and a richMessage.
    • Only the empty rich rows got text. FTS5 integrity-check passes.
    • Account 2 stayed pending and untouched until it was migrated itself. Neither account's search finds the other's words.
  • All read paths go through messageItemReader: messages list, get, search, unread, wait and watch.

  • Not checked against Telegram: the live edit path and the media, map and button blocks against real messages. No sync or API calls changed.

  • Tests pass locally and use made-up data only

  • README, docs and affected demos follow the product content standard

  • Title follows Conventional Commits

🤖 Generated with Claude Code

ertembiyik and others added 3 commits November 18, 2026 08:38
A rich message has an empty text and its content in page blocks, so tg
messages printed it as text null and search could not find it. Its blocks
are rendered in Telegram's rich Markdown when the message is cached, and
read from raw_json for rows cached earlier; the background migration
messages_rich_text makes those rows searchable. messageType stays text.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Resolves the conflicts with #176/#177 in CHANGELOG.md (both sections
kept) and src/commands/messages/search.ts (success(data, next) from main,
the snippet from the rendered item text from #178).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@neoromantic
neoromantic merged commit 3a2fb89 into main Nov 18, 2026
5 checks passed
@neoromantic
neoromantic deleted the land/178-rich-text branch November 18, 2026 06:08
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
helpers.ts: a message item gets the transcript and the rich text (neoromantic#186). CHANGELOG: both sides' entries kept. Per-message error lines and the docs example carry retryable (neoromantic#177).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
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