Fix dev build: re-declare lastBGTime local in viewUpdateNSBG#595
Merged
marionbarker merged 1 commit intodevfrom Apr 9, 2026
Merged
Fix dev build: re-declare lastBGTime local in viewUpdateNSBG#595marionbarker merged 1 commit intodevfrom
marionbarker merged 1 commit intodevfrom
Conversation
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.
marionbarker
approved these changes
Apr 9, 2026
Collaborator
marionbarker
left a comment
There was a problem hiding this comment.
Thanks for the fix.
Approved by code review and test.
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
let lastBGTime = entries[latestEntryIndex].dateinBGData.swiftviewUpdateNSBG. Dev currently fails to compile withCannot find 'lastBGTime' in scope.Why this happened
Two PRs merged into
devon the same day (2026-04-09) within ~28 minutes, textually non-conflicting but semantically interfering:Storage.shared.lastBgReadingTimeSeconds.value = lastBGTimelater in the function, relying on the existing locallet lastBGTime.let lastBGTime = entries[latestEntryIndex].datedeclaration as part of an unrelated refactor — the Display HIGH/LOW for out-of-range BG on main screen #565 branch was cut before Live activity #537 landed, so from its perspective the local was unused.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
lastBgReadingTimeSecondshas 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.