feat(app): staged mock sensor scenario harness for OG_DEMO - #8
Open
shroominic wants to merge 1 commit into
Open
Conversation
Extend the OG_DEMO demo driver into a scenario-driven mock so the whole sensor lifecycle and alert surface can be exercised in the iOS simulator without real BLE. - Add MockScenarioCatalog (mock_scenarios.dart): pure, clock-injectable mapping from MockScenario -> CgmSessionSnapshot for warmup, activeNormal, activeHigh, activeLow, rapidRise, rapidFall, expiringSoon, expired, signalLoss, disconnected, multiSensorHistory, and error. - Make DemoCgmDriver/DemoCgmSession scenario-driven with a live applyScenario() switch; default stays activeNormal so existing demo behavior is unchanged. - Select the initial scenario via --dart-define=OG_SCENARIO=<name> and switch at runtime from a new "Mock scenario" picker in the Developer settings tab. Both paths gated behind OG_DEMO; production untouched. - Tests: scenario->snapshot mapping, live scenario switching, and a widget test driving the Developer-tab picker end to end. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 23, 2026
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.
Staged mock sensor harness
A switchable scenario system so the fleet (and the founder) can test every sensor scenario in the iOS simulator without real BLE. This is the testing backbone for the sensor-lifecycle / alert features.
What's in it
Extends the existing
DemoCgmDriverinto a scenario-driven mock. A new pure, clock-injectableMockScenarioCatalogmaps eachMockScenarioto a fully-formedCgmSessionSnapshotso the dashboard renders that exact state.Scenarios:
warmup,activeNormal,activeHigh(sustained high — trips high alert),activeLow(sustained low — trips low alert),rapidRise,rapidFall,expiringSoon(hours left on the 15-day life),expired(offboarding / session stopped),signalLoss,disconnected,multiSensorHistory(previous + current sensor),error.How to switch scenarios
flutter run --dart-define=OG_DEMO=true --dart-define=OG_SCENARIO=activeHighBoth paths are gated behind
OG_DEMO; production builds are untouched (default scenario isactiveNormal, preserving the original demo behavior).Verification (iPhone 15 simulator)
flutter analyzeclean (only the one pre-existinglive_activity_payload.dartinfo from the base branch).flutter test— all 36 tests pass, including newmock_scenarios_test.dart(scenario→snapshot mapping + live switching) and a widget test driving the Developer-tab picker end to end.warmup—/tmp/og-mock-warmup.png("40 min — Warming up", empty history)activeHigh—/tmp/og-mock-activeHigh.png(234 mg/dL, history riding the high band)expired—/tmp/og-mock-expired.png("Sensor expired", readings frozen 2h ago)🤖 Generated with Claude Code