Skip to content

Fix OpenAPS pill and forecast lines disappearing on missing rate field#3

Open
sergev-art wants to merge 1 commit intomasterfrom
fix/openaps-missing-rate
Open

Fix OpenAPS pill and forecast lines disappearing on missing rate field#3
sergev-art wants to merge 1 commit intomasterfrom
fix/openaps-missing-rate

Conversation

@sergev-art
Copy link
Copy Markdown
Owner

Summary

Fixes an intermittent bug where the OpenAPS status pill stops updating and forecast lines vanish from the dashboard. Root cause: lastEnacted objects from certain OpenAPS configurations do not include a rate field, causing an unhandled reference error that crashes the plugin.

  • Production code change: 1 line in lib/plugins/openaps.js — null-safe access to lastEnacted.rate
  • Test coverage: New test file with real-world edge case data fixtures (2 JSON files capturing actual device status payloads)

Upstream: nightscout#8324

Design Control Impact

Modified Requirements

  • OpenAPS plugin specification (SS-level): The plugin shall handle missing or undefined fields in lastEnacted device status objects without crashing
  • Display continuity (SR-level): Forecast lines and status pills shall continue rendering when individual data fields are absent

New Test Cases

  • openaps.missingPill.test.js: Verifies plugin renders correctly with lastEnacted missing rate field
  • Test fixtures: missingRateOnLastEnacted.json, statusWithWorkingForecast.json

Risk Items

  • Patient safety (HIGH): Disappearing forecast lines and stale OpenAPS status could lead a patient or caregiver to make incorrect treatment decisions based on missing information
  • Silent failure: No error displayed to user — the pill and forecast simply stop updating, which may not be immediately noticed
  • Data source variability: Different OpenAPS/AAPS versions produce different device status payloads — the plugin must be resilient to schema variations

Files Changed (4)

File Change Lines
lib/plugins/openaps.js Null-safe access to lastEnacted.rate +1/-1
tests/openaps.missingPill.test.js New edge case test +63/-0
tests/data/missingRateOnLastEnacted.json Real-world test fixture +117/-0
tests/data/statusWithWorkingForecast.json Real-world test fixture +121/-0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant