Repository navigation
Detect Oura the same way on both platforms - #1585
Merged
Merged
Conversation
Post-merge parity fix for #1584. The Oura SpO2 candidate branch resolved "is this owner an Oura device" differently on each platform: Kotlin DeviceBrandCatalog.isOura(owner) -> device-id PREFIX Swift regDevices.first { $0.id == owner }?.brand == "Oura" -> registry BRAND string Not stylistic. The two keys can disagree, and when they do it is an analytics split: a device with an `oura-` id but no registry row, or a row whose brand text differs, was Oura on Android and not on iOS — so Android computed the ceiling@100 candidate for that night and iOS did not. A byte-identical Swift twin already existed and is what `Repository.activeDeviceIsOura` uses, with a comment saying it is there "rather than an ad-hoc 'oura' literal". Swift now uses it too. The id-prefix key is also the more robust of the two, not merely the more consistent: Repository.swift:178 records that the registry mints every non-WHOOP id as "<idPrefix>-<uuid>", so the prefix IS the brand key and is always present, while the brand compare needs a registry row to exist AND its text to match. Verified Oura ids really are minted that way — SourceCoordinator.swift:453 builds "\(ExperimentalBrand.oura.idPrefix)- \(serial)" — so this cannot silently disable the Oura path it is meant to fix. WHOOP owners are unaffected: "my-whoop" and "my-whoop-noop" fail the prefix test exactly as they failed the brand test, so they still take the v18 aux branch. Checked the sibling site while here: skinTempWornToleranceSec keys on the brand string on BOTH platforms (Swift :2363, Kotlin :77), so that pair is symmetric — a different convention from the catalog, but not a divergence. Left alone.
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.
Post-merge parity fix for #1584 (@pipiche38's #1568). Found while re-reviewing the merged state.
The divergence
The Oura SpO2 candidate branch resolved "is this owner an Oura device" differently on each platform:
Not stylistic. The two keys can disagree, and when they do it is an analytics split: a device with
an
oura-id but no registry row — or a row whose brand text differs — was Oura on Android and not oniOS, so Android computed the ceiling@100 candidate for that night and iOS did not. That is precisely
what the parity contract forbids.
A byte-identical Swift twin already existed:
Repository.activeDeviceIsOuraalready uses it, with a comment saying it is there "rather than anad-hoc 'oura' literal". Swift now uses it too.
The id-prefix key is also the safer one
Not just more consistent — more robust.
Repository.swift:178records that the registry mints everynon-WHOOP id as
"<idPrefix>-<uuid>", so the prefix IS the brand key and is always present, whilethe brand compare needs a registry row to exist and its text to match.
I verified Oura ids really are minted that way before changing anything —
SourceCoordinator.swift:453builds"\(ExperimentalBrand.oura.idPrefix)-\(serial)"→"oura-<serial>"— because if they weren't, this "fix" would have silently disabled the Oura path it exists to protect.
WHOOP owners are unaffected:
my-whoopandmy-whoop-noopfail the prefix test exactly as they failedthe brand test, so they still take the v18 aux branch.
Checked and deliberately left alone
skinTempWornToleranceSeckeys on the brand string on both platforms (Swift:2363, Kotlin:77),so that pair is symmetric — a different convention from the catalog, but not a divergence. It predates
#1568 (from #1467) and is out of scope here.
Verification
doc_comment_lint.pyclean. No strings, no schema, no behaviour change for WHOOP owners.on is still owed, and it now also exercises this resolver.