From 58be00cb38839e34abeae96c4e31945b1a68a95b Mon Sep 17 00:00:00 2001 From: Schwifty Date: Sat, 21 Mar 2026 23:03:43 +0000 Subject: [PATCH] docs: fix misleading comment on post-auth disconnect path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comment said "treat as non-fatal" but the code calls fail() — which is correct behavior since we can't write config without a connection. Updated comment to accurately describe the fail-with-retry-prompt flow. Co-Authored-By: Claude Opus 4.6 (1M context) --- PayfritBeacon/BeaconProvisioner.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PayfritBeacon/BeaconProvisioner.swift b/PayfritBeacon/BeaconProvisioner.swift index 8b62db2..a2b1026 100644 --- a/PayfritBeacon/BeaconProvisioner.swift +++ b/PayfritBeacon/BeaconProvisioner.swift @@ -1013,12 +1013,13 @@ extension BeaconProvisioner: CBCentralManagerDelegate { } // Disconnect during device info read (post-auth, pre-write) — beacon may have - // dropped the connection during the MAC address query. This is recoverable: - // we already authenticated, so treat as success without MAC. + // dropped the connection during the MAC address query. We authenticated but + // lost connection before writing config, so this is a failure — but a known + // one with a clear retry path, not an unexplained "Unexpected disconnect". if state == .authenticating && awaitingDeviceInfoForProvisioning && dxSmartAuthenticated { - DebugLog.shared.log("BLE: Disconnect during device info read (post-auth) — proceeding without MAC, treating as non-fatal") + DebugLog.shared.log("BLE: Disconnect during device info read (post-auth) — connection lost before config write, failing with retry prompt") awaitingDeviceInfoForProvisioning = false - // Can't proceed without connection — fail gracefully with specific message + // Connection lost — can't write config without it, fail with specific message fail("Disconnected after auth during device info read — please retry", code: .disconnected) return }