Skip to content

Connect lists only devices found in the current Bluetooth scan - #26539

Merged
kodjima33 merged 3 commits into
mainfrom
app/connect-live-devices-only
Nov 27, 2026
Merged

kodjima33 merged 3 commits into
mainfrom
app/connect-live-devices-only

Conversation

@kodjima33

@kodjima33 kodjima33 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

What

The Connect (find devices) page listed every Omi the phone had ever paired, as "Offline" rows, even when none were nearby. It now lists only devices advertising in the current Bluetooth scan. A saved device that is nearby still sorts first with its "Saved" tag.

  • OnboardingProvider.visibleDeviceList: saved devices are included only when the scan sees them.

  • onDevices now notifies listeners when the list empties, so a device that goes out of range leaves the screen instead of staying stale.

  • Removed the offline-row branch (Offline chip, "wake your device" toast) from found_devices.dart, and its now-dead test helper.

  • DeviceService.subscribe() handed subscribers its whole device list, which also holds the stored device added for background reconnect without a scan. The Connect page then showed that saved Omi as nearby. Subscribers now get only devices the last scan saw.

Saved devices are still stored and used for reconnect; only the list is filtered.

Screenshot

Simulator, 5 saved Omis seeded, none advertising: no device rows. The Bluetooth dialog is the simulator having no Bluetooth.

Connect with no nearby devices

Tests

  • flutter test test/providers/ test/widgets/onboarding_polish_test.dart: 1397 passed (updated multi-device and pairing-presentation expectations, new test for the empty-list notify).
  • flutter test test/services/: passed, incl. new test that a reconnect-only stored device is not handed to subscribers.
  • make preflight passed.

Product invariants affected

none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

kodjima33 and others added 3 commits November 27, 2026 15:04
…scan

Saved devices that are not advertising no longer appear as Offline rows.
OnboardingProvider.onDevices now notifies when the list empties so a
device that goes out of range leaves the screen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DeviceService adds the stored device to its device list when it reconnects
without a scan; subscribe() handed that list to the Connect page, which then
showed the saved Omi as nearby. Subscribers now get only scanned devices.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kodjima33
kodjima33 requested a review from mdmohsin7 as a code owner November 27, 2026 20:50
@kodjima33
kodjima33 merged commit b76d4dc into main Nov 27, 2026
56 checks passed
@kodjima33
kodjima33 deleted the app/connect-live-devices-only branch November 27, 2026 21:23
kodjima33 added a commit that referenced this pull request Nov 28, 2026
## What

`Device Scan Empty` fires when Connect still has no device after 10 s.
It doesn't say why. A companion event, `Device Scan Empty Diagnosis`,
now fires with it:

- `scan_outcome`: the latest BLE scan in the window (started after
Connect opened, or already running when it opened): `not_started`,
`unfinished`, `blocked` (adapter or permission), `failed` (native
rejected it) or `completed`.
- `peripherals_seen`: distinct BLE advertisers (by peripheral id, named
or anonymous) that completed scan heard, before any name or
supported-device filter. Always 0 unless the outcome is `completed`, so
an earlier scan's count never carries over. With `completed`, 0 means
the radio heard nothing. Above 0 means advertisers were heard but no
supported Omi.

`startScan` is now awaited so a native rejection reports `failed`.
DeviceService already catches each discoverer's errors, so the page
behaves as before.

The existing event is unchanged (its properties are immutable), so the
onboarding funnel consumer is untouched.

## Why

Nik's real-device acceptance test of #26539 on 1.0.602: Forget Device,
then Connect. Three Connect opens on builds 1647 and 1648 each fired
`Device Scan Empty`, and the page showed "No Omi Found" for over a
minute. Nik's same phone and pendant re-paired within ~20 s on build
1644 (Nov 27 20:05–20:16 UTC). Upload timing maps 1647 to `12eda380`,
before #26539, and nothing in the scan path changed between 1644 and
1647. So #26539 is probably not the cause, and the current telemetry
can't tell the remaining causes apart. This event will on the next
failure.

## Tests

- `flutter test
test/providers/onboarding_provider_pairing_presentation_test.dart
test/utils/analytics/onboarding_funnel_analytics_test.dart
test/services/` (Flutter 3.44.5): the empty-scan test asserts
`scan_outcome: not_started` and `peripherals_seen: 0`.
- New `test/unit/native_bluetooth_discoverer_scan_outcome_test.dart`
covers completed (count), unfinished, blocked and failed, including that
blocked and failed clear an earlier count, that a scan already running
when Connect opens reports its real result, that a scan finished before
Connect opened is ignored, and that anonymous advertisements count
without becoming devices. `flutter test test/unit/ test/providers/
test/services/devices/`: 5744 passed. One file,
`listen_custody_test.dart`, fails to load locally both with and without
this change, because `dev_env.g.dart` isn't generated in this worktree.
- `python3 scripts/check_event_registry.py`: generated output current,
consumer executable, PostHog delta $+0.

UI-Evidence: none -- telemetry only; the Connect page renders the same

## Failure class

Failure-Class: none

The only `fix:` commit corrects code added earlier in this PR. Nothing
shipped.

## Product invariants affected

none

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

1 participant