Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Background ring re-syncs + fresh-data-gated coach notifications - #94

Merged
saksham2001 merged 3 commits into
mainfrom
claude/pulse-loop-background-syncs-67dfdf
Jul 23, 2026
Merged

saksham2001 merged 3 commits into
mainfrom
claude/pulse-loop-background-syncs-67dfdf

Conversation

@saksham2001

Copy link
Copy Markdown
Owner

Summary

AI coach check-ins fired in the background on stale data because the store was only refreshed at app open. This PR keeps the store fresh in the background — ColmiSyncEngine.syncHistory() is now implemented, and RingSyncCoordinator kicks a re-sync from all-day BLE data events (the wakes a suspended app actually gets) when the last completed sync is >30 min old — and gates notifications on fresh data: StaleDataPolicy defaults to .skip, and a new CoachNotificationDataTrigger fires the due slot right after a background sync completes, so check-ins become data-driven instead of time-driven-with-stale-data.

Type of change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)

How was this tested?

  • Added / updated unit tests (PulseLoopTests) — skip-on-stale default, in-flight guard, Colmi re-sync re-entry guard
  • Ran the test suite locally — 708 tests, 0 failures
  • Tested on a physical device with a real ring — pending: background transfer runtime + on-device generation within the ~30s window

Privacy & data

  • This change does not send health data off-device without explicit user action.
  • No secrets, API keys, or personal data are committed.

Checklist

  • My code follows the project's style (SwiftLint passes).
  • I ran the tests and they pass.

@saksham2001 saksham2001 linked an issue Jul 23, 2026 that may be closed by this pull request
2 tasks
@saksham2001
saksham2001 merged commit 459f7f1 into main Jul 23, 2026
2 checks passed
foureight84 added a commit to foureight84/PulseLoop that referenced this pull request Jul 25, 2026
One conflict, in RingSyncCoordinator.handle(_:). Upstream (saksham2001#94/saksham2001#95/saksham2001#73) moved the
"store and done" live-value cases out into a mirrorLiveValue(_:) helper reached
via `default:`, while this branch had added a .wearState case to the same switch.

Resolved by taking upstream's refactor and keeping only .wearState in handle():
it isn't a store-and-done mirror — it gates on family and mutates measurement
flags — so it belongs in the switch proper, ahead of the default that delegates.

780 tests pass.
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.

[Bug]: Background syncs not working

1 participant