Don't snooze high alarm when there is no IOB (#6348) - #8549
Open
IsraelAfangideh wants to merge 3 commits into
Open
Don't snooze high alarm when there is no IOB (#6348)#8549IsraelAfangideh wants to merge 3 commits into
IsraelAfangideh wants to merge 3 commits into
Conversation
The Bolus Wizard Preview plugin snoozes a high alarm when its `bolusEstimate` is below the snooze threshold, treating that as "enough insulin on board to cover the high". But `bolusEstimate` is 0 in a case that has nothing to do with IOB coverage: when the BG is above the alarm threshold (`bgTargetTop`) yet still below the profile's high target, so neither the high nor low branch of calc() runs. With no insulin on board this leaves bolusEstimate at its initial 0 and a genuine high alarm is silenced -- the scenario reported in nightscout#6348 (complete profile, no insulin treatments). Because the snooze is requested at URGENT level and snoozedBy() matches by level across the group, it can also suppress other urgent alarms for the snooze duration. Guard the snooze on `prop.iob > 0` so a high is only snoozed when there is actually insulin on board to cover it. Legitimate "enough IOB" snoozing is unchanged. Adds regression tests for the reported scenario (BG below the profile high target with no IOB) and for the unchanged enough-IOB snooze. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
IsraelAfangideh
force-pushed
the
fix/bwp-snooze-without-iob-6348
branch
from
June 29, 2026 02:02
364c712 to
2284d89
Compare
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.
Fixes #6348.
Problem
The Bolus Wizard Preview plugin snoozes a high alarm when
prop.bolusEstimate < snoozeBWP, treating a near-zero estimate as "there is enough insulin on board to cover the high". ButbolusEstimatestarts at0and stays0in a case that has nothing to do with IOB coverage:bgTargetTop) yet still below the profile high target, so neither the high nor the low branch ofcalc()runs.With no insulin on board,
bolusEstimateis then left at its initial0, and a genuine high alarm gets silenced. This matches the report in #6348: a complete profile, a default ISF, and no insulin treatments. (The exacttarget_highfrom the report is not in the issue, so this is the most likely mechanism consistent with it rather than a certainty.)Because the snooze is requested at
URGENTlevel andnotifications.snoozedBy()matches by level across the group, this can also suppress other urgent alarms for the snooze duration.Fix
Guard the snooze on
prop.iob > 0, so a high alarm is only snoozed when there is actually insulin on board to cover it:Legitimate enough-IOB snoozing is unchanged. No new dependencies.
Tests
Added to
tests/boluswizardpreview.test.js:Full suite green locally (
1346 passing).🤖 Generated with Claude Code