fix(chat-store): materialize deliberately shared group history

Merged
JL
2d ago
+1582-14

Received pairwise messageHistoryBundle attachments became unknown timeline rows, and their shared messages were never imported.

Persist eligible attachments inside the inbound durability transaction and consume them through a serial, bounded session downloader. Apply supported primary history messages with stale-copy semantics, translate sender keys from the sharing account's perspective, retain idempotency across restart, and keep imported history out of unread recounts. Classify visible notices as system lines, repair legacy carrier rows, and recover a revoke placeholder's original position without restoring deleted content.

Protocol evidence, bundle hashes, module offsets and limitations are recorded in the investigation. All 579 bundles from whatspec 46f6304, schema 4.4.0 / Web 2.3000.1047483476, were verified against the same commit's lock. Current engine and bridge source do not provide receiver materialization.

Validation:

  • Formatting and warnings-denied Clippy passed for both changed crates and all targets/features.
  • Nextest: 672 passed, 2 skipped. Doctests completed without failures.
  • The identical final regression file fails both tests on base 0ba4118 and passes here.
  • Synthetic fixtures cover durability, complete database reopening, duplicate/reordered copies, identity, malformed/partial bodies, notices/unread pagination and revokes. An earlier concurrent Cargo test run exhausted an existing opening poll budget; that test passed in both complete Nextest runs.

No authenticated reproduction was performed. This imports supported primary GroupHistory.messages; reporting-token, add-on and out-of-window-pin parity remain outside this correction. Only explicitly shared attachments are downloaded.

Hosted CI on 3ba4446 passed: CI ran 2,063 native tests with 13 skips; release artifacts built all four platforms and verified the downloaded archives; Pages built successfully with Publish skipped for this draft. Native Nextest reported one leaky existing daemon launcher fixture, which passed and is untouched here.

Closes #245.


Summary by cubic

Received messageHistoryBundle attachments now materialize shared group history instead of surfacing as unknown timeline rows whose messages were never imported.

  • Persists eligible attachments inside the inbound durability transaction and consumes them through a serial, bounded session downloader.
  • Applies supported history messages with stale-copy semantics, translating sender keys from the sharing account's perspective.
  • Keeps imported history out of unread recounts and renders visible notices as system lines.
  • Repairs legacy carrier rows and recovers a revoke placeholder's original timestamp and kind without restoring deleted content.

Closes #245.

Summary by CodeRabbit

  • New Features
    • Shared group-chat history can now be received and added to the conversation, including while the app retries temporarily unavailable history.
    • History notices appear as system messages when they contain visible information.
  • Bug Fixes
    • Imported history no longer increases unread counts or marks older messages as newly received.
    • Messages that only carry history data no longer appear as unknown items in the conversation.