Skip to content

HealthKit Sleep Export Data Truncation and Timestamp Misalignment #225

Description

@ramishroshan

What happened?

OpenStrap Edge writes invalid sleep stage payloads to Apple Health. The core analytics compute the correct sleep duration and stages locally, but the data exported to Apple Health fails to match the local database, resulting in truncated durations and incorrect timestamps.
Expected Result
Apple Health synchronization must identically mirror local app data. A sleep session recorded as 7h 17m (01:06 to 08:42) in OpenStrap Edge must write a contiguous 7h 17m block to Apple Health, preserving all discrete stage transitions (Awake, REM, Light/Core, Deep).
Actual Result
The Apple Health export writes a fragmented, inaccurate record.
Reference ⁠image_2.png⁠ (Local App Data): Validates a sleep session from 01:06 to 08:42. Total time asleep is calculated as 7h 17m.
Reference ⁠image.png⁠ (Apple Health Data): Receives only 1h 56m of total sleep time. Timestamps are offset and fragmented, writing REM and Awake stages prior to 11:00 PM (before the actual sleep start time) and recording isolated Deep sleep instances near 01:00 and 03:00.

Steps to reproduce

  1. Record a full sleep session using OpenStrap Edge on iOS.
  2. Allow local analytics to process the session.
  3. Verify the local sleep duration and stages within the OpenStrap Edge UI.
  4. Open Apple Health > Browse > Sleep > Show More Sleep Data.
  5. Observe the discrepancy in total duration, stage mapping, and timestamps between the two interfaces.

App version

0.9.25

Platform

iOS (TestFlight)

Phone model and OS version

14 pro max iOS 27 db4

Which band?

WHOOP 4.0

Screenshots

Image Image

Quick checks

  • The official WHOOP app is not also connected to this band
  • I've searched existing issues for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions