Skip to content

docs: document Client::device_memo_stats() - #518

Merged
jlucaso1 merged 3 commits into
mainfrom
claude/nifty-bohr-7nc4yf
Aug 12, 2026
Merged

docs: document Client::device_memo_stats()#518
jlucaso1 merged 3 commits into
mainfrom
claude/nifty-bohr-7nc4yf

Conversation

@jlucaso1

@jlucaso1 jlucaso1 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

oxidezap/whatsapp-rust#1292 added a new always-on, no-feature-gate diagnostic: per-term hit/miss counters for the two device-list memos on the group-send path (group-devices memo and SKDM-targets memo), exposed as Client::device_memo_stats() -> DeviceMemoStats. DeviceMemoStats, GroupDevicesMemoStats, and SkdmTargetsMemoStats are new pub types in whatsapp_rust::client.

Documented it in api/client.mdx's "Diagnostics" section alongside stats() / memory_report() / resource_report(), with the full field tables for both stat structs, calls()/served_rate()/hit_rate()/since() semantics, and a usage example. Noted that these types aren't re-exported from the crate root, unlike the other diagnostics types in that section.

The rest of #1292 (internal instrumentation wiring in device_registry.rs/send/mod.rs, benchmark/fixture changes) has no public surface beyond device_memo_stats() itself.

Note: this PR originally also carried a fix for PlatformType::WAIL's mapping in concepts/authentication.mdx (from whatsapp-rust#1293), but #517 landed that same fix on main first — rebased this branch onto main and dropped the now-redundant commit to resolve the conflict.

Test plan

  • Confirmed device_memo_stats()/DeviceMemoStats/GroupDevicesMemoStats/SkdmTargetsMemoStats in src/client.rs and src/client/device_memo_stats.rs on main (0c76269) against the new doc section, field by field.
  • Confirmed these three types are pub in whatsapp_rust::client but absent from src/lib.rs's re-export list, unlike StatsSnapshot/MemoryReport/ResourceReport.

Ref: oxidezap/whatsapp-rust#1292

@mintlify

mintlify Bot commented Aug 12, 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 Aug 12, 2026, 4:27 AM

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

@coderabbitai

coderabbitai Bot commented Aug 12, 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: 45 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: 1335c387-da95-4880-a95e-d300c787e7d2

📥 Commits

Reviewing files that changed from the base of the PR and between 8cfeffe and 6285da0.

📒 Files selected for processing (1)
  • 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.

@jlucaso1 jlucaso1 changed the title docs: add WAIL to the OtherWebClient PlatformType mapping docs: PlatformType::WAIL mapping + Client::device_memo_stats() Aug 12, 2026

@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: 4518b82444

