Skip to content

feat(app): say why Connect found no device - #26625

Merged
kodjima33 merged 5 commits into
mainfrom
kodjima33/connect-scan-regression
Nov 28, 2026
Merged

kodjima33 merged 5 commits into
mainfrom
kodjima33/connect-scan-regression

Conversation

@kodjima33

@kodjima33 kodjima33 commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

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

kodjima33 and others added 2 commits November 28, 2026 12:53
Device Scan Empty only says the list stayed empty. Nik's 1.0.602 Forget then
re-pair test hit it three times with no way to tell a scan that never ran from
a radio that heard nothing or a pendant that stopped advertising.

A companion Device Scan Empty Diagnosis event reports discovery_runs (scans
finished since Connect opened) and peripherals_seen (named BLE peripherals the
last native scan heard before the supported-device filter).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kodjima33
kodjima33 requested a review from mdmohsin7 as a code owner November 28, 2026 17:56
kodjima33 and others added 3 commits November 28, 2026 13:03
Review: a blocked or failed scan still counted as a discovery run, and an
earlier scan's peripheral count could leak into a later diagnosis. The native
discoverer now records a per-scan outcome (not_started, unfinished, blocked,
failed, completed) and counts peripherals only for a completed scan started
after Connect armed the timer. startScan is awaited so a native rejection
reports failed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review: Connect can open while a discovery is in flight; the sequence mark was
taken after that scan started, so its result was reported as not_started.
The window mark now records whether a scan is in flight and attributes it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review: peripherals_seen counted only named peripherals, so a radio hearing
only anonymous advertisements looked silent. Count distinct peripheral ids
before the name filter; device eligibility is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kodjima33
kodjima33 merged commit 705dd2f into main Nov 28, 2026
55 checks passed
@kodjima33
kodjima33 deleted the kodjima33/connect-scan-regression branch November 28, 2026 18:53
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