fix(mobile): start HealthKit observer sync immediately - #2049
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Overall, the refactoring cleanly eliminates background timers and debouncing in favor of immediate queueing and serialized background syncs. I left one inline recommendation in 🤖 Reviewed by codereviewbot.ai - Catch bugs before your team does. |
|
Warning Review limit reached
Next review available in: 9 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
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 |
PR Summary by QodoFix iOS background HealthKit observer sync to start immediately
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
|
LGTM! The PR cleanly removes the background HealthKit sync debounce logic in favor of serialized execution ( 🤖 Reviewed by codereviewbot.ai - Catch bugs before your team does. |
Mobile PreviewScan to open on device:
To test on device:
|
|
Storybook previews for This comment updates automatically on each PR push. |
Code Review by Qodo
Context used✅ Compliance rules (platform):
176 rules✅ Skills:
fix-provider, write-tests, cloudflare 1.
|
|
🤖 Review skipped: Repository rate limit exceeded. Free accounts are limited to 2 reviews per 4 hours per repository. Upgrade to a paid plan for unlimited reviews. |
Summary
Root cause
The native 25-second observer deadline kept advancing while a background JavaScript
setTimeout(500)did not execute for about 30 seconds. Removing that timer from the correctness path starts work in the observer callback while preserving the existing serialized queue.Validation
pnpm exec vitest run --project mobile packages/mobile/lib/background-health-kit-sync.test.ts(31/31)pnpm --filter dofek-mobile typecheckgit diff --checkFixes DOFEK-MOBILE-1C
Summary by cubic
Start HealthKit observer sync immediately on native callbacks, track the active
SyncContext, and reliably release the sync guard so the queue never stalls. Prevents background deliveries from missing the 25s deadline while keeping single-flight serialization; fixes DOFEK-MOBILE-1C.background-health-kit-sync.ts(log: “queueing sync”).SyncContexttracking; only acknowledge updates and runonSyncCompletefor the current session, and clear context on teardown.try/finallyto always release the guard and acknowledge failures; tests updated for immediate start, per-update completion, and context handoff; README and production incident baseline refreshed.Written for commit 0e42a8d. Summary will update on new commits.