Skip to content

Fix Swift SpO2 capability token normalization - #1495

Open
bhelm wants to merge 1 commit into
ryanbr:mainfrom
bhelm:codex/issue95-strip-spo2-whitespace
Open

Fix Swift SpO2 capability token normalization#1495
bhelm wants to merge 1 commit into
ryanbr:mainfrom
bhelm:codex/issue95-strip-spo2-whitespace

Conversation

@bhelm

@bhelm bhelm commented Aug 20, 2026

Copy link
Copy Markdown

Summary

  • trim whitespace and newlines around Swift capability tokens before filtering
  • drop whitespace-only tokens and remove only the bare spo2 token, matching Kotlin canonicalization
  • add mirrored Swift/Kotlin coverage for canonical, whitespace-bearing, duplicate-separator, and SpO2-only stored rows

Root cause

Swift converted comma-split substrings directly to String, so restored rows such as hr, spo2,hrv retained the whitespace-bearing SpO2 token and could also lose legitimate whitespace-prefixed metrics when decoded. Kotlin already trims each token and removes empty tokens. The fix applies that same normalization on the real Swift product helper; Kotlin production is unchanged.

Validation

  • RED before fix: the unchanged Swift algorithm failed 7 of 9 whitespace/canonicalization cases
  • frozen three-file diff is an exact semantic subset of the independently reviewed product-fix union
  • Swift focused: 1 test passed
  • Swift affected WhoopStore suite: 7 tests passed
  • Swift full WhoopStore suite: 420 tests passed, 0 failures
  • Kotlin focused/affected: the mirrored regression test passed
  • Kotlin FullDebug: 4,157 tests passed, 0 failures/errors, 6 skipped
  • git diff --check: pass
  • independent static review: pass, no P0/P1/P2

Fixes bhelm#95.

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.

WhoopLiveCapabilities: Swift stripSpo2Token diverges on whitespace-bearing stored tokens

1 participant