8000 fix(cbio): finish a holed history and give the stored range a real window by shroominic · Pull Request #206 · shroominic/OpenGlucose · GitHub
[go: up one dir, main page]

Skip to content

fix(cbio): finish a holed history and give the stored range a real window - #206

Closed
shroominic wants to merge 1 commit into
feature/cbio-gs1-app-livefrom
fix/cbio-history-live-edge
Closed

shroominic wants to merge 1 commit into
feature/cbio-gs1-app-livefrom
fix/cbio-history-live-edge

Conversation

@shroominic
Copy link
Copy Markdown
Owner

Closes #195. Both halves of G5, stacked on #197 (feature/cbio-index-time-anchor) because the caption's real window comes from the anchor that PR adds. Base will move to feature/cbio-gs1-app-live once #197 lands; the stacked diff is only this PR's two files plus the docs.

Half 1 - a holed history never finished ingesting

CbioGlucoseSession._atLiveEdge returned false whenever
CbioHistoryArchive.hasGap was set, and _historySyncState.inProgress was
!atLiveEdge || _catchUpOpen. One missing position pinned a finished fetch to
"Fetching sensor history" for the rest of the session.

inProgress now answers one question: is there more of what the sensor pushed
still coming. A close on the settle (idle) timer is the counter-free evidence
that the sensor stopped offering, so that alone answers it; a deadline close
still falls back on the freshness check, which uses the anchored instant when
the session holds one (and only then the bare counter, as a freshness check,
never as a rendered clock). The hole stays visible in the positions the session
publishes and in the caption.

RED, on the base of this branch:

cd packages/cgm_cbio && flutter test test/cbio_glucose_session_test.dart
CbioGlucoseSession live edge a holed archive still finishes ingesting at the live edge [E]
  condition was not satisfied before the deadline
00:00 +20 -1: Some tests failed.

GREEN: the same capture (positions 1-3, a hole at 4, then 5 at the live edge)
reaches stage: ready with inProgress: false, and the published positions are
still 1, 2, 3, 5.

Half 2 - the range gets a real window and shows its holes

cbioStoredRangeText now takes the snapshot's anchor:

  • 3 readings stored · sensor minutes 10065–10067 · 10:03–10:05 with the
    window in the device's local zone (the test asserts it against
    DateFormat('HH:mm').format(instant.toLocal()));
  • … · 1 position not received when the stored positions span a hole;
  • without an anchor the string is byte-for-byte what it was: count and sensor
    minutes, next to the unsynced line from feat(cbio): anchor the GS1 record index to the clock the app set #197.

Verification

cd packages/cgm_cbio && flutter test     -> 92 passed, 2 skipped
cd packages/cgm_cbio && flutter analyze  -> No issues found!
cd openhealth && flutter test            -> 487 passed
cd openhealth && flutter analyze         -> No issues found!
cd openhealth && flutter analyze integration_test -> No issues found!

dart format clean on every new or touched line (the lane's pre-existing drift
hunks in main.dart and cbio_glucose_session_test.dart are unchanged - the
formatter diff against those files is identical to the base's).

Not touched

The five lane PRs still awaiting the 05785b0 rebase (#175, #177, #182, #186,
#188) - not edited, comment only. CI's known reds are unchanged and pre-existing.

Two halves of G5, both about the same question: what does the GS1 surface
actually know.

`inProgress` reported "the range is contiguous" instead of "there is more of
what the sensor pushed still coming", because `_atLiveEdge` returned false
whenever `CbioHistoryArchive.hasGap` was set. One missing position therefore
pinned a finished fetch to "Fetching sensor history" for the rest of the
session. A close on the settle (idle) timer is the counter-free evidence that
the sensor stopped offering, so it now answers that question on its own; a
deadline close still falls back on the freshness check, which uses the anchored
instant when the session holds one. The hole stays visible in the positions the
session publishes and in the caption.

The stored-history caption gains the real window and the holes: the anchor turns
the stored range into local times (`02:34–19:02`) and the range reports the
positions that never arrived (`3 positions not received`). Without an anchor the
caption is unchanged - count and sensor minutes only, next to the unsynced line.

Refs #195.

Tests: cgm_cbio 92 passed (2 skipped), openhealth 487 passed; `flutter analyze`
clean in both, including `openhealth/integration_test`.
@shroominic
shroominic force-pushed the fix/cbio-history-live-edge branch from 217aa50 to f0cb0ff Compare September 18, 2026 09:25
@shroominic
shroominic changed the base branch from feature/cbio-index-time-anchor to feature/cbio-gs1-app-live September 18, 2026 09:25
@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 50fa6c7.

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