Commit 364c712
Don't snooze high alarm when there is no IOB (#6348)
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 two
cases that have nothing to do with IOB coverage:
- the current BG sits below the profile's high target, so neither the
high nor low branch of calc() runs (the exact scenario in #6348:
complete profile, no insulin treatments), and
- calc() bails out early (missing profile fields, missing IOB
property, or stale data), leaving bolusEstimate at its initial 0.
In both cases, with no insulin on board, a genuine high alarm is
silenced. Because the snooze is requested at URGENT level and snoozedBy()
matches by level across the group, it can also suppress other urgent
alarms (including lows) 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 covering the report scenario (BG below profile
high target), the stale-data bail-out path, and the unchanged
enough-IOB snooze.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 17283fe commit 364c712
2 files changed
Lines changed: 65 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
300 | 361 | | |
301 | 362 | | |
302 | 363 | | |
| |||
0 commit comments