Skip to content

Fix RwFit initialization, history sync, and manual readings - #138

Merged
saksham2001 merged 1 commit into
mainfrom
codex/rwfit-reliability
Sep 6, 2026
Merged

Fix RwFit initialization, history sync, and manual readings#138
saksham2001 merged 1 commit into
mainfrom
codex/rwfit-reliability

Conversation

@saksham2001

Copy link
Copy Markdown
Owner

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

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 📟 New / improved wearable support (BLE driver layer)
  • 🤖 Coach / LLM change (tools, prompts, orchestration)
  • 🎨 UI / DesignSystem change
  • 🧹 Refactor / chore (no behavior change)
  • 📝 Docs only
  • ⚠️ Breaking change (existing data, settings, or APIs 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?

  • Added / updated unit tests (PulseLoopTests)
  • Ran the test suite locally (⌘U in Xcode)
  • Tested on a physical device with a real ring — model: SR16 / SY01 validation pending
  • Tested with demo data (-seedDemo YES, no hardware)
  • N/A (docs / non-code change)

Ran the CLI equivalent with xcodebuild test on 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 --check passed.

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

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

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

  • My code follows the project's style (SwiftLint passes).
  • I ran the tests and they pass.
  • I updated docs / README where relevant.
  • I read the Contributing guide.

@saksham2001
saksham2001 merged commit e16c05c into main Sep 6, 2026
4 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.

1 participant