Skip to content

Fix dev build: re-declare lastBGTime local in viewUpdateNSBG#595

Merged
marionbarker merged 1 commit intodevfrom
fix_last_bg_time_scope
Apr 9, 2026
Merged

Fix dev build: re-declare lastBGTime local in viewUpdateNSBG#595
marionbarker merged 1 commit intodevfrom
fix_last_bg_time_scope

Conversation

@bjorkert
Copy link
Copy Markdown
Contributor

@bjorkert bjorkert commented Apr 9, 2026

Summary

  • Re-adds let lastBGTime = entries[latestEntryIndex].date in BGData.swift viewUpdateNSBG. Dev currently fails to compile with Cannot find 'lastBGTime' in scope.

Why this happened

Two PRs merged into dev on the same day (2026-04-09) within ~28 minutes, textually non-conflicting but semantically interfering:

Both PRs modified different regions of viewUpdateNSBG, so git's 3-way merge produced a syntactically clean file — but the surviving reference now dangles. Neither PR's CI caught it because each was built against an older base.

Impact

lastBgReadingTimeSeconds has exactly one writer (this broken line) and one reader (StorageCurrentGlucoseStateProvider.updatedAt, which drives the Live Activity / Watch complication "updated at" timestamp). Restoring the write is the minimal fix.

Restore `let lastBGTime = entries[latestEntryIndex].date` in
viewUpdateNSBG. Dev currently fails to compile with
"Cannot find 'lastBGTime' in scope" because two PRs that merged
into dev on the same day textually did not conflict but semantically
interfered:

- #537 (Live Activity) added
  `Storage.shared.lastBgReadingTimeSeconds.value = lastBGTime`
  later in the function, relying on the existing local.
- #565 (Display HIGH/LOW) removed the local declaration as part
  of an unrelated refactor; that branch was cut before #537 landed,
  so from its perspective the local was unused.

Git's 3-way merge produced a syntactically clean file but the
surviving reference now dangles. Re-adding the local is the
minimal, intent-preserving fix.
@bjorkert bjorkert requested a review from marionbarker April 9, 2026 15:50
Copy link
Copy Markdown
Collaborator

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

Approved by code review and test.

@marionbarker marionbarker merged commit d3d63b2 into dev Apr 9, 2026
@marionbarker marionbarker deleted the fix_last_bg_time_scope branch April 9, 2026 16:15
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.

2 participants