ℹ️ 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 api/client.mdx Outdated
pub fn device_memo_stats(&self) -> DeviceMemoStats
```

Per-term hit/miss counts for the two device-list memos the group-send path depends on — the group-devices memo and the SKDM-targets memo — cumulative since the client was built. Always on, no feature gate: recording is one indexed relaxed atomic add per resolver call, and the reporting types are dropped by LTO in a binary that never calls this method.

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 Split the diagnostics description into concise sentences

The second sentence combines feature availability, runtime instrumentation cost, and LTO behavior into one long statement. Split these into separate sentences so readers can scan each guarantee independently, as required by the repository's one-idea-per-sentence documentation rule.

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

Useful? React with 👍 / 👎.

jlucaso1 pushed a commit that referenced this pull request Aug 12, 2026
Addresses review feedback on #518: the availability/cost/LTO
guarantees were bundled into one sentence, against AGENTS.md's
one-idea-per-sentence rule.

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

Copy link
Copy Markdown
Collaborator Author

@claude solve conflicts

claude added 2 commits August 12, 2026 04:34
whatsapp-rust#1292 added a new always-on, no-feature-gate diagnostic:
per-term hit/miss counters for the group-devices and SKDM-targets
memos on the group-send path, exposed as Client::device_memo_stats()
returning DeviceMemoStats (public in whatsapp_rust::client, not
re-exported from the crate root). Documents it alongside stats() /
memory_report() / resource_report() in the API client reference's
Diagnostics section.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E4eR5JAKYPgnJFNb3rsU8a
Addresses review feedback on #518: the availability/cost/LTO
guarantees were bundled into one sentence, against AGENTS.md's
one-idea-per-sentence rule.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E4eR5JAKYPgnJFNb3rsU8a
@jlucaso1
jlucaso1 force-pushed the claude/nifty-bohr-7nc4yf branch from 538f660 to faf87a9 Compare August 12, 2026 04:34
@jlucaso1 jlucaso1 changed the title docs: PlatformType::WAIL mapping + Client::device_memo_stats() docs: document Client::device_memo_stats() Aug 12, 2026

@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: faf87a9590

ℹ️ 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 api/client.mdx
Storage, transport, and HTTP reports are supplied by the trait implementations behind `Client` — see [`DeviceStore::resource_report`](/api/store#resource_report), [`Transport::resource_report`](/api/transport#resource_report), and [`HttpClient::resource_report`](/api/http-client#resource_report). `AllocSnapshot`, `StorageResourceReport`, `TransportResourceReport`, and `HttpResourceReport` are re-exported from `wacore::stats`; all four are also re-exported from the `whatsapp_rust` crate root.
</Note>

### device_memo_stats

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 Update the diagnostics overview for this fourth surface

Adding this method leaves the Diagnostics introduction at line 2366 inaccurate: it still says there are exactly “Three on-Client surfaces” and enumerates only stats(), memory_report(), and resource_report(). Include device_memo_stats() there so the section summary remains accurate and readers using it to choose a diagnostic API can discover the new counters.

Useful? React with 👍 / 👎.

Comment thread api/client.mdx
|-------|------|-------------|
| `hits` | `u64` | Memo hit |
| `miss_absent` | `u64` | No entry — first send for this group, or an eviction |
| `miss_devices` | `u64` | The resolved device-set `Arc` differs from the memoized one — the cascade term a group-memo recompute always forces |

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 Qualify the forced miss_devices outcome

A group-memo recomputation does not always force miss_devices: when the SKDM memo has no entry, such as on the first send or after its eviction, the immediately preceding miss_absent definition says that lookup is classified as miss_absent, and there is no memoized device-set Arc to compare. Limit this claim to recomputations performed while an SKDM entry exists so readers do not misclassify normal cold-start misses.

Useful? React with 👍 / 👎.

Comment thread api/client.mdx Outdated
pub fn device_memo_stats(&self) -> DeviceMemoStats
```

Per-term hit/miss counts for the two device-list memos the group-send path depends on — the group-devices memo and the SKDM-targets memo — cumulative since the client was built. Always on, no feature gate. Recording is one indexed relaxed atomic add per resolver call. The reporting types are dropped by LTO in a binary that never calls this method.

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 Account for the supplemental not_stored increment

The one-add-per-resolver-call cost claim does not hold when a resolved target set cannot be memoized: that call records its ordinary lookup outcome and also increments the supplemental not_stored counter. The later statement that calls() excludes not_stored because it is not a lookup outcome confirms that the counter is not mutually exclusive with the per-call outcome, so document this exceptional second relaxed atomic add rather than presenting one add as unconditional.

Useful? React with 👍 / 👎.

Comment thread api/client.mdx Outdated
| `bypassed` | `u64` | Call didn't consult the memo |
| `resolve_failed` | `u64` | The device resolution this call depends on returned `Err`, so no memo term was evaluated |

`calls()` sums every field except `not_stored` (which describes the store, not a lookup outcome). `hit_rate()` returns `hits / calls()`, `resolve_failed` included in the denominator on purpose — folding failed resolutions out would let a client whose group sends are failing upstream read a healthy rate — or `None` before the first call.

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 Split the SKDM rate semantics into concise sentences

This sentence combines the calls() aggregation rule, the hit_rate() formula, the rationale for including failures, and the pre-first-call return value. Split these guarantees into separate sentences so each API behavior conveys one idea and remains easy to scan.

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

Useful? React with 👍 / 👎.

- Diagnostics intro now mentions device_memo_stats as the fourth
  always-on surface, answering a different question than the other
  three.
- The atomic-add cost note now accounts for the extra not_stored add
  a non-memoizable resolution also pays.
- The chained-memo paragraph now qualifies that a group-memo recompute
  only forces skdm_targets.miss_devices when an SKDM entry already
  exists; with none yet, that call reports miss_absent instead.
- Split the hit_rate()/calls() paragraph into one idea per sentence.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E4eR5JAKYPgnJFNb3rsU8a
@jlucaso1
jlucaso1 merged commit da22a71 into main Aug 12, 2026
3 checks passed
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