Share the horizon arithmetic and harden the look-ahead tests - #2
Open
bjorkert wants to merge 1 commit into
Open
Conversation
LowBGCondition owns the horizon arithmetic: forecastPoints(forMinutes:) converts a look-ahead in minutes into a point count, and maxPredictiveMinutes is the longest look-ahead the alarm editor offers. Both alarmForecastPointCap and the editor's Predictive stepper range derive from these, keeping the formula, the cap, and the UI bound in step. trioShortForecastKeepsHorizon keeps every combined point before index 5 above the threshold, so its assertion holds only when the 25-minute look-ahead reaches the full horizon. loopSinglePointForecast pins both sides of the current-value convention: a lone high point stays silent and a lone low point fires.
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.
Follow-ups from a second review pass on loopandlearn#732. This targets the PR branch, so merging it here folds the changes into that PR.
LowBGConditionowns the horizon arithmetic:forecastPoints(forMinutes:)converts a look-ahead in minutes into a point count, andmaxPredictiveMinutesis the longest look-ahead the alarm editor offers. BothalarmForecastPointCapand the editor's Predictive stepper range derive from these, keeping the formula, the cap, and the UI bound in step.trioShortForecastKeepsHorizonkeeps every combined point before index 5 above the threshold (IOB at index 4 is 82), so its assertion holds only when the 25-minute look-ahead reaches the full horizon.loopSinglePointForecastpins both sides of the index-0-is-current-value convention: a lone high point stays silent and a lone low point fires.