docs(appstate): correct the batched-sync iteration cap comment - #1206
Conversation
WA Web's serverSync outer loop bounds at C = 500, not 5: the y = 5 beside it never bites, because the `||` between them keeps 500 the only real limit. Exhausting it there marks the collections retryable and hands them to a backoff state machine rather than giving up. The doc comment claimed a `C=5` constant that does not exist, and pinned a bundle path that rots on every WhatsApp version bump. The rationale for our own 5 now sits at the const where the value is chosen, including why raising it alone would only buy up to 500 back-to-back IQ rounds.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request updates comments in ChangesApp-state synchronization documentation
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
| Filename | Overview |
|---|---|
| src/client/app_state.rs | Updates comments around sync_collections_batched and MAX_ITERATIONS; no runtime behavior is modified. |
Reviews (1): Last reviewed commit: "docs(appstate): correct the batched-sync..." | Re-trigger Greptile
📦 Binary size report
.text per crate
Baseline: |
What the comment claimed
sync_collections_batcheddocumented itself as matching WA Web:Both lines are wrong.
What WA Web actually does
In
WAWebSyncdServerSyncthe constants arevar y=5, C=500and the loop isThe body only runs while
i.length !== 0, so the condition collapses tol < 500.ynever bites. The effective cap is 500, and there is noC=5.Exhausting it is not a failure either: the collections are marked
ErrorRetryand handed to the finite-retry state machine, which spaces the next attempt with exponential backoff.Why this matters beyond the wrong number
Our cap of 5 is not "WA Web with a smaller number", it is a different mechanism. WA Web can afford 500 rounds because it puts backoff between them; our loop iterates with none. So raising 5 toward 500 on its own would turn a truncated sync into up to 500 back-to-back IQ rounds. The cap and the spacing have to move together, and the comment now says so at the const where the value is chosen rather than in the doc header.
The bundle path is dropped too. A hash-named file plus line numbers rots on every WhatsApp version bump; the module name does not.
Scope
Comments only, no behaviour change.
cargo fmt --all --checkandcargo clippy -p whatsapp-rust --all-targets -- -D warningsclean.