Repository navigation
smart wake: late-window protection can actually veto - #826
Conversation
|
Sorry @abdulsaheel, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 40 minutes by commenting |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Reviewer's GuideImplementationMove the late-window veto margin above the arousal threshold and pass the configured threshold into the protection check so marginal calls can be held back.
TestsUpdate the existing late-window expectation and add coverage for default and extended protection windows, including clear calls that should still buzz.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
@coderabbitai full review |
Action performed
|
User description
the late-window deep-sleep protection only vetoed when hr was within 2 bpm of baseline, but the arousal gate right after it already rejects anything under baseline + 4, so it never blocked a single buzz and the 5/10 min windows did nothing.
now the 2 bpm margin sits on top of the arousal bar: in the last few minutes a call that only just clears the bar is held back and the band's own alarm fires at window end. clear calls still buzz. updated the old test that pinned the broken behaviour and added one for the default profile + workout-day 10 min zone.
Summary by Sourcery
Make late-window deep-sleep protection veto marginal buzzes while preserving clear arousal alerts.
Bug Fixes:
Enhancements:
Tests:
PR Type
Bug fix, Tests
Description
Fix late-window deep-sleep protection so it can actually veto marginal buzzes
Protection threshold now sits 2 bpm above the arousal bar, not 2 bpm above bare baseline
arousalBpmparameter added tolateWindowProtectionActiveand wired from callerUpdated existing test expectation and added new tests for default and workout-day profiles
Diagram Walkthrough
File Walkthrough
smart_wake.dart
Anchor late-window veto above arousal bar, not bare baselinelib/state/smart_wake.dart
arousalBpmparameter (default 0.0) tolateWindowProtectionActivecurrentHr - baselineHr <= 2.0tocurrentHr- baselineHr <= arousalBpm + 2.0likelyLightSleepnow passesprofile.hrArousalBpmintolateWindowProtectionActivesmart_wake_v2_test.dart
Update and extend late-window protection teststest/smart_wake_v2_test.dart
isTruetoisFalsefor a +5 bpmmarginal call in the late window
'vetoes a marginal buzz under the default arousal bar'covering mid-window pass, late-window veto, clear-call pass, and
workout-day 10-min zone
Summary by CodeRabbit