repin analytics + protocol to main, kAlgoVersion 53 - #175
Conversation
The sleep-stager rewrite (analytics#34) and the protocol RR-bound fix (protocol#21) were both on their respective mains but not reaching users, because edge was still pinned behind. Analytics was two hops back — sitting on analytics#32's PR-BRANCH head even though #32 merged two days ago. analytics cbbe06a -> f0d1153 (main @ #34) protocol 5bb8606 -> 7edcb3e (main @ #21) analytics#34 replaces the deep/REM boolean conjunctions with weighted robust-z scores. The old deep rule AND-ed one informative axis with one null one (rmssd, d -0.13) and one INVERTED one (mean HR, d +0.31 — deep sleep runs slightly FASTER than light on the wrist), so all three only co-fired by luck. That's what produced 30-second deep specks the 3-min bout rule then deleted. Against 99 PSG-labelled wrist nights: kappa 0.036 -> 0.128 (0.132 held out), deep 10.3/5.7 -> 53.0/12.9 sens/PPV, REM 30.6/12.1 -> 52.6/20.7. protocol#21 bounds realtimeRr to the same 200-2500ms range parseRealtimeHr and parseR24 already use, so a misaligned 0x28 frame can't hand a 5ms "beat" to live HRV. The other half of that commit (historical-family activity/steps_inc null instead of 0) isn't read by edge. kAlgoVersion 52 -> 53: every day's hypnogram, stage minutes and sleep-derived scalars change, so every day re-derives. Verified both SHAs actually contain what this claims, per the v43 lesson: git show f0d1153:lib/src/onehz/sleep/cardio_stager.dart | grep classifyCardioEpochs git show 7edcb3e:lib/src/live.dart | grep kMinRrMs Reproduced CI locally rather than trusting the path overrides: moved pubspec_overrides.yaml aside, pub get, confirmed lock resolved-ref matches both pins, ran check_sibling_pins.sh (both agree), then analyze + full suite against the REAL pinned packages. 1088 tests, analyze clean. Lock diff is the four ref lines only — no path: sources.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR repins ChangesAnalytics and protocol updates
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
The sleep-stager rewrite and the protocol RR-bound fix were both merged to their mains but weren't reaching users, because edge was pinned behind. Analytics was two hops back — still sitting on analytics#32's PR-branch head even though #32 merged two days ago.
what this actually ships
analytics#34 — deep/REM go from boolean conjunctions to weighted robust-z scores. The old deep rule AND-ed one informative axis with one null one (
rmssd, d -0.13) and one inverted one (mean HR, d +0.31 — deep sleep runs slightly faster than light on the wrist), so all three could only co-fire by luck. That's what produced 30-second deep specks the 3-min bout rule then deleted.Against 99 PSG-labelled wrist nights:
Base rates are 4.5% Deep and 14% REM, so the old rules were at or below chance on both.
protocol#21 — bounds
realtimeRrto the same 200-2500ms rangeparseRealtimeHrandparseR24already enforce, so a misaligned 0x28 frame can't hand a 5ms "beat" to live HRV/coherence. The other half of that commit (historical-familyactivity/steps_incnull instead of 0) isn't read by edge.kAlgoVersion 52 -> 53 — every day's hypnogram, stage minutes and sleep-derived scalars change, so every day re-derives.
verification
Per the v43 lesson (a changelog citing a change the pinned SHA never contained), confirmed both SHAs actually contain what this claims:
And reproduced CI locally rather than trusting the path overrides — moved
pubspec_overrides.yamlaside,pub get, confirmedresolved-refmatches both pins, rancheck_sibling_pins.sh(both agree), then analyze + full suite against the real pinned packages.1088 tests, analyze clean. Lock diff is the four ref lines only, no
path:sources.🤖 Generated with Claude Code
PR Type
Enhancement, Bug fix
Description
Bump
kAlgoVersion52 → 53; all days re-derive with new sleep stagingRepin
openstrap_analyticstof0d1153(main @ fix(ci): release build fails on committed path dependency_overrides #34): deep/REM boolean rules replaced with weighted robust-z scoresRepin
openstrap_protocolto7edcb3e(main @ History View #21):realtimeRrnow bounded 200–2500 ms, blocking implausible live HRV beatsBoth SHAs verified to contain the cited changes (per v43 lesson)
Diagram Walkthrough
File Walkthrough
derivation_engine.dart
Bump kAlgoVersion to 53 with sleep-stager changeloglib/compute/derivation_engine.dart
kAlgoVersionfrom 52 to 53(weighted robust-z replacing boolean conjunctions) and the protocol
realtimeRrbound fixjustifying the full re-derive
pubspec.yaml
Repin both sibling packages to current main SHAspubspec.yaml
openstrap_protocolpin from5bb8606to7edcb3e(main @ History View #21),picking up
realtimeRrRR-bound and activity/steps_inc null fixopenstrap_analyticspin fromcbbe06a(PR-branch head) tof0d1153(main @ fix(ci): release build fails on committed path dependency_overrides #34), picking up both the HR-onset workout fix (feat(sleep): manual entry + HR-led fallback; fix(wear) + v25 features #32)and the sleep-stager rewrite (fix(ci): release build fails on committed path dependency_overrides #34)
SHAs