Skip to content

docs: document inline phash checks and ack-worker memory fields (whatsapp-rust#1116) - #441

Merged
jlucaso1 merged 2 commits into
mainfrom
claude/nifty-bohr-3dnb82
Jul 26, 2026
Merged

docs: document inline phash checks and ack-worker memory fields (whatsapp-rust#1116)#441
jlucaso1 merged 2 commits into
mainfrom
claude/nifty-bohr-3dnb82

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Documents the user-visible effects of whatsapp-rust#1116, which removed four per-message tasks/buffers from the send/receive round trip. Two of its five changes touch documented behavior:

  • Phash validation mechanism. The 10-second-timeout background task (spawn_phash_validation awaiting a oneshot ack waiter registered via register_ack_waiter) is gone. The client now registers a PhashWaiter map entry (register_phash_waiter); the read loop compares the ack's phash inline with no task, and only mismatches spawn a task. Waiters whose ack never arrives are no longer bound by a fixed 10s timeout — they're swept on the keepalive tick, giving a window of one keepalive tick (15–30s).
  • New MemoryReport fields. transport_ack_queue and delivery_receipt_queue (usize) are now reported, since deferred transport acks and delivery receipts are now served by persistent workers instead of one spawned task per ack/receipt.

The other three changes in #1116 (message-ID generation, message-secret drain worker, ResponseWaiterMap internals) are implementation details not previously documented, so no update was needed there.

Changes

  • advanced/signal-protocol.mdx: rewrote the "How it works" steps and the trailing <Note> in the "Phash validation for stale device list detection" section.
  • api/client.mdx: added transport_ack_queue and delivery_receipt_queue rows to the MemoryReport fields table.

Test plan

  • Verified the new wording matches the diff in whatsapp-rust#1116 (src/client/node_io.rs, src/client/messaging.rs, src/keepalive.rs, src/client.rs)
  • Confirmed no other doc page references the removed spawn_phash_validation/register_ack_waiter names
  • Not applicable: no build/test tooling invoked for this docs-only change

Generated by Claude Code


Summary by cubic

Update docs for whatsapp-rust#1116: phash validation now runs inline via a PhashWaiter map (no per-message task; only mismatches spawn a task), and waiters are swept on the keepalive tick with a ~15–60s TTL (they survive the first sweep and are removed on the next).
Also adds transport_ack_queue and delivery_receipt_queue to MemoryReport for the persistent ack/receipt workers. Updated advanced/signal-protocol.mdx and api/client.mdx.

Written for commit fa0d479. Summary will update on new commits.

…sapp-rust#1116)

whatsapp-rust#1116 replaced the per-message spawned task/oneshot/timer for
phash validation with a map entry the read loop checks inline, swept on
the keepalive tick instead of a fixed 10s timeout, and added
transport_ack_queue/delivery_receipt_queue to MemoryReport now that
deferred acks and receipts are served by persistent workers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01131pxhKHtLoWBY4jaAUeJ2
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jlucaso1, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0ee750ae-19a1-44d0-b70b-01b16fc7dd13

📥 Commits

Reviewing files that changed from the base of the PR and between 978f148 and fa0d479.

📒 Files selected for processing (2)
  • advanced/signal-protocol.mdx
  • api/client.mdx

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mintlify

mintlify Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
whatsapp-rust 🟢 Ready View Preview Jul 26, 2026, 2:46 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

Updates documentation to match the revised phash-validation and acknowledgement-worker behavior.

  • Explains inline phash comparison, mismatch handling, and the corrected approximately 15–60-second waiter cleanup window.
  • Adds the transport-ack and delivery-receipt worker queues to the MemoryReport field reference.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
advanced/signal-protocol.mdx Documents task-free phash waiter registration, inline acknowledgement validation, mismatch-triggered cache invalidation, and the corrected waiter sweep lifetime.
api/client.mdx Documents the two new MemoryReport queue-depth fields for persistent acknowledgement and receipt workers.

Reviews (2): Last reviewed commit: "docs: correct phash waiter sweep-window ..." | Re-trigger Greptile

Comment thread advanced/signal-protocol.mdx Outdated
A waiter always survives the sweep immediately after registration and is
removed on the one after that, so the real time-to-live is one to two
15-30s keepalive intervals (~15-60s), not a flat 15-30s window as
previously stated. Verified against ResponseWaiterMap::drop_expired_phash
in whatsapp-rust#1116.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01131pxhKHtLoWBY4jaAUeJ2
@jlucaso1
jlucaso1 merged commit 3a95ae4 into main Jul 26, 2026
4 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62912a6a16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread advanced/signal-protocol.mdx Outdated

<Note>
The phash validation runs asynchronously in the background and does not block the send path. If the server ack times out (after 10 seconds) or the oneshot channel is dropped, the validation is silently skipped. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.
The phash check never blocks the send path. If the server's ack never arrives, nothing polls the waiter directly — it is swept out on the keepalive tick, which drops any phash waiter that has lived through a full sweep since it registered (a window of one keepalive tick, 15–30 seconds, rather than the old fixed 10-second timeout). The sweep runs before keepalive's own idle early-return, so a connection with steady inbound traffic — which skips sending pings — still gets its stale waiters cleared; a stranded waiter would otherwise read as an outstanding IQ and suppress pings for the life of the connection. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Split the keepalive note into concise sentences

The revised note combines waiter cleanup timing, sweep ordering, ping suppression, and WhatsApp Web parity into several long compound sentences. Split these concepts into shorter sentences so readers can distinguish the cleanup behavior from its rationale, as required by the repository's documentation style.

AGENTS.md reference: AGENTS.md:L24-L25

Useful? React with 👍 / 👎.

3. The message stanza is sent to the server
4. A background task (`spawn_phash_validation`) awaits the server's ack (with a 10-second timeout)
5. The server's ack includes its own `phash` — if it differs from the local value, the client invalidates caches
4. When the server's ack for that message ID arrives, the read loop compares its `phash` attribute against the expected value inline, with no task involved

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the new implementation files to the location reference

This step now says the comparison runs in the read loop, but the section's unchanged Location line still names only src/send.rs and src/client.rs. The commit itself identifies src/client/node_io.rs and src/keepalive.rs as the files implementing the inline check and waiter sweep, so readers following the documented source locations will miss the behavior described here.

Useful? React with 👍 / 👎.

Comment thread advanced/signal-protocol.mdx Outdated

<Note>
The phash validation runs asynchronously in the background and does not block the send path. If the server ack times out (after 10 seconds) or the oneshot channel is dropped, the validation is silently skipped. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.
The phash check never blocks the send path. If the server's ack never arrives, nothing polls the waiter directly — it is swept out on the keepalive tick, which drops any phash waiter that has lived through a full sweep since it registered (a window of one keepalive tick, 15–30 seconds, rather than the old fixed 10-second timeout). The sweep runs before keepalive's own idle early-return, so a connection with steady inbound traffic — which skips sending pings — still gets its stale waiters cleared; a stranded waiter would otherwise read as an outstanding IQ and suppress pings for the life of the connection. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct the waiter lifetime range

A waiter can be registered at any point during an already-running 15–30-second keepalive interval, so the time until the next tick is not itself bounded to 15–30 seconds and may be nearly zero. If the waiter must survive one complete sweep interval before removal, cleanup instead occurs on a later tick and can span portions of two intervals. Replace the stated 15–30-second lifetime with the actual bounds or describe the sweep semantics without claiming this range.

Useful? React with 👍 / 👎.

Comment thread advanced/signal-protocol.mdx Outdated

<Note>
The phash validation runs asynchronously in the background and does not block the send path. If the server ack times out (after 10 seconds) or the oneshot channel is dropped, the validation is silently skipped. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.
The phash check never blocks the send path. If the server's ack never arrives, nothing polls the waiter directly — it is swept out on the keepalive tick, which drops any phash waiter that has lived through a full sweep since it registered (a window of one keepalive tick, 15–30 seconds, rather than the old fixed 10-second timeout). The sweep runs before keepalive's own idle early-return, so a connection with steady inbound traffic — which skips sending pings — still gets its stale waiters cleared; a stranded waiter would otherwise read as an outstanding IQ and suppress pings for the life of the connection. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove phash validation from the timeout usage list

This change says phash waiters are no longer polled through a fixed timeout, but api/wacore.mdx line 202 still lists phash validation as an internal user of the runtime-agnostic timeout helper. That cross-reference now documents the removed implementation and should be updated together with this section.

Useful? React with 👍 / 👎.

Comment thread advanced/signal-protocol.mdx Outdated

<Note>
The phash validation runs asynchronously in the background and does not block the send path. If the server ack times out (after 10 seconds) or the oneshot channel is dropped, the validation is silently skipped. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.
The phash check never blocks the send path. If the server's ack never arrives, nothing polls the waiter directly — it is swept out on the keepalive tick, which drops any phash waiter that has lived through a full sweep since it registered (a window of one keepalive tick, 15–30 seconds, rather than the old fixed 10-second timeout). The sweep runs before keepalive's own idle early-return, so a connection with steady inbound traffic — which skips sending pings — still gets its stale waiters cleared; a stranded waiter would otherwise read as an outstanding IQ and suppress pings for the life of the connection. This matches WhatsApp Web's approach of using phash as a best-effort staleness detector rather than a hard requirement.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the waiter sweep to the keepalive ordering

The new text says the phash sweep runs before keepalive's idle early-return, while advanced/websocket-handling.mdx lines 1077–1082 still claim to list the loop's checks in order and put the recent-activity early-return first. Update that ordered description to include the sweep before step 1; otherwise the two pages give conflicting control-flow documentation.

Useful? React with 👍 / 👎.

@mintlify

mintlify Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
whatsapp-rust 🟡 Building Jul 26, 2026, 2:45 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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