Files
swiftcontrol/test/bluetooth
Jonas Bark 63505a23ba fix(trainer): twin subtitle names its own path; a path switch refuses out loud
Review follow-ups on the twin-trainer rule.

The idle twin's subtitle named the live sibling's transport, so a row with a
WiFi badge read "Same trainer over Bluetooth — connecting switches to this
path": badge and sentence contradicted each other, and "this path" read as
the opposite of what a tap does. It now names the entry's own transport.

A path switch whose released sibling never reported idle within the bound
was only refused by accident: connectDevice still ran _connect, and the
refusal came from ProxyDevice.connect()'s auto-connect gate — silently, with
the picker's consent and mode already persisted and the radio snapping back
to "No connection". _releaseTwin now returns whether the sibling went idle,
polling the whole held-state predicate (isConnectedOrConnecting) rather than
isStarting alone — BaseDevice.disconnect() clears isConnected a microtask
after BluetoothDevice.disconnect() returns, so that ordering is now waited
on explicitly. When it did not, connectDevice skips _connect and raises a
warning alert (trainerTwinStillConnecting). Consent and the saved mode are
deliberately left as the picker wrote them: consent is the one shared key
under which the sibling still holds the trainer, and the saved mode is just
the rider's latest pick for whichever entry connects next.

Also: the same-device note now derives from one ProxyDevice predicate
(sameDeviceFoldsBluetooth) instead of a proxy-mode sentinel fallback, the
savedRetrofitMode docstring no longer promises the Bluetooth choice comes
back on its own, and the twinReleaseTimeout seam is used by the tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-16 18:39:26 +02:00
..