Description
I have run into an issue where the sensor expired and didn't deliver new CGM values. The latest suggestion by determineBasal stuck around though and was never cleared because the determineBasal() function in APSManager.swift errors out early if glucose is too old. It should in that case reset the suggestion to 0 and publish to observer (I think).
If we don't do this, the Bolus calculator will happily keep using the old suggestion as setupInsulinRequired in BolusStateModel.swift doesn't care to check how recent the suggestion is. In terms in defense in depth it would probably good to always require a fresh determineBasal run in the BolusCalculator before recommending any values? Or at least it should check that the suggestion isn't older than a few minutes and no bolus has been issued since the last time it was opened. Maybe initiating a Bolus should also clear the latest suggestion?