[BEAR-6800]: (Time Asleep Syncing) Return sleep phases and add a configurable cut-off hour#21
Open
natbearable wants to merge 3 commits into
Open
[BEAR-6800]: (Time Asleep Syncing) Return sleep phases and add a configurable cut-off hour#21natbearable wants to merge 3 commits into
natbearable wants to merge 3 commits into
Conversation
natbearable
marked this pull request as ready for review
June 25, 2026 16:47
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.
Jira
BEAR-6800 — Update apple health package to return sleep stages
Description
The native bucketed sleep query now returns per-night sleep phases for sources that emit them — Apple Watch on iOS 16+. Each phase comes through as a raw window with its own start and end time, slotted under
entry.sleepTimes.phasesin the existing bucketed sleep response. Phases are labelledlight(Apple's Core),deep,rem, andawake, so mid-night wake-ups show up alongside the sleep stages.A new
sleepCutOffHouroption was also added toreadBucketedSleep. Samples at or past this hour roll forward into the next day's bucket, and the option defaults to 12 (noon) so daytime naps and the following night both land where you'd expect. Callers can pass any hour 0-23 to override — e.g. 19 to restore the previous 7pm rule.Why this approach: The cut-off was previously inferred from the caller's
startTimehour, which made the contract implicit and easy to get wrong on the JS side. An explicit option makes it obvious what's happening and gives the mobile app a one-line kill switch back to 7pm via remote config if 12pm causes problems. Phases are pulled at the same point where the source is picked, so we only emit phases from the source whose totals we're already using — keeping the data internally consistent with the asleep duration.Acceptance criteria
sleepCutOffHour, defaulting to 12pmScreenshots / Recordings
Screen.Recording.2026-06-25.at.17.40.38.mov
Quality
Have you done the following?
Jira
Have you done the following?
🟢-SAFE-TO-RELEASEor🔴-NOT-SAFE-TO-RELEASElabel⚠️-CAUTION-WHEN-RELEASINGlabel for higher risk changesUI
Have you made changes in the
uilayer and considered the following?Data / Domain
Have you made changes in the
dataordomainlayers and considered the following?