Skip to content

Persist the family the strap actually established - #2230

Open
kavemang wants to merge 1 commit into
ryanbr:mainfrom
kavemang:fix/persist-established-device-family-2068
Open

kavemang wants to merge 1 commit into
ryanbr:mainfrom
kavemang:fix/persist-established-device-family-2068

Conversation

@kavemang

Copy link
Copy Markdown

What this PR does

Persists the WHOOP family established by GATT service discovery alongside the bonded device address, instead of persisting the family still selected in the UI picker.

Scan fallback and easy-connect can establish a different family from the requested picker value. Saving those two different sources as one pair made a WHOOP 4.0 address look like a 5/MG address (or vice versa), and the incorrect pair was then fed back into direct reconnects.

The new read-only BLE accessor returns no model until the current connection has published its discovered family. Its volatile read order matches the existing battery-source guard, so a default or previous connection value is never treated as current evidence.

No BLE command, frame, handshake order, or connection transition changes.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • CI / tooling

How it was tested

  • Added EstablishedWhoopModelTest: both unestablished family values return no model, while established WHOOP 4 and WHOOP 5 map to their matching picker models.
  • Audited every bonded = true transition: each occurs after service discovery establishes the family.
  • ./gradlew assembleFullDebug
  • ./gradlew testFullDebugUnitTest — 6,121 tests, zero failures (six existing skips)
  • python3 Tools/doc_comment_lint.py
  • python3 docs/protocol-examples/validate_examples.py
  • python3 Tools/i18n_audit.py --ci upstream/main

Not tested on physical hardware. This changes only the model written to preferences after an existing bond transition; it does not change bytes sent, GATT sequencing, scanning, or reconnect behavior on the active link.

Checklist

  • Swift package tests pass for any package I touched (N/A — no Swift package changes)
  • Android unit tests pass if I touched android/
  • No new build warnings introduced
  • UI changes use only StrandDesign tokens (N/A — no UI changes)
  • No hardcoded hex frame bytes; protocol facts live in the schema / decoders
  • Follows the conventions in docs/CONTRIBUTING.md
  • I did not commit generated output (Strand.xcodeproj/) or any secrets/keystores

Related issues

Closes #2068

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.

setLastDevice records the picker's belief, not the family the link established

1 participant