8000 fix(cbio): render the closed GS1 phase, not the driver's status text by shroominic · Pull Request #169 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content

fix(cbio): render the closed GS1 phase, not the driver's status text - #169

Closed
shroominic wants to merge 1 commit into
feature/cbio-gs1-app-livefrom
fix/cbio-progress-copy
Closed

shroominic wants to merge 1 commit into
feature/cbio-gs1-app-livefrom
fix/cbio-progress-copy

Conversation

@shroominic
Copy link
Copy Markdown
Owner

Closes #162.

Reproduction (red)

$ git worktree add ../cbio-162-repro -b repro/162-aggregate-append origin/release/v0.4.0
$ git merge --no-edit origin/feature/cbio-gs1-app-live     # no conflicts, exit 0
$ cd openhealth && flutter test test/session_sync_failure_test.dart
exit 1: 00:00 +4 -1: Some tests failed.
Expected: exactly one matching candidate
  Actual: _TextWidgetFinder:<Found 0 widgets with text "Syncing sensor history": []>
     at test/session_sync_failure_test.dart:42

Same failure reproduced on this branch alone (with the pre-fix getter restored)
so the RED is attributable to this lane, not to the aggregate.

Root cause

It is a surface regression, not a timing or metadata problem.

_ConnectionProgress renders statusText ?? phaseText. Before this lane the
connection screen passed no statusText, so a syncing session rendered the
closed stage label _connectionStageText(CgmSyncStage.syncing) =
'Syncing sensor history'.

This lane added statusText: _cbioProgressText, which returned
CgmSessionSnapshot.statusText verbatim for every cbio snapshot. The
bounded-failure guard's session publishes statusText: 'Listening for notifications', so the card rendered that instead and the contract's visible
stage label disappeared.

Two things make the new behaviour wrong beyond the guard:

  1. statusText is an internal, unbounded field. Every other driver in this
    screen renders a closed set of product strings; this was the only path that
    put a raw driver string on a user surface.
  2. The GS1 session already publishes a closed vocabulary -
    cbioPhaseMetadataKey in {connecting, authenticating, history, live,
    disconnected} - so the intent did not need the unbounded field at all.

Fix

  • cbioProgressTextForSnapshot in session_presentation.dart maps the closed
    phase to product copy and returns null for anything else.
  • The connection screen uses that, so an absent/unknown phase falls through to
    the generic stage label exactly as before this lane.
  • The contract, and the guard test that asserts it, are untouched: the
    expectation is not weakened, skipped, or reworded.

Verification

Command Result
flutter test test/session_sync_failure_test.dart on the aggregate (release/v0.4.0 + app-live + this fix) exit 0, +5: All tests passed!
flutter test on the aggregate (full openhealth unit suite) exit 0, +491: All tests passed!
flutter test in packages/cgm_cbio on the aggregate exit 0, +86: All tests passed!
flutter test test/cbio_app_surface_test.dart on this branch, pre-fix getter exit 1, same Found 0 widgets with text "Syncing sensor history"
flutter test test/cbio_app_surface_test.dart on this branch, fixed exit 0, +8: All tests passed!
flutter analyze (openhealth) No issues found

New coverage: a presentation test for the mapping, and a widget test that drives
the real connect button and asserts the bounded-sync stage label is shown while
the driver's raw text is not.

Merge note for the aggregate

The fix belongs on this lane because this lane changed the surface. The
aggregate (release/v0.4.0 + app-live) should merge this branch's tip for
ancestry; the merge is clean (no conflicts).

Merging this lane into the sensor aggregate broke
openhealth/test/session_sync_failure_test.dart, the guard for the bounded
session-sync failure contract (#133/#134): the connection screen started
passing CgmSessionSnapshot.statusText straight into the progress card for every
cbio snapshot, so a session that never decoded rendered the driver's internal
string ('Listening for notifications' in the guard) instead of the stage label
'Syncing sensor history' the contract asserts.

That is a surface regression beyond the guard: statusText is unbounded and
internal, and the screen deliberately renders a closed set of user-facing
strings for every other driver.

Map the closed phase in cbioPhaseMetadataKey (connecting, authenticating,
history, live, disconnected) to product copy instead, and fall through to the
generic stage label when the phase is absent or the snapshot is not cbio.

The guard is untouched. New coverage: a presentation test for the mapping and a
widget test that drives the real connect button and asserts the bounded-sync
stage label is shown and the driver's text is not.

Refs #162
@shroominic
Copy link
Copy Markdown
Owner Author

Carried by the GS1 consolidation in PR #209 (branch feature/cbio-gs1, head 3eca4f4).

This PR is contained in the consolidated line; the merge that carries it is c85f827.

Closing as subsumed by the consolidation - not as won't fix. The per-defect evidence stays in this thread, and the carrying commit above is where the change now lives.

@shroominic shroominic closed this Sep 18, 2026
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

0