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
Swift SleepStagerV2 clips shuffled streams before defensive sort #67
Swift SleepStagerV2.stageSession applies binary-search window clipping to the caller-provided stream order, then sorts only inside the uncached recipe. On shuffled public inputs the binary bounds discard valid rows before the defensive sort. Android sorts each stream before clipping and is order-invariant.
Affected public entry point:
SleepStagerV2.stageSession/6
Native RED/control evidence
Tested at fork commit 6df88d0d5d3398fcb4fec62c6cb3b23da3380dae with an isolated env-gated probe. The fixture supplies identical gravity/HR/RR rows in chronological order and in a deterministic even-index-then-odd-index permutation. The 90-minute requested window has 600-second input padding on each side.
Swift RED:
sorted output: 0:5400:light
shuffled output: 0:4330:light, 4330:5400:rem
The mirrored Kotlin probe is GREEN; the complete Kotlin probe class passed 4/4 with BUILD SUCCESSFUL. This confirms a platform drift rather than a fixture ambiguity.
Acceptance
Swift clips only after establishing timestamp order, or otherwise uses an order-independent safe window selection.
Sorted and deterministic shuffled forms of identical grav/HR/RR streams produce exactly equal segments.
Resolved upstream by ryanbr#1456, merged as . Swift now establishes stable timestamp order before clipping; mirrored tests cover shuffled streams and cache-isolated, order-sensitive equal-timestamp outcomes. The fork differential rollout continues under #17, but the production defect tracked here is complete.
Activity
bhelm commentedon Aug 19, 2026
Resolved upstream by ryanbr#1456, merged as . Swift now establishes stable timestamp order before clipping; mirrored tests cover shuffled streams and cache-isolated, order-sensitive equal-timestamp outcomes. The fork differential rollout continues under #17, but the production defect tracked here is complete.
bhelm commentedon Aug 19, 2026
Correction to the closing note: upstream merge SHA is 82bfd3d.