Files
swiftcontrol/test/integration
Jonas Bark 6dc4136567 fix(click-v2): enabling the new unlock method lands on the right puck
Reported from a device: switching "use new unlock method" on from the
detail page connected only the LEFT puck — the one that needs unlocking
— which is the setup the switch exists to move the rider off.

Two causes, both needed fixing.

Nothing put the rider into a mode. The toggle only flipped the
representation, so with unlock-with-Zwift off and right-side-only off,
the left puck's gate let it connect while the right puck's gate — which
needs one of those two settings — kept it out. Enabling now routes
through chooseRightSideOnly(), so the toggle and the explainer leave
identical state. A rider who deliberately chose unlock-with-Zwift keeps
both sides; this only redirects the default.

And even with the mode set, the right puck could never appear. In the
legacy representation its advert IS scanned and cached, but
fromScanResult returns null for it — the advert is remembered while
resolving to no device, and the scanner then dedupes against that cache
forever. So the switch also restarts the scan, the same thing
restoreLeftSides already needed.

That meant widening what counts as a left puck. In the legacy
representation the unified ZwiftClickV2 IS the left puck, built from its
advert (the right one builds nothing), so ignoring only
ZwiftClickV2LeftSide missed the very case this bug is about.
_ignoreLeftSides now matches ZwiftClickV2 — which covers both classes
and cannot catch the right side, since that extends ZwiftRide — and
restoreLeftSides recognises both label constants, or a puck ignored as
the unified controller could never be restored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 18:02:03 +02:00
..