docs: history sync compressed streaming API (PR #853) - #323
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
📝 WalkthroughWalkthroughThis PR updates documentation for the WhatsApp Rust SDK to reflect history sync event compression with streaming support and introduces revised APIs for multiple event types. The changelog documents the shift to compressed payloads with on-demand decompression, while ChangesEvent API Documentation
Sequence DiagramsequenceDiagram
participant Client
participant LazyHistorySync
participant HistorySyncStream
participant HistorySync as HistorySync Proto
Client->>LazyHistorySync: compressed_bytes()
LazyHistorySync-->>Client: Bytes (compressed)
Client->>LazyHistorySync: get()
LazyHistorySync-->>Client: Option ~HistorySync~ (cached)
Client->>LazyHistorySync: stream()
LazyHistorySync-->>Client: HistorySyncStream
loop Process Conversations
Client->>HistorySyncStream: next_conversation()?
HistorySyncStream-->>Client: Proto (decoded)
end
Client->>HistorySyncStream: remainder()?
HistorySyncStream-->>Client: Bytes (final chunk)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
concepts/events.mdx (1)
1519-1553:⚠️ Potential issue | 🟠 MajorAlign docs with
compressed_bytes()/decompress()and remove.raw_bytes()guidance.
concepts/architecture.mdx:498andapi/bot.mdx:487still describeLazyHistorySyncas wrapping a “decompressed blob” and tell consumers to use.raw_bytes()for custom partial decoding; update these to the newcompressed_bytes()/decompress()contract (and adjust wording accordingly).concepts/events.mdxuses## RawNode; format it per docs heading/code-reference conventions (e.g.,## \RawNode`` or sentence-case form).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@concepts/events.mdx` around lines 1519 - 1553, Update the docs to reflect that LazyHistorySync exposes compressed bytes and a decompression API rather than a “decompressed blob”: replace any guidance to use `.raw_bytes()` with instructions to call `compressed_bytes()` for zero-copy access and `decompress()` to get an inflated `Bytes` buffer; update text in concepts/architecture.mdx and api/bot.mdx where `LazyHistorySync` is described (search for mentions of `LazyHistorySync`, `.raw_bytes()`, “decompressed blob”) to use the new `compressed_bytes()`/`decompress()` contract and adjust wording about partial decoding accordingly. Also reformat the heading `RawNode` in concepts/events.mdx to follow docs conventions (e.g., use a code reference like `RawNode` or sentence-case) so it renders consistently with other code references.
🧹 Nitpick comments (1)
changelog/2026-06-11-history-sync-compressed-streaming.mdx (1)
10-10: ⚡ Quick winRewrite this paragraph in second person and split it into shorter sentences.
This sentence packs multiple ideas and uses third-person narration. Please rewrite it so you address the reader directly and keep one idea per sentence.
As per coding guidelines, "Use active voice and second person ('you') in documentation" and "Keep sentences concise — one idea per sentence in documentation".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@changelog/2026-06-11-history-sync-compressed-streaming.mdx` at line 10, Rewrite the paragraph to address the reader in second person and split it into short, single-idea sentences using active voice: explain that Event::HistorySync used to carry a fully decoded Box<wa::HistorySync> (the whole conversation history as a heap-allocated Rust struct), note that large InitialBootstrap chunks could reach 5–20 MB after decoding, then state that the event is now Box<LazyHistorySync>, and finish by saying LazyHistorySync keeps the original zlib-compressed bytes (about 10× smaller) and decodes on demand; ensure each sentence contains only one idea and reference the symbols Event::HistorySync, Box<wa::HistorySync>, InitialBootstrap, Box<LazyHistorySync>, and LazyHistorySync.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@concepts/events.mdx`:
- Line 1966: The heading "## RawNode" should format the identifier as inline
code; update the heading to use code formatting for the symbol RawNode (i.e.,
change the heading to use backticks around RawNode) so it reads as a code
reference and follows the documentation guideline for code identifiers.
---
Outside diff comments:
In `@concepts/events.mdx`:
- Around line 1519-1553: Update the docs to reflect that LazyHistorySync exposes
compressed bytes and a decompression API rather than a “decompressed blob”:
replace any guidance to use `.raw_bytes()` with instructions to call
`compressed_bytes()` for zero-copy access and `decompress()` to get an inflated
`Bytes` buffer; update text in concepts/architecture.mdx and api/bot.mdx where
`LazyHistorySync` is described (search for mentions of `LazyHistorySync`,
`.raw_bytes()`, “decompressed blob”) to use the new
`compressed_bytes()`/`decompress()` contract and adjust wording about partial
decoding accordingly. Also reformat the heading `RawNode` in concepts/events.mdx
to follow docs conventions (e.g., use a code reference like `RawNode` or
sentence-case) so it renders consistently with other code references.
---
Nitpick comments:
In `@changelog/2026-06-11-history-sync-compressed-streaming.mdx`:
- Line 10: Rewrite the paragraph to address the reader in second person and
split it into short, single-idea sentences using active voice: explain that
Event::HistorySync used to carry a fully decoded Box<wa::HistorySync> (the whole
conversation history as a heap-allocated Rust struct), note that large
InitialBootstrap chunks could reach 5–20 MB after decoding, then state that the
event is now Box<LazyHistorySync>, and finish by saying LazyHistorySync keeps
the original zlib-compressed bytes (about 10× smaller) and decodes on demand;
ensure each sentence contains only one idea and reference the symbols
Event::HistorySync, Box<wa::HistorySync>, InitialBootstrap,
Box<LazyHistorySync>, and LazyHistorySync.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1994c6c0-1a45-4b0f-998d-25edbfde4e05
📒 Files selected for processing (2)
changelog/2026-06-11-history-sync-compressed-streaming.mdxconcepts/events.mdx
There was a problem hiding this comment.
1 issue found across 2 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…ond-person changelog
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
…ond-person changelog
The `!is_from_me` arm came first and matched group messages from others before the `is_group` arm could fire. Reorder so the more specific `is_group` branch runs first. https://claude.ai/code/session_01KwjzmWFn9LCCeHdY5DYkvA
Updates documentation for the breaking API changes introduced in oxidezap/whatsapp-rust#853.
Changes
concepts/events.mdxLazyHistorySyncsection rewritten:raw_bytes: Bytes→compressed: Bytes+decompressed_size: usizeraw_bytes()method removed; replaced withcompressed_bytes(),decompressed_size(),decompress(),stream()get()semantics updated: compressed payload is no longer consumed — all accessors remain available after callingget()<Warning>about ~2× memory removed; replaced with<Tip>recommendingspawn_blockingfor large blobsdecompress()examples, removedraw_bytes()exampleNew
HistorySyncStreamsection added (afterLazyHistorySync):next_conversation_bytes(),next_conversation(),skipped_conversations(),remainder()MAX_DECOMPRESSEDconstantHistorySyncError::UnreadConversationserror variantchangelog/2026-06-11-history-sync-compressed-streaming.mdx(new)New changelog entry covering:
HistorySyncMsg.message,WebMessageInfo.message)References
Generated by Claude Code
Summary by cubic
Docs updated for compressed history sync storage with a new streaming reader, plus a changelog and concise migration notes for the breaking API. Also fixes a shadowed match guard in the event-filtering example. Aligns with oxidezap/whatsapp-rust#853.
New Features
LazyHistorySyncdocs for zlib-compressed storage; addedcompressed_bytes(),decompressed_size(),decompress(),stream();get()is non-consuming; cloning is a refcount bump.HistorySyncStreamdocs withnext_conversation_bytes(),next_conversation(),remainder(),skipped_conversations(), andMAX_DECOMPRESSED; documentsHistorySyncError::UnreadConversations.api/botand architecture docs: events retain compressed bytes (O(compressed) queue cost); recommend.stream()for incremental, memory-bounded processing.RawNodeusage: requireclient.set_raw_node_forwarding(true)and includeEventKind::RawNodein handlerinterest(); dispatch is skipped when disabled.Bug Fixes
is_groupbranch runs before!is_from_me.Written for commit 5ca8705. Summary will update on new commits.
Summary by CodeRabbit
New Features
Documentation