Conversation
…reading CGMs deliver the live reading and then backfill the gap behind it, each as its own batch. evaluate() re-ran on the backfill, which carries a sample no newer than the one just evaluated, and re-decided the alert from it. Seen with the G7: a live reading raised an urgent low at 22:58:59 and the backfill of the same period retracted it at 22:59:00, which also stopped the in-process alarm audio one second after it started. Skip any batch whose newest sample is not newer than the last evaluated reading. Backfill still reaches the glucose store; it just cannot override an alert decision made on a newer reading.
Collaborator
Author
|
Folding this into #2520 — same fix set, one PR. |
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.
CGMs deliver the live reading and then backfill the gap behind it, each as its own
.newDatabatch, andDeviceDataManagerhands every batch toGlucoseAlertManager.evaluate(samples:). The backfill carries a sample no newer than the one just evaluated, andevaluatere-decided the alert from it.Seen with a G7 on
next-dev, from the AlertStore and DeviceLog:Retraction goes through
unscheduleAlertWithSchedulers, which also callscriticalAlertAudioPlayer.stop()— so on an un-entitled build the in-process alarm audio was cut off one second after it started, and the notification was pulled with it. The user saw a banner slide in and out and heard nothing.Fix
Skip any batch whose newest sample is not newer than the last evaluated reading. Backfill still reaches the glucose store; it just cannot override an alert decision that was made on a newer reading.
Testing
Builds clean. The sequence above is reproducible with the "next reading as urgent low" test on a G7, which is how it was found; with the guard the backfill batch is logged and ignored.