Oura: capture Tier-B activity MET stream to a JSONL research corpus (Swift + Android) - #676
Merged
Merged
Conversation
…rpus (Swift + Android twin) Append each anchored 0x50 activity record to a diagnostic sidecar file so the raw MET series can be accumulated for offline investigation (cadence, state-byte semantics, WHOOP cross-checks). Deliberately OUTSIDE the scoring datastore: the 0x50 MET decode is Tier-B (unvalidated third-party formula), so the honest-data invariant + the ryanbr#960 pin forbid it minting a durable/scoring row. Instrumentation only — never scored, never a step count, safe to delete. - Format: JSONL (one record/line, append-only) — crash-safe, no read-modify- rewrite, loads straight into pandas/jq/DuckDB. - File: <diagnostics>/oura-activity-<deviceId>.jsonl, beside the app data; absolute path logged once per launch on the first record. - Deduped by a persistent ring-time high-water so the records the ring re-serves across reconnects are written exactly once. Standalone off main: the 0x50 activity DECODE already landed on both platforms; this adds only the corpus. Cross-platform: shipped on BOTH platforms. - Apple: OuraActivityDump (app) + the pure OuraActivityDumpLine encoder (WhoopStore), wired into the existing .activityInfo handler. - Android: the Kotlin twin - com.noop.ble.OuraActivityDump + com.noop.oura. OuraActivityDumpLine - wired into the existing OuraEvent.ActivityInfo handler, emitting a BYTE-IDENTICAL JSONL line (same key order, same `met` formatting via Double.toString, matching Swift String(_:) across the MET range) so the two corpora are interchangeable. Path/prefs are platform-native (filesDir + SharedPreferences); the LINE content is the parity-relevant part and is pinned verbatim on both sides. It is diagnostic instrumentation (never scored, never a stored analytics value), so no byte-identical *datastore* contract is at play - but the corpus line is twinned anyway. Verified: - Swift: WhoopStore swift test (OuraActivityDumpLine) 3/3; xcodebuild Strand macOS BUILD SUCCEEDED. - Android: compileFullDebugKotlin OK; testFullDebugUnitTest OuraActivityDumpLineTest 3/3 (tests=3 failures=0). - On hardware (Apple): activity (Tier-B) records + oura-activity-<id>.jsonl written. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DN6cU2ERWZUS9tWYCjPvi
ryanbr
added a commit
that referenced
this pull request
Jul 20, 2026
…680) Bounds the always-on #676 Oura sidecar with a 25 MB cap + single-.1 rotation on both platforms (~50 MB on disk max), mirroring the WHOOP5 deep-buffer log. Best-effort; no encoder/schema change. iOS size read via FileManager (fresh stat) to avoid URL resource-value caching. Verified: Android compileFullDebugKotlin + OuraActivityDumpLineTest; iOS+macOS app-build green.
ryanbr
added a commit
that referenced
this pull request
Jul 20, 2026
Marketing version stays 9.0.3; Android versionCode 296->297 and iOS CURRENT_PROJECT_VERSION 206->207 so the new staging build installs over the previous one. Content since the last testing build: Health Connect writeback failure surfacing (#672), SpO2/respiration empty-track explanation (#673), WHOOP 5/MG raw-IMU offload persist (#675), hide stale sleep recompute entries (#679), Oura activity MET research corpus + cap/rotation (#676/#680), trend chart date alignment (#528), and corrupt-DB quarantine preservation (#681).
DX23876
pushed a commit
to DX23876/noop
that referenced
this pull request
Jul 22, 2026
…yanbr#676) Append each anchored Oura 0x50 activity/MET record to a diagnostic JSONL sidecar for offline protocol RE — instrumentation only, never scored, never a datastore row (Tier-B honest-data invariant). Both platforms with a byte-pinned line encoder; append-only, crash-safe, deduped by a persisted ring-time high-water. Rebuild of ryanbr#447 off current main. Related ryanbr#960.
DX23876
pushed a commit
to DX23876/noop
that referenced
this pull request
Jul 22, 2026
…-up) (ryanbr#680) Bounds the always-on ryanbr#676 Oura sidecar with a 25 MB cap + single-.1 rotation on both platforms (~50 MB on disk max), mirroring the WHOOP5 deep-buffer log. Best-effort; no encoder/schema change. iOS size read via FileManager (fresh stat) to avoid URL resource-value caching. Verified: Android compileFullDebugKotlin + OuraActivityDumpLineTest; iOS+macOS app-build green.
DX23876
pushed a commit
to DX23876/noop
that referenced
this pull request
Jul 22, 2026
Marketing version stays 9.0.3; Android versionCode 296->297 and iOS CURRENT_PROJECT_VERSION 206->207 so the new staging build installs over the previous one. Content since the last testing build: Health Connect writeback failure surfacing (ryanbr#672), SpO2/respiration empty-track explanation (ryanbr#673), WHOOP 5/MG raw-IMU offload persist (ryanbr#675), hide stale sleep recompute entries (ryanbr#679), Oura activity MET research corpus + cap/rotation (ryanbr#676/ryanbr#680), trend chart date alignment (ryanbr#528), and corrupt-DB quarantine preservation (ryanbr#681).
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.
Summary
Appends each anchored Oura
0x50activity record to a diagnostic JSONL sidecar so the raw MET series can be accumulated for offline protocol RE (cadence, state-byte semantics, WHOOPcross-checks). Instrumentation only — never scored, never stored as analytics, safe to delete. Shipped on both platforms.
This is a clean rebuild of the earlier #447 off current
main(the0x50decode has since landed on both platforms), isolated to just the corpus.Why it's out of the scoring datastore
The
0x50MET decode is Tier-B (unvalidated third-party formula), so the honest-data invariant + the #960 pin forbid it minting a durable/scoring row. It goes to a sidecar file, not SQLite/Room.What's added (8 files)
Apple
Packages/WhoopStore/…/OuraActivityDumpLine.swift— pure JSONL line encoder (+ 3 verbatim tests).Strand/BLE/OuraActivityDump.swift— file writer: handle, path, persistent ring-time high-water dedup (UserDefaults).Strand/BLE/OuraLiveSource.swift— 12-line wiring into the existing.activityInfohandler.Android (byte-identical twin)
com/noop/oura/OuraActivityDumpLine.kt— pure encoder, same fixed key order;metviaDouble.toString(matches SwiftString(_:)across the MET range) (+ 3 JUnit tests, incl. a verbatim-lineassertion).
com/noop/ble/OuraActivityDump.kt— file writer:<filesDir>/diagnostics/…, high-water dedup viaSharedPreferences.com/noop/ble/OuraLiveSource.kt— wiring into the existingOuraEvent.ActivityInfohandler.Behaviour (both):
…/diagnostics/oura-activity-<deviceId>.jsonl, beside the app data; path logged once per launch.Cross-platform
Shipped on both. Paths/prefs are platform-native (
filesDir+SharedPreferencesvs App Support +UserDefaults); the JSONL line content is pinned verbatim on both sides, so the two corpora areinterchangeable. It's diagnostic instrumentation (never scored / never stored analytics), so there's no byte-identical datastore contract in play — the corpus line is twinned regardless.
Verification
swift testWhoopStoreOuraActivityDumpLine3/3;xcodebuild … StrandmacOS BUILD SUCCEEDED../gradlew compileFullDebugKotlinOK;testFullDebugUnitTest OuraActivityDumpLineTest3/3 (tests=3 failures=0).Oura: activity (Tier-B) …records +oura-activity-<id>.jsonlwritten (strap logs).