Open
Conversation
- Guard LoopFollowDebugCorner descriptor, template, and placeholder branches with #if DEBUG so the diagnostic complication does not ship to end users. - Remove unused LAAppGroupSettings.setWatchSlots / watchSlots (the fixed-4-slot variant superseded by watchSelectedSlots). - Move WatchConnectivityManager.swift from the repo root into LoopFollow/LiveActivity/ next to the rest of the snapshot pipeline and drop the duplicate file header. - Serialize WatchConnectivityManager.lastWatchAckTimestamp access through a dedicated state queue. send(snapshot:) may run on any thread and WCSession delegate callbacks arrive on a background queue, so the bare TimeInterval was racy. - Assert main-thread access for WatchSessionReceiver.cacheComplication and document the invariant on cachedComplications. - Drop the no-op JSONEncoder/JSONDecoder iso8601 date strategies — GlucoseSnapshot has a custom encoder/decoder that writes/reads updatedAt as a Double, so the strategy was never consulted. - Nit: replace `if let _ = snapshot.projected` with `if snapshot.projected != nil`. - Nit: comment why SlotSelectionView excludes .delta / .projectedBG. - Remove CLAUDE.md.
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.
Addresses the pre-merge review items on #594.
Blockers
LoopFollowDebugCornerbehind#if DEBUG. The diagnostic complication (snapshotupdatedAtvs. ClockKit timeline-entry time) was listed ingetComplicationDescriptorsunconditionally, so end users would see "LoopFollow Debug" in the complication picker. The descriptor, the two template builders (graphicCornerDebugTemplate, the stale/placeholder debug branches), andComplicationID.debugCorneritself are now all wrapped in#if DEBUG.LAAppGroupSettings.setWatchSlots(_:)/watchSlots(). The fixed-4-slot variant was superseded bywatchSelectedSlotsand had no callers. Deleted along with thewatch.slotskey.File layout
WatchConnectivityManager.swiftintoLoopFollow/LiveActivity/. It previously sat at the repo root in the top-level Xcode group. The file is still compiled into the main iOS app only; the rename just puts it next to the rest of the snapshot pipeline (GlucoseSnapshotStore,LiveActivityManager,GlucoseSnapshotBuilder,LAAppGroupSettings).project.pbxprojupdated to reference the new group membership.WatchConnectivityManager.swifthad both the standard// LoopFollow / // WatchConnectivityManager.swiftheader and a second// WatchConnectivityManager.swift / // Philippe Achkar / // 2026-03-10block. Collapsed to the single standard header the rest of the codebase uses.Thread-safety
WatchConnectivityManager.lastWatchAckTimestamp.send(snapshot:)is documented as safe to call from any thread, and WCSession delegate callbacks arrive on an arbitrary background queue, so the bareTimeIntervalwas read/written without synchronization. Reads and writes now go through a dedicatedstateQueue(DispatchQueue(label: "com.loopfollow.WatchConnectivityManager.state")). Exposed as a computed property so callers don't change.WatchSessionReceiver.cacheComplication. The caller contract was only a doc comment. Now enforced withdispatchPrecondition(condition: .onQueue(.main))and the invariant is repeated oncachedComplications.Nits
JSONEncoder.dateEncodingStrategy = .iso8601/JSONDecoder.dateDecodingStrategy = .iso8601lines inGlucoseSnapshotStore,WatchConnectivityManager,WatchSessionReceiver, andLoopFollowWatchApp.decodeContextSnapshot.GlucoseSnapshothas a custom encoder/decoder that writes and readsupdatedAtas aDoubledirectly, so the strategy was never consulted.ComplicationEntryBuilder:if let _ = snapshot.projected→if snapshot.projected != nil.ContentView.SlotSelectionView: add a one-line comment explaining why.deltaand.projectedBGare filtered out of the picker (they're always shown on the glucose page).Also
CLAUDE.md.Build:
xcodebuild -workspace LoopFollow.xcworkspace -scheme LoopFollow -destination 'platform=iOS Simulator,name=iPhone 17' build→ BUILD SUCCEEDED.