Persist the WHOOP 5/MG raw-IMU offload buffer (#423) - #675
Merged
Conversation
NOOP already decodes the strap's connect-time 1244-B deep buffer — a full 100 Hz 6-axis IMU second (Whoop5RawImu, validated on 1423 real 5.0 buffers) — but only logs a summary to JSONL; no queryable samples survive. This adds the missing persistence. Key point for #423: this needs NO arming. The live raw stream (cmd 81, the allowlist gap) is firmware-refused for full IMU, but the OFFLOAD buffer already carries accel AND gyro and NOOP already receives + decodes it — so the whole gated-probe saga is sidesteppable for the core goal. - New rawImuSample table (packed i16 LE BLOB of the 6 wire columns, PK deviceId,ts): Room MIGRATION_20_21 + GRDB v28-raw-imu, byte-identical shape/encoding so a .noopbak round-trips. Whoop5RawImu.rawColumns() keeps the offsets in one place (both platforms). - Gated on the existing raw-capture toggle (noopPuffinCapture); persists at the same deep-buffer seam that already decodes, IO/Task-dispatched off the BLE thread. Receive-side only — NO BLE command is sent anywhere. - Bounded: rolling retention to the newest ~1 h (3600 rows ≈ 4 MB) so an enabled capture can't balloon the DB during a multi-day offload replay. - Instrument-first: decode -> store -> nothing consumes it yet (no steps/ sleep gating), per the derived-signal rule. Verified: Android compileFullDebugKotlin + RawImuMigrationTest (SQL pin, version pair, i16 pack round-trip, rawColumns extraction, insert+prune) + the data test package. iOS is app-target Swift (Linux can't build) — the data layer mirrors ppgWaveformSample exactly; compiles on the app-build run. Refs #423. Author: ryanbr <mp3geek@gmail.com>
app-build caught it: StreamStore.packImuColumns is module-internal (like packPpgSamples), so the Collector in the Strand module couldn't call it. Pass the raw [Int16] columns to insertRawImu and pack inside WhoopStore — mirrors how insert() packs ppgWaveform. No stored-bytes change. Author: ryanbr <mp3geek@gmail.com>
On-device validation aid: confirm the offload IMU is arriving + decoding (and flag a store failure) from the accessible strap log, without pulling the puffin-deepbuffers.jsonl. Throttled (first buffer, then every 500) so a large offload can't flood the log; gated behind raw capture like the rest. Android only — iOS already logs every decoded IMU buffer to that JSONL. Author: ryanbr <mp3geek@gmail.com>
CI (WhoopStore swift test) caught it: rawImuSample is deviceId-keyed but was missing from the device-scoped delete set, so "delete all of this device's data" / device removal would leave the raw IMU behind — the exact delete-means-gone privacy defect that guard exists to prevent. - Swift: add rawImuSample to DeviceRegistryStore.deviceScopedTables. - Android: add DeviceRegistryDao.deleteRawImuFor + wire it into DeviceRegistry.deleteDeviceData; update the three FakeDao test doubles and the pinned expected-tables set. Verified: Android compileFullDebugKotlin + DeviceRegistryTest + RawImuMigrationTest + the data package. Swift fix re-runs on Swift Packages CI. Author: ryanbr <mp3geek@gmail.com>
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
Capture the 100 Hz 6-axis IMU the 5/MG already offloads (Whoop5RawImu) into a new gated, bounded rawImuSample table (Room MIGRATION_20_21 + GRDB v28), receive-side only — no arming. Default-off (noopPuffinCapture), rolling ~1h retention, wired into device-data deletion, with a throttled strap-log heartbeat. Instrument-first; nothing consumes it yet. Refs ryanbr#423.
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.
Refs #423. Draft — minimal, receive-side, no arming.
The finding that reframes #423
#423 is scoped around the live raw-accel stream (arm
cmd 81, which the 5/MG allowlist drops; the full IMU stream is firmware-refused). ButWhoop5RawImu's own header — validated on 1423 real 5.0 buffers — establishes that the connect-time offload burst already carries a full 100 Hz 6-axis IMU (accel + gyro, 1244-B buffer). NOOP already receives and decodes it (PuffinDeepBufferLogrunsWhoop5RawImu.decode), and just logs a summary — no arming needed, nothing persisted. This PR adds the missing persistence, which delivers #423's core goal (6-axis IMU on a 5.0) without touching the BLE-send path at all.What this does
rawImuSampletable — one row per strap-second, a packed i16 LE BLOB of the six wire columns (ax…az,gx…gz). RoomMIGRATION_20_21+ GRDBv28-raw-imu, byte-identical shape + encoding so a.noopbakround-trips.Whoop5RawImu.rawColumns()keeps the offsets in one place on both platforms.noopPuffinCapture), dispatched off the BLE thread. No BLE command is sent anywhere in this diff.What's deliberately out of scope (stays #423's strap-side work)
cmd 81/ un-silencing the 4.0 flood) — the hard-rules BLE write that needs your real 5/MG to validate. This PR makes NOOP capture the offload IMU it already receives; it does not turn any stream on.Verification
compileFullDebugKotlin✓ ·RawImuMigrationTest✓ (additive-SQL pin, 20→21 version pair, i16 pack round-trip,rawColumnscolumnar extraction + null gates, repository insert+prune) ·com.noop.data.*package ✓ppgWaveformSampleexactly (GRDB migration,StreamStorepack/insert, protocol default-no-op so test spies don't break); compile-verified on the app-build run attached to this PR. Runtime capture needs a real 5/MG (your [ble] WHOOP 5/MG raw accel/IMU: community-verified live 0x2B raw-accel stream (cmd 81) that the 5/MG allowlist never arms — gated probe + decode proposal #423 strap).Note for #423
Since the offload path already delivers 6-axis IMU arming-free, the live-stream probe may be unnecessary for the core goal — worth folding into the issue.