Skip to content

Messages and chats are cached with different peer ID formats #18

Closed

Description

@neoromantic

messages_cache stores marked peer IDs (-100… for channels and supergroups, negative for basic groups), but chats_cache stores raw positive IDs. On a real account, 108 of the 110 chats that had cached messages had no matching chats_cache row.

Effects:

  • every tg messages search result for a group or channel has chat.title, chat.username and chat.type set to null;
  • --chat filters and SQL joins between the two tables miss groups and channels.

Fix: pick one format (marked IDs, as mtcute uses) for every cache table, migrate existing rows, and route all ID conversions through src/utils/telegram-peer-ids.ts.

Done when messages search returns the chat title for supergroup messages in an e2e test, and a migration test covers the old format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions