Fix RwFit initialization, history sync, and manual readings - #138
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix RwFit rings pairing without importing data or completing manual readings. Align the native Swift integration with the vendor's published SDK: preserve response payloads, verify initialization and capabilities, decode live readings correctly, and page history using confirmed responses instead of treating timeouts as success.
History is durably saved before consumption, with a recoverable journal for sleep sessions spanning pages. Individual stream failures report partial sync without blocking other supported streams. Add actionable sync errors, accurate freshness, complete opt-in packet capture, and regression coverage. No vendor SDK binary is bundled.
Related issues
Related to #135 (vendor SDK references). Addresses reported SR16 and SY01 sync failures; compatibility with these models still requires hardware validation.
Type of change
Behavior change: successful modern history sync consumes transferred records from the ring. RwFit may therefore be unable to import those records afterward. Local imports and sleep-page staging must succeed before consumption; ambiguous delete timeouts are not retried.
How was this tested?
PulseLoopTests)⌘Uin Xcode)-seedDemo YES, no hardware)Ran the CLI equivalent with
xcodebuild teston the PulseLoop scheme using iPhone 16 Pro / iOS 18.6: 1,146 tests passed, zero failures. Coverage includes framing and fragmentation, authenticated readiness, manual-command ordering, history paging, partial outcomes, persistence rollback, sleep recovery, and transport timeouts. SwiftLint passed with warning-level findings;git diff --checkpassed.Simulator results do not verify BLE behavior on actual SR16 or SY01 hardware. Both require initial sync, HR/SpO₂ readings, reconnect, interrupted-transfer testing, and an opt-in packet export.
Privacy & data
Raw diagnostic packets remain opt-in in release builds. Sleep transfer pages are stored locally in a bounded, protected, per-device journal, retained for recovery until imported, and removed when app data is cleared. Test fixtures are synthetic; the user's diagnostic export is not committed.
Screenshots / recordings
Not captured. UI changes add a sync-failure message with Retry and use an indeterminate RwFit measurement indicator while command-start timing is variable.
Checklist