Repository navigation
Conversation
…h around it (W03-043) The HR-only spine (a strap that banks no motion, ryanbr#1801) anchored its sleep band on the tenth percentile of the whole read. Since W03-024 that read is 66 h and holds the next night, so a lower heart rate 16 h after a night could remove it, and a read ending 12 h after the night disagreed with the full one. Each epoch is now held to the p10 of the heart rate in a 24 h window around it (radius localBaselineRadiusS, as on the gravity path), slid inward to stay inside the data at either end. Sliding rather than cutting keeps every anchor on 24 h, the span hrOnlyBandMult was measured on: a cut window failed the field-shaped day tests, whose read ends with the night as this morning's does. The trace prints the anchor and band as lo..hi. Over the 2026-09-30 backup with gravity withheld, the spine of all 12 nights no longer depends on the read's reach (3 before), with detection about equal: 12 nights found (11), 2,578 of 7,269 minutes inside the gravity-path nights (2,639), 2 minutes outside (0).
…red night of its own (W03-052) The no-motion gate read the owner's stored sessions over the whole sleep read and skipped the HR-only night (ryanbr#1801) whenever any were there. The read runs from 30 h before the day to 12 h past it (W03-024), so a stored night of the day before or the day after (an imported WHOOP export, a ring's hypnogram) blocked a day that had none of its own, and that day scored no night at all. The gate is now IntelligenceEngine.noMotionNight: only a stored session whose end falls on the day under the pass's offset, the rule analyzeDay keeps a night by, decides it and is counted in the gate line's stored=. Its NoMotionNight raw values are the line's reason=, so the branch and the log share one name. NoMotionNightGateTests failed on the verbatim extraction of the old gate and pass on this one.
…oes (W03-043, W03-052 V2) The independent review of W03-043 and W03-052 held both fixes and flagged three doc claims. The anchor is the heart rate of the 24 h around an epoch, slid inward at the data's ends, not the heart rate within the radius, and the gravity path's baseline cuts instead. Yesterday's read reaches 12 h past the day only after local noon. The HR-only trace line is no longer the Kotlin line's byte twin, and the gate line's stored= now counts nights ending on the day. W03-053, W03-054 and W03-055 recorded.
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.
Phase 2 fix for W3's heart-rate-only sleep path, used when a strap banks no motion (ryanbr#1801): W03-043 and W03-052 (S3), the follow-up W03-024's V2 asked for. One commit per fix, plus a docs commit from the independent review. Each row in
docs/review/workstreams/W03-analytics.mdholds its V0, fix, V1 and V2.This can change stored HR-only nights on re-score. Nights detected from gravity are untouched.
The defect
analyzeDaykeeps only sessions that end on the day.The fix
SleepStager.hrOnlyLocalAnchors. Each epoch is held to the 10th percentile of the heart rate in the 24 h around it (radiuslocalBaselineRadiusS, as on the gravity path).hrOnlyBandMultwas measured on.lo..hi.IntelligenceEngine.noMotionNight. Only a stored session whose end falls on the day, under the pass's offset, decides it. That isanalyzeDay's rule, and only those sessions are counted in the gate line'sstored=.Evidence
SleepHrOnlyWindowInvarianceTestsfail onmainand pass here.NoMotionNightGateTestsfail on the verbatim extraction of the old gate and pass here.hrOnlyLocalAnchorsmatches an independent brute force on 43,944 cases with 0 mismatches. The cases cover repeated timestamps, gaps up to a day, out-of-range bpm and every window edge.analyzeDayon 3,910 cases over ten offsets from −12 h to +14 h.main:swift testin StrandAnalytics: 2,222 tests, 0 failures.xcodebuild test, schemeStrand(macOS): 2,151 tests, 0 failures, 2 skipped.Not changed
Refs ryanbr#1801