Repository navigation
fix(ble): read the 5/MG GET_DATA_RANGE newest-page clock field-exact (experimental, untested on a strap) - #2824
Open
LeonardSEO wants to merge 1 commit into
Open
LeonardSEO wants to merge 1 commit into
LeonardSEO wants to merge 1 commit into
Conversation
…t to sync on Apple The clock of the last-written page sits at body offset 57 (cmdOff + 60), confirmed on 589 real replies in LeonardSEO/wearable5.0 FINDINGS §3, with 0 and 0xFFFFFFFF as sentinels. Both platforms read it directly for 5/MG; Apple now feeds it to sync as Android already does. Golden vectors from wearable5.0. Not tested on a strap. Refs ryanbr#1992
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.
Experimental: not tested on a strap. This changes what the Apple 5/MG sync path trusts, so I do not expect it to be merged without a strap log confirming it.
What this PR does
The 5/MG GET_DATA_RANGE SUCCESS body carries the last-written page's clock at body offset 57 (
cmdOff + 60, frame byte 70), with 0 and 0xFFFFFFFF as "no clock".DataRange.pageClockNewestUnix(from:cmdOff:)(Swift + Kotlin twin) reads that field directly. Golden vectors pin a normal reply, the sentinel and a short frame on both platforms.feedsSync: true, so the newest timestamp feedsstrapNewestTsand the backfill window, which Android already does today from the scan. The 4.0-only GET_CLOCK correlation (Values not computing until a week later #1598) is unaffected.Source: the field and its confirmation come from LeonardSEO/wearable5.0 (FINDINGS §3), checked on 589 complete SUCCESS replies from 21 public capture sessions (NOOP issue attachments, Asherlc/dofek, tanarchytan/whoop-rs): the u32 at @57 is a plausible Unix time in all 589, and when the backlog is 0 it equals the trim-side clock in 286 of 286. The test vectors are wearable5.0's synthetic golden vectors, built to that layout.
Type of change
How it was tested
DataRangeTests/DataRangeScanTest: wearable5.0's golden vectors (normal reply, 0xFFFFFFFF sentinel, short frame), andpagesBehindon the same frames.swift testinPackages/WhoopProtocol: 817 tests pass (1 skipped, as onmain)../gradlew testFullDebugUnitTest: 6689 tests, all pass apart from the 2RecoveryDriversTesthalf-tie cases that fail the same way on unmodifiedmain.Tools/i18n_audit.py --ci,Tools/doc_comment_lint.py,docs/protocol-exampleschecks andTools/parity_ledger.py --refresh-derived(derived snapshots included): pass.Toolsunit tests, the parity acceptance suite and the R-R contract: pass apart from the 4test_check_source_referencescases (/varvs/private/vartemp path on macOS) that fail the same way on unmodifiedmain.Strand) builds with this change on my development branch;StrandTestsand the iOS target were not run locally for this branch.app-build.ymlcovers both.Not tested on hardware. The decode is checked against captures, not against a live 5/MG run of this build. What would confirm it: a 5/MG strap log on Apple showing
Strap newest banked record: …matching the last night, and auto-continue/"Pending sync" behaving as on Android.Checklist
android/(apart from the 2RecoveryDriversTesthalf-tie cases that fail the same way on unmodifiedmain)StrandDesign/Palette/Metricstokensdocs/CONTRIBUTING.mdStrand.xcodeproj/) or any secrets/keystoresRelated issues
Refs #1992
🤖 Generated with Claude Code