You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P2] Recovery HR windows document an inclusive end but drop aligned endpoint samples #39
restingHR documents and initially filters [start, end], but both it and recoveryIndexSlope use half-open five-minute bins and stop before a bin beginning at end. A sample exactly at an aligned end passes the prefilter and then belongs to no bin.
This is shared Swift/Kotlin behavior, not platform drift.
Minimal reproduction
Resting HR:
start = 0
end = 300
five samples at ts=300, bpm=60
Recovery Index:
start = 0
end = 1800
samples at ts=0,300,600,900,1200,1800
Observed behavior
On both platforms:
restingHR returns nil/null; none of the admitted endpoint samples reaches a bin.
recoveryIndexSlope returns nil/null; only five bins remain, below the six-bin gate.
Cause
The inclusive prefilter is combined with bins shaped as [t, t+300) and a loop that runs only while t < end.
Impact
An endpoint sample is silently admitted and then ignored. For Recovery Index this can change whether the minimum-bin gate is satisfied.
Acceptance criteria
Define either [start, end) everywhere or handle an inclusive final boundary.
Make documentation, prefiltering and bin membership consistent.
Add paired aligned/non-aligned endpoint tests, including the five/six-bin gate.
Preserve identical Swift/Kotlin behavior.
Synthetic timestamp fixtures are sufficient; no hardware testing is required.
Fixed upstream by ryanbr#1927 and ryanbr#1936 (both merged): 1927 closed the final
resting-HR bin on the window end in the library helpers, and 1936 did the same on the shipped SleepStager path (sessionRestingHR / sessionHrvWindows) and deleted the two unused RecoveryScorer helpers. A sample landing exactly on the window end is no longer dropped.
Closing.
Activity
Drop the fork issue number from the endpoint-binning comments
Drop the fork issue number from the endpoint-binning comments
bhelm commentedon Sep 7, 2026
Fixed upstream by ryanbr#1927 and ryanbr#1936 (both merged): 1927 closed the final
resting-HR bin on the window end in the library helpers, and 1936 did the same on the shipped
SleepStagerpath (sessionRestingHR/sessionHrvWindows) and deleted the two unusedRecoveryScorerhelpers. A sample landing exactly on the window end is no longer dropped.Closing.