fix(glooko): use per-collection cursors and redact private logs - #56
Draft
HockeyTrafalgar wants to merge 1 commit into
Draft
Conversation
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.
Summary
Situation encountered
We diagnosed this on a Nightscout deployment that runs a current CGM source alongside the experimental Glooko connector. The connector was polling on its expected five-minute cadence, and direct comparison showed that Glooko had newer pump treatment records which were still absent from Nightscout.
The important state was that
last_known.entrieswas close to real time because glucose ingestion was healthy, whilelast_known.treatmentswas older.dataFromSesssionbuilt Glooko'slastUpdatedAtandlimitfrom the entry bookmark for every endpoint. The newer glucose timestamp therefore collapsed the pump request window even though treatment ingestion was behind, so queued basal/bolus records could be skipped on every poll.Using the treatment bookmark for pump endpoints allowed the missing backlog to be returned on the next cycle. A source-to-database comparison by stable record identifier then found no missing pump boluses. This PR generalizes that operational fix without making Glooko CGM inefficient: pump basal/bolus requests use
last_known.treatments, while CGM and graph requests retainlast_known.entries.During the same investigation, normal Docker logs were found to contain several categories of private data:
The replacement logs retain useful status, route, and collection-count information without emitting those payloads. No production credentials, identifiers, or medical values are included in this PR or its fixtures.
Regional endpoint context
The deployed 0.0.12 package also had a hard-coded EU
Hostheader that conflicted with a successfully selected non-EU API base URL. Currentmainalready derivesHostfrombaseURLand has a regional-host regression assertion, so this PR deliberately does not duplicate that fix.Tests
npm testpasses: 51 tests, 0 failures.Risk and compatibility
The existing 48-hour fallback remains unchanged when a collection has no bookmark. Authentication, conversion, and persistence behavior are unchanged; only per-endpoint cursor selection and log detail are affected.