You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Diagnose and skip rogue Nightscout profile records (#635)
* Diagnose and skip rogue Nightscout profile records
Profile fetch now uses /api/v1/profiles?count=1 with find[startDate][$lte]=now,
so future-dated records can no longer block the active profile. Adds a
"Run diagnostics" button in the Remote Settings Debug section that fetches
14 days of profile history and surfaces three failure modes:
- Bundle ID mismatch when Loop and Trio share a Nightscout
- Alternating device tokens from multiple installations
- Future-dated profile records left over from a wrong-clock uploader
The bouncing-tokens check compresses consecutive same-token runs and only
warns on actual token alternation, not normal token rotation.
* Widen bouncing-token check and surface shift history
Three changes to the profile diagnostics:
- Drop the 14-day find[startDate][$gte] filter. A slow A→B→A pattern
spread across months only registers as one transition inside a 14-day
window, so the bouncing-tokens check would silently miss it on servers
that honor the filter. The existing 1000-record cap now defines the
scope, which goes back as far as upload frequency allows.
- Fall back to created_at when sorting profile records, so uploaders
that omit startDate don't cluster at .distantPast and corrupt the
run-length compression.
- Include the chronological list of token shifts in the bouncing-tokens
warning. Each row shows when the shift happened and the abbreviated
from→to tokens, so users can see at a glance which devices are
competing instead of just "3 tokens involved across N records".
detail:"The current Nightscout profile was uploaded by \(mismatch.observedBundleId), but you're configured for \(mismatch.expectedDevice). When Loop and Trio share a Nightscout, they overwrite each other's profile."
detail:"A profile record has startDate \(dateTimeUtils.formattedDate(from: future.startDate)). LoopFollow ignores future-dated records, but it will still appear as the current profile in your Nightscout dashboard. Consider deleting it — it usually means a phone with the wrong system clock is uploading."
Text("Device tokens are alternating in recent profile uploads (\(bouncing.distinctCount) tokens involved across \(bouncing.recordsScanned) records). This usually means more than one app installation is uploading to the same Nightscout. Remove the app from spare or unused phones.")
574
+
.font(.footnote)
575
+
.foregroundColor(.secondary)
576
+
if !bouncing.shifts.isEmpty {
577
+
VStack(alignment:.leading, spacing:2){
578
+
ForEach(Array(bouncing.shifts.enumerated()), id: \.offset){ _, shift in
0 commit comments