The suppression that lets a controller power down was permanent, and the
controller's post-disconnect advertisement left a stale scan-dedup entry
that blocked every later advertisement from reaching addDevices — a woken
controller could not reconnect until an app restart. A cooldown timer now
lifts the suppression and purges the stale entry, so waking the controller
reconnects it automatically.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The inactivity disconnector parks idle controllers with
disconnect(forget: true, persistForget: false) so they stay off the
ignore list and the user can reconnect. But controllers auto-connect
unconditionally at the addDevices() choke point, so the controller
reconnected the instant it was rediscovered (scan result /
getSystemDevices / the disconnect listener's performScanning) — right
after being parked, defeating the battery saver.
Track parked controllers in a session-scoped _suppressedAutoReconnect
set, populated before each inactivity disconnect and filtered at the
addDevices() choke point. Clear it only on explicit intent — the alert's
Reconnect action and connectDevice() — and wholesale in disconnectAll().
Clearing on every successful _connect raced: a connect still in flight
when the timeout fires resolved afterwards and wiped the fresh
suppression, so the controller looped straight back.
disconnectAll() clears the set (BT off / full reset makes it moot), and
the integration harness reset routes through it so a parked controller
can't leak into the next test and block its connect.
Tests: a parked controller is not auto-reconnected on rediscovery, and
the Reconnect action lifts the suppression and brings it back.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add test/integration with platform fakes installed at the plugin seams
(UniversalBle.setInstance, NsdPlatformInterface.instance); everything
above them — Connection, device classification, protocol parsers, press
state machine, keymaps, ProxyDevice — is the real code:
- controller_connection_test: scan→classification (Zwift Click/Ride via
manufacturer data, Di2 via service UUID, FTMS trainer→ProxyDevice,
ignored names/devices), connect lifecycle (device-info reads, battery,
RideOn handshake, subscriptions), drops, dedupe, forget list.
- controller_button_chain_test: byte-accurate BLE notifications through
the full reaction chain — single/double/long press, trigger remapping,
duplicate-frame dedupe, unmapped-button error surfacing, multi-button
Ride presses.
- virtual_shifting_connection_logic_test: retrofit-mode defaults (WiFi /
BT-wins / proxy for power meters), auto-connect consent gating,
in-place "No connection" disconnect + in-place reconnect, WiFi trainer
discovery rules (found/lost/connected-survives-flap, self-exclusion),
and an end-to-end Click-press → real action pipeline → gear shift.
Protocol-level coverage (DirCon over real TCP, BLE peripheral) lives in
the prop submodule's own tests — no prop internals in this repo.
Bug fix found by these tests: Connection.disconnect(keepInList: true)
was defeated — UniversalBle.disconnect resolves only after the platform
disconnect event, so the still-attached connectionStream listener
re-entered disconnect() without keepInList and dropped the device,
orphaning the object the open details page holds (the exact bug
0db8cf0c addressed). Guarded via _inPlaceDisconnects.
Also update stale tests to current behavior: sim-mode shifts return
Ignored since e0e4494d (handled by the bridge, not forwarded, logged
neutrally), ControllerButton.initials direction arrows, and skip the
third BC2 state-machine test consistently with its siblings.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>