Skip to content

Auto reconnect#41

Merged
itsniper merged 5 commits into
masterfrom
37-auto-reconnect
Jul 12, 2026
Merged

Auto reconnect#41
itsniper merged 5 commits into
masterfrom
37-auto-reconnect

Conversation

@itsniper

@itsniper itsniper commented Jul 12, 2026

Copy link
Copy Markdown
Member

Closes #37 -- FR-1.2: Automatic reconnection with exponential backoff

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements FR-1.2 / FR-1.3.1 by adding a two-tier auto-reconnect system (OS daemon auto-reconnect where available, plus a library-managed exponential-backoff “ladder”), exposing reconnection progress via the existing connection-state stream, and updating tests + docs + Demo UI to make reconnection behavior observable.

Changes:

  • Added ReconnectPolicy to ReliaBLEConfig and plumbed it into the process-wide BluetoothActor initialization.
  • Expanded ConnectionState with .reconnecting(source:attempt:nextRetryAt:) and introduced ReconnectSource to distinguish OS vs library retry.
  • Implemented reconnect scheduling/cancellation in BluetoothActor, added mock-driven reconnection tests, and updated DocC + Demo settings/detail UI to reflect the new behavior.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/ReliaBLETests/ReliaBLEManagerTests.swift Adds a reconnection test suite + helpers; adjusts Mock manager setup to avoid unintended reconnects in unrelated tests.
Sources/ReliaBLE/ReliaBLEManager.swift Adds connect(to:autoReconnect:) and forwards ReconnectPolicy into actor initialization.
Sources/ReliaBLE/ReliaBLEConfig.swift Introduces ReconnectPolicy and a new reconnectPolicy config field with defaults.
Sources/ReliaBLE/Models/PeripheralError.swift Updates DocC references to the new connect(to:autoReconnect:) API.
Sources/ReliaBLE/Models/Peripheral.swift Updates DocC references to the new connect(to:autoReconnect:) API.
Sources/ReliaBLE/Models/ConnectionState.swift Adds .reconnecting state + ReconnectSource for OS vs library reconnect reporting.
Sources/ReliaBLE/Documentation.docc/Topics/Concurrency.md Updates public API list to include connect(to:autoReconnect:).
Sources/ReliaBLE/Documentation.docc/GettingStarted.md Documents the two-tier reconnect model, .reconnecting semantics, and config tuning.
Sources/ReliaBLE/BluetoothActor.swift Implements reconnect intent tracking, backoff scheduling, cancellation, and test-only injection hooks.
prompt-exports/oracle-review-2026-07-05-184401-new-chat-bd21ef-3cd5.md Adds an exported review note (non-code artifact).
docs/reviews/auto-reconnect-backoff-plan-critique-2026-07-05.md Adds a critique document for the reconnect plan (non-code artifact).
docs/plans/auto-reconnect-backoff-2026-07-05.md Adds the reconnect implementation plan document (non-code artifact).
Demo/ReliaBLE Demo/ReliaBLE Demo/Settings/SettingsView.swift Adds UI controls (AppStorage-backed) for tuning reconnect policy in the Demo.
Demo/ReliaBLE Demo/ReliaBLE Demo/ReliaBLE_DemoApp.swift Loads ReconnectPolicy from UserDefaults and injects into ReliaBLEConfig.
Demo/ReliaBLE Demo/ReliaBLE Demo/Central/CentralView.swift Surfaces .reconnecting (system vs library) and shows countdown to next retry in device detail.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/ReliaBLE/BluetoothActor.swift
Comment thread Sources/ReliaBLE/BluetoothActor.swift
@itsniper itsniper merged commit 3d19332 into master Jul 12, 2026
1 check passed
@itsniper itsniper deleted the 37-auto-reconnect branch July 12, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR-1.2: Automatic reconnection with exponential backoff

2 participants