fix: live progress display + better disconnect resilience #11

Merged
schwifty merged 1 commit from schwifty/fix-progress-and-reconnect into main 2026-03-22 02:41:33 +00:00
Collaborator

What was wrong

  1. No progress shown during provisioning — the assignment sheet displayed provisioningProgress (a static @State that stayed stuck at "Provisioning beacon...") instead of provisioner.progress (which has live updates like "Connecting...", "Authenticating...", "Writing config 1/24..."). The check-config sheet already used provisioner.progress correctly — this was just missed on the provisioning side.

  2. Disconnect retries too aggressive — only 2 retries with 2s/3s backoff wasn't enough for flaky DX-Smart BLE. The beacon needs more breathing room between reconnect attempts.

  3. Write timeout timer not cancelled on disconnect — if a disconnect happened mid-write, the 5s write timeout could still fire and cause a double-failure (disconnect handler + timeout handler both trying to fail/retry).

Changes

  • Wire provisioner.progress into the assignment sheet (falls back to provisioningProgress for pre-BLE steps like "Getting beacon config...")
  • Increase disconnect retries from 2 → 3
  • Increase backoff delays from 2s/3s → 3s/4s/5s
  • Bump global timeout from 30s → 45s to accommodate extra retry
  • Cancel write timeout timer when disconnect handler fires
  • Better error message: "Beacon disconnected N times during writing. Move closer to the beacon and try again."

Test plan

  • Verify live progress messages appear during provisioning ("Connecting...", "Authenticating...", "Writing config 1/24...")
  • Verify disconnect recovery works (move beacon slightly out of range, then back)
  • Verify final error message is user-friendly if all retries fail
  • Verify check-config flow still works (was already correct)
## What was wrong 1. **No progress shown during provisioning** — the assignment sheet displayed `provisioningProgress` (a static `@State` that stayed stuck at "Provisioning beacon...") instead of `provisioner.progress` (which has live updates like "Connecting...", "Authenticating...", "Writing config 1/24..."). The check-config sheet already used `provisioner.progress` correctly — this was just missed on the provisioning side. 2. **Disconnect retries too aggressive** — only 2 retries with 2s/3s backoff wasn't enough for flaky DX-Smart BLE. The beacon needs more breathing room between reconnect attempts. 3. **Write timeout timer not cancelled on disconnect** — if a disconnect happened mid-write, the 5s write timeout could still fire and cause a double-failure (disconnect handler + timeout handler both trying to fail/retry). ## Changes - Wire `provisioner.progress` into the assignment sheet (falls back to `provisioningProgress` for pre-BLE steps like "Getting beacon config...") - Increase disconnect retries from 2 → 3 - Increase backoff delays from 2s/3s → 3s/4s/5s - Bump global timeout from 30s → 45s to accommodate extra retry - Cancel write timeout timer when disconnect handler fires - Better error message: "Beacon disconnected N times during writing. Move closer to the beacon and try again." ## Test plan - [ ] Verify live progress messages appear during provisioning ("Connecting...", "Authenticating...", "Writing config 1/24...") - [ ] Verify disconnect recovery works (move beacon slightly out of range, then back) - [ ] Verify final error message is user-friendly if all retries fail - [ ] Verify check-config flow still works (was already correct)
schwifty added 1 commit 2026-03-22 02:38:56 +00:00
- Wire provisioner.progress into assignment sheet UI (was showing static
  "Provisioning beacon..." instead of live updates like "Connecting...",
  "Authenticating...", "Writing config 1/24...")
- Increase disconnect retries from 2 to 3 with longer backoff (3s/4s/5s)
- Cancel write timeout timer on disconnect to prevent double-failure
- Bump global timeout from 30s to 45s for extra retry headroom
- Improve error message with actionable guidance ("move closer and retry")
schwifty merged commit 292821622e into main 2026-03-22 02:41:33 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: payfrit/payfrit-beacon-ios#11
No description provided.