invalidate() cleared the cached status but did nothing about a probe already in
flight. That probe then completed and wrote its answer back — the answer from
before whatever prompted the invalidation.
The case that matters is the one invalidate() exists for: the user is told
Local Network is off, taps through to System Settings, grants it and comes back.
If a probe was in flight when they left, its stale "denied" lands afterwards and
becomes the cached truth, so the app still claims the permission is off.
Tag each probe with a generation, bump it in invalidate(), and only write the
cache when the generation is still current. Whoever is awaiting the stale probe
still gets its result — it just doesn't become the shared answer. invalidate()
also drops _inFlight now, so the next caller starts a fresh probe instead of
being handed the pre-invalidation one.
Found while chasing an intermittent test failure. That turned out to be an
unrelated ambient issue (a MissingPluginException on the app_links EventChannel
that attaches to whichever test is in flight, which already fails ten other
files), but the race it exposed here was real.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Denial of Apple's Local Network privacy permission is the most common cause of
"BikeControl can't see my trainer app" on iOS and macOS, and it fails
completely silently: Bonjour browses return nothing forever, advertisements
never leave the device, nothing throws. An app watching only for errors cannot
tell "permission is off" from "there is nothing out there".
Apple ships no authorization-status API for it (not iOS 14...26, not macOS
15...26), so the new local_network_permission plugin measures it: an NWListener
and an NWBrowser on _bikecontrol-preflight._tcp, then
browser discovers the listener -> granted
kDNSServiceErr_PolicyDenied (-65570) -> denied
neither, before the deadline -> unknown
unknown is a real outcome, not an error — a device with no usable network never
completes the round trip even when the permission is fine — so everything fails
open on it and only a positive denial blocks the user.
The probe *is* the request: the system prompt fires on the first Bonjour
operation, so there is no separate request step, and after the user answers,
System Settings is the only way back.
- LocalNetworkAccess caches the result (probes cost a real round trip while
getStatus() runs on every tile mount, tap and resume) and collapses
concurrent probes into one, since two listeners on the same service type
would resolve each other.
- LocalNetworkRequirement gates the three LAN tiles: MyWhoosh Link, Zwift mDNS
and OpenBikeControl mDNS. Suppressed in screenshot/demo mode like the rest.
- Diagnostics drop the old guess (inferred from whether a discovery scan
returned anything, which could not tell denied from an empty LAN) for the
measured local-network=granted|denied|unknown.
- _bikecontrol-preflight._tcp added to NSBonjourServices on both platforms;
without it the browse fails for a reason unrelated to the permission.
The Xcode project deployment-target bumps (ios 13.0->15.0, macos 10.15->12.0)
are Flutter's own migration aligning project defaults with the Podfiles; they
happen on any first build.
Verified with real builds on both platforms, not just analysis: flutter build
macos --debug and flutter build ios --no-codesign both succeed, the framework
is linked in, and the preflight service type is present in both built
Info.plists. 35 tests cover the mapping, cache, concurrency and fail-open
behaviour.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three ways the engine could strand a rider. The headroom loop spun forever
on a small gear range (maxGear is configurable down to 1) or against a
trainer that refuses to shift, so it now stops when the gear stops moving
and is capped either way. The power-target-less skip path returned before
the phase's finally, so a rider's manual ERG survived into the sweep —
pinning plateau 1 flat — and was then silently dropped by the first
shift; the check moved inside the try, and both ERG helpers now key off
the trainer's actual mode rather than only our own writes. Restores are
individually guarded: a refused gear write can no longer cost the rider
their ERG session, a refused ERG write no longer downgrades a scored run
to aborted, and run() resolves with a result whatever the harness does.
Also: a mid-test upstream dropout now aborts instead of misreporting
NO_CONTROL — prop's notifiers latch their last value, so a dead link used
to read as a trainer that ignores us.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Restoring a rider's manual ERG target right after the staircase pinned
power flat for the whole shift sweep, so every transition read "no
change" and a healthy trainer verdicted ERG_OK_VS_FAIL. The staircase now
always exits ERG before the sweep, and the rider's own ERG session is put
back at the very end — still gated on the dirty flag, so a run that never
commanded a target (noData, early abort) writes nothing at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Baseline → ERG staircase → shift sweep on a 500 ms tick, with a cadence
pause watchdog and restore-always semantics: the gear goes back to where
the rider left it and our own ERG writes are undone on pass, fail, cancel
and exception alike. Eight scenarios drive it on a virtual clock through
a fake harness, so no test waits on wall time.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A rider's diagnostics (iOS 26.6, 6.4.3) carried this four times inside a
minute, with "virtual shifting isn't working" attached:
PlatformException(LIVE_ACTIVITY_ERROR, can't launch live activity,
Maximum number of activities for target already exists)
That is ActivityKit's `targetMaximumExceeded`. On iOS the Live Activity IS
the gear overlay — the only place a rider can read BikeControl's virtual
gear, because trainer apps never show it — so once it fires the readout is
dead until the phone reboots.
show() minted a fresh random activity name and called createActivity every
time, and the id it got back lived only in this isolate's memory. Every
force-quit, engine restart or swiped-away activity therefore left an
activity behind that still held one of ActivityKit's per-target slots, and
nothing ever went looking for it. After enough rides the target is full and
every request throws.
- Query what iOS actually holds, adopt the one activity that is still
live (updateActivity writes under its own attributes prefix, so an
activity from a previous launch picks up fresh gear data), and end
everything else before requesting anything.
- Collapse overlapping show() calls onto one in-flight future, so a
trainer app flapping its connection can't queue up requests.
- Retry once after sweeping everything when the request still throws:
`Activity.activities` reads empty for a beat after a cold start, which
the plugin works around the same way in createOrUpdateActivity.
- Ask for removeWhenAppIsKilled so a graceful termination frees the slot.
- Use a stable activity name, which also stops each ride from leaking a
new set of never-collected App Group UserDefaults keys.
- A show() that starts nothing now reports isShowing == false, instead of
leaving the Overlay switch and the auto-show guard claiming an overlay
the rider cannot see.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A user on iOS reported "MyWhoosh sees BikeControl but won't pair". Their
bundle looked healthy end to end: the advertisement was on the right
interface, our own mDNS record came back on the discovery scan, local
network permission was fine, both TCP servers were listening. The only
trace of the actual cause was a "(virtual)" suffix on one of three
interface rows: utun4/10.2.0.2. Turning the VPN off fixed it.
That asymmetry is the norm, not a fluke. mDNS is multicast and is not
carried into the tunnel, so discovery keeps working; the unicast TCP
connection that follows is the part a full-tunnel VPN swallows. Every
other line in the block therefore reads green.
Give it a line of its own, prefixed "VPN", so support sees it at a
glance instead of decoding scores. Only interfaces that carry a routable
IPv4 count -- Apple platforms always keep several idle utun devices
around for Private Relay / Continuity / Wi-Fi Calling, and those have no
IPv4 at all, so they never reach the candidate list. Names are matched
case-insensitively and partly as substrings because Dart reports the
adapter FriendlyName on Windows ("NordLynx", "ProtonVPN TUN"), where
prefix matching would miss nearly every VPN. Mesh VPNs handing out
100.64/10 are named but marked usually harmless: they route their own
overlay and leave the LAN path alone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Riders without a Google, Apple, GitHub or Facebook account can now sign in
with their email address: Supabase mails a six-digit code and EmailLoginForm
redeems it via verifyOTP.
Deliberately code-only rather than a clickable magic link — a link has to
travel back through bikecontrol://, which is unreliable on Windows and Linux,
and corporate mail scanners routinely open (and thereby burn) one-shot links
before the rider ever sees the message. A typed code behaves the same on every
platform, including web.
The Supabase side is the send-auth-email hook in the website repo, which
renders the branded BikeControl mail through Resend.
Also folds the pop/onBack block that was duplicated across all four OAuth
handlers into _afterSignIn(), which adds the mounted guard those calls were
missing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
SupportComposer._submit caught the send failure to restore the text and
the staged attachment, then rethrew. The send button drops the returned
Future, so that rethrow escaped into the zone as an unhandled error and
was reported as "App crashed".
- _submit is terminal now, and the button invokes it via unawaited() so
no Future is silently dropped. The page-level rethrows stay: they are
how the composer learns it must restore.
- The page-level send catches forward through recordError
('support.chat.send') — this path had no crash reporting at all.
- Interim client mitigation for image-only messages: substitute a
localized placeholder body when the body is empty but an attachment is
present, since the send-support-message edge function still rejects an
empty body.
- A failed send no longer orphans the uploaded blob: the successful
upload is retained against the staged attachment the composer restores,
so a retry re-uses it instead of uploading a second copy (there is no
client-side delete for the attachment bucket).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three things a rider asked for, all on the same idea: an offer's button should
do the thing, and nothing should be labelled optional that is plainly working.
- "Enable overlay" now enables the overlay and *then* opens the Overlay
section. A button that only navigates to another switch is the toast
problem again, one tap further along. The enable path moved into a shared
enableTrainerOverlay(), run by both the section's switch and the step, so
the two cannot drift; it persists the flag only when the platform actually
put something on screen, so declining Android's draw-over prompt can't
leave a setting claiming an invisible overlay. A refusal says why, and the
page opens anyway — that is where the permission tile lives.
- New optional step on the app card: "Add keyboard and mouse actions",
offered when Local is available on this device but switched off (target is
This device, per CoreLogic.showLocalControl) and an app is chosen. Local is
not a way to reach the app, it is a way to do more to it — keystrokes and
clicks the button editor only offers once it is on — and a rider who never
turns it on never learns those actions exist. Its button runs the existing
enableLocalControl(), permission sheet and all.
- The card header drops its OPTIONAL tag once the link is off "off". The
link stays optional underneath, which is what keeps a trainer nobody owns
from blocking "Ready to ride", but the word is there to reassure someone
looking at an empty slot — not to caption connected hardware.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Riders keep writing in about the wrong gear number in MyWhoosh and others.
The answer has always been the gear overlay, and the one-time toast that said
so was the wrong messenger: it fired once, mid-connect, and scrolled away
before anyone read it.
Move the offer onto the trainer card, where it stays until it is acted on.
- New SetupStepId.trainerGearOverlay, last in the trainer checklist and
offered only once the bridge is up, the trainer app runs on this device
(Target.thisDevice), the platform can draw an overlay, and a Virtual
Shifting session is producing a gear to draw. Ticks off — and leaves the
card — as soon as the overlay is enabled.
- Its button reads "Enable overlay" and deep-links to the trainer detail
page's Overlay section, which owns the permission and PiP flows.
- SetupStep gains an `optional` flag so an offer stays an offer: it does not
colour the card, does not count towards the banner's steps, and never
stops "Ready to ride". Marked OPTIONAL on its own line, via the tag the
card header already wore (now a shared OptionalTag).
- Drops OverlayConnectHint, its ProxyDevice listener and the
overlay_connect_hint_shown flag. The two l10n strings it owned are reused
as the step's hint and button label in all six locales.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Nearly every MyWhoosh/Rouvy bridge rider pairs the virtual trainer, then
writes support asking why the gear shown in the trainer app doesn't sync
— trainer apps can't display BikeControl's virtual gears. Surface the
canonical answer (the gear overlay) exactly once, at the moment the
question would otherwise arise: the first time a trainer app connects to
the virtual trainer while the overlay is off.
- OverlayConnectHint fires an AlertNotification (toast + activity-log
entry) whose button deep-links to the trainer detail page, scrolled to
the Overlay section (new revealOverlaySection param).
- Hooked on ProxyDevice's device-level isConnected wrapper so it
survives emulator/mode swaps; gated on an active VS session
(fitnessBike != null), overlay disabled, and a persisted one-time
flag (overlay_connect_hint_shown).
- New l10n strings in all six locales.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Extracts AppTitle's private update logic into lib/services/app_update.dart
(Shorebird patch first, then the platform store) so the title bar and the
wizard share one definition of 'an update is available' and one way to
apply it. The wizard shows it on the mobile welcome screen, or on desktop's
step 1 where there is no welcome screen — never twice.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
It was added while chasing the network discovery problem and is not useful
now that the cause is fixed.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Renders "×N" on folded entries so a continuous poller reads as one line that
fired N times rather than silently occupying one slot. Single occurrences stay
unmarked.
Picks up the prop-side fold + the 40 -> 200 ceiling, after a field capture
filled the whole buffer in eight seconds and lost the window that mattered.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PanTG9kRBi4QTQ2psvpTxP
Adds the "mDNS queries received" section to the diagnostics report, listing
each query the responder saw with its source, the QU bit and whether the reply
went out unicast, multicast, both or not at all.
This is the missing half of diagnosing "the trainer app on this machine can't
find BikeControl". A same-host querier appears with the advertised address as
its source, so the report now distinguishes three very different situations:
the app never queried us at all, it queried for the service (PTR/SRV — the
browse step), or it queried for our hostname (A — the resolve step). Empty on
iOS, where the OS responder handles queries and never reports them to us.
Picks up the prop-side fix for the Windows shared-port QU delivery problem.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PanTG9kRBi4QTQ2psvpTxP
ERG (review findings on the ±5W change):
- New ErgPowerStepping extension is the single home for the 5W step and
500W manual cap, replacing 7 inline copies (physical buttons, hero-card
buttons/slider, three overlay controllers).
- Boundaries are guards, not clamps: up at >=500W is a no-op like the
disabled UI button (a 600W FTMS target is no longer slashed to 500),
down from >500W steps relative, and an unknown baseline (hub-commanded
ERG reports no target) is a no-op with a new localized message instead
of slamming the trainer to ~150W.
- ERG shift-up Success carries the button again so +5W presses show
activity feedback (missed conversion from 843f7985).
SRAM gesture:
- Same-lever repeats inside the 90ms combo window coalesce as duplicates:
a finger can't re-press in 90ms, but iOS re-delivers a colliding read
response of the 0xFF edge through the notify callback — it must not
actuate twice (nor break a combo when it misdecodes to the other lever).
- The §7 multishift guard only runs while shifting is enabled — the one
state where a held paddle actually bursts (per c94b87f0's --observe
capture). Bonded rapid tapping and both-lever combos are never
throttled. Timer-driven instead of DateTime.now() (deterministic under
fakeAsync) and cleared by _resetGesture on (re)connect.
- The "set up SRAM control" warning fires once per connection, not on
every undecoded press.
Harness:
- EmulationSession.notify drops notifications for removed peripherals so
delayed notifies (SRAM double-tap) can't land after teardown.
- The 0xFF press edge is SramAxsConstants.triggerEdge at all call sites;
the emulation test waits on the named TRIGGER_UUID constant.
- New coverage: guard behavior through processCharacteristic in both
states, burst suppression while unbonded, all-taps-delivered once
bonded, ERG boundary/game-set-target cases.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- The floating overlay's drag handle now fills the full 24px trailing slot
instead of only the 14px icon.
- iOS overlay: arm PiP only while still showing and tear it down if a hide
lands mid-start(), so a show/hide race can't orphan a frozen PiP window.
- Detect Dynamic Island via the max safe-area inset instead of the top inset,
which collapsed in landscape and could auto-start an unwanted PiP.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Ignore toggles during the transient starting/stopping states (in-flight
guard) so a double-press can't double-start or stop-during-start.
- macOS: reset the recorder handle when start() throws, so one failure no
longer permanently blocks recording (only stop() nilled it before).
- iOS: remove the broadcast picker view after triggering so a 1x1 view doesn't
accumulate on the key window on every start.
- Report failures via recordError (was debugPrintStack, which vanishes in
release builds). Adds an in-flight-toggle guard test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
With the virtual front derailleur on, the compact gear readout switches
from rear gear/total (14/25) to head-unit-style front×rear position
notation (small ring 1×N, large ring 2×N, e.g. 2×14) — matching how
Garmin/Wahoo display Di2/AXS gearing. With it off, it stays 14/25.
- Add tested formatGearReadout helper.
- Wire into the proxy card, debug menu, desktop second window + Android
PiP/overlay (trainer_overlay_view), and the gear hero card (2× · 50T).
- Carry frontShiftEnabled + frontRingLarge through TrainerOverlayState
(json, ==, hashCode, activity map) so the snapshot reaches the overlay
and the iOS surfaces.
- iOS PiP + Live Activity: format 2×N centrally in GearSnapshot.
- Standardize the off-state readout to 14/25 across all surfaces.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- New "Floating window (Picture-in-Picture)" overlay setting (iOS 16+). Default
follows the per-device auto behavior (on for iPad / non-DI iPhones, off for
Dynamic-Island iPhones); DI-iPhone users can opt in. The Live Activity keeps
running alongside it (additive).
- iPad: start PiP immediately on activation (foreground) instead of only when
backgrounded — there's screen room (DeviceCapabilities.prefersForegroundPip +
scheduleForegroundStart poll).
- DeviceCapabilities.isPipCapable (any iOS 16+ PiP device) + bike_control/pip_ios
"isCapable"; settings.getOverlayUsePip/setOverlayUsePip; show() resolves the
preference.
- requiresLinearPlayback = true to drop the PiP skip/scrub (next/prev) controls
(it's a live HUD; central play/pause is system chrome, harmless no-op).
- overlayUsePip + overlayUsePipSubtitle in all 6 languages; changelog updated.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
handleServices builds both ProxyBikeDefinition and
FitnessBikeDefinition up front and attaches to the right emulator
based on retrofit mode. ProxyDevice provides advertisementName +
mdnsTxt to ftmsEmulator/_proxyEmulator via the new startServer
parameters. Drops DirconEmulator state mirroring that's no longer
needed. ZwiftClickV2 no longer calls startServer (click-alone
path removed per prop strip). UI consumers route through
ProxyDevice.advertisementName and device.retrofitMode.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ftmsEmulator is now the single emulator for Virtual Shifting traffic
across all trainers and the Click V2. ProxyDevice keeps a per-instance
emulator only for proxy mode (each proxy trainer advertises its own
mDNS identity). ZwiftClickV2 attaches its def to ftmsEmulator directly.
ProxyDevice exposes its own state ValueListenables (isStartedListenable,
isConnectedListenable, retrofitMode, localAddress) that mirror the active
emulator, so UI bindings survive mode swaps. setRetrofitMode and
switchRetrofitMode live on ProxyDevice and migrate the FBD between
proxy/shared emulators.
Removes companionProvider, refreshCompanions, and the click-def
internal seeding in DirconEmulator.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
activeDefinition now returns the CompositeBleDefinition; consumers
that need the FitnessBikeDefinition specifically use the fitnessBike
convenience getter. Bumps prop submodule to pick up the composite
machinery.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a small intake form to the new-chat empty state — users pick a
problem category (trainer app / controller / smart trainer / account)
plus a follow-up, see matching public issues with optional blog/video
links, and the answers ride along with the first message as JSON for
later analysis. Translations added for de/es/fr/it/pl.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the trailing mode pill in the Dynamic Island expanded
region (which was redundant — the bottom row already shows the
SIM/ERG pill) with an `xmark.circle.fill` button.
Tapping the button:
1. Fires a new `StopRideIntent` App Intent.
2. That intent posts a Darwin notification
`de.jonasbark.swiftcontrol.overlay.action.stop`.
3. `AppDelegate.swift`'s observer forwards `action: 'stop'` over
the `bike_control/overlay_actions_ios` MethodChannel.
4. `IosOverlayController._stopRide`:
- `core.connection.disconnectAll()`
- `core.connection.stop()`
- `core.settings.setOverlayEnabled(false)` so Navigation's
auto-show doesn't immediately re-open the activity on the
next BLE reconnect.
- `hide()` ends the Live Activity.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>