Skip to content

refactor(linux): drop redundant double-await of adapters_from_hci_future#282

Draft
bluetoothbot wants to merge 1 commit into
Bluetooth-Devices:mainfrom
bluetoothbot:koan/linux-refresh-drop-double-await
Draft

refactor(linux): drop redundant double-await of adapters_from_hci_future#282
bluetoothbot wants to merge 1 commit into
Bluetooth-Devices:mainfrom
bluetoothbot:koan/linux-refresh-drop-double-await

Conversation

@bluetoothbot

@bluetoothbot bluetoothbot commented May 27, 2026

Copy link
Copy Markdown
Contributor

What

LinuxAdapters.refresh() awaits adapters_from_hci_future twice — once implicitly via asyncio.gather(*futures) (the future is in futures), and once explicitly on the next line. Replace the second await with .result() on the already-done future.

Why

The double-await is a no-op on a completed Future (the second await returns the cached result immediately), but it muddies intent: a reader has to verify the future is in the gather list to know the explicit await is redundant. .result() is the idiomatic way to pull a sync value out of a finished Future and reads as "extract result," not "await again."

Found via the "redundant-await" survey lens — same family as #272 (dead duplicate-guard) and #276 (dead ret-check). Pure cleanup, no behavior change.

How

1-line change in systems/linux.py. The future is guaranteed done by the preceding gather(), so .result() returns synchronously without raising InvalidStateError.

Testing

  • 51 tests pass (poetry run pytest -q)
  • ruff clean
  • Coverage holds at 98%

Quality Report

Changes: 1 file changed, 1 insertion(+), 1 deletion(-)

Code scan: clean

Tests: passed (1
PASSED)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

LinuxAdapters.refresh() already awaits adapters_from_hci_future via
asyncio.gather(), so the subsequent `await adapters_from_hci_future`
is a no-op that re-suspends a completed future. Replace with
`.result()` — the idiomatic way to extract a sync result from a
done Future, signaling intent more clearly.

No behavior change; 51 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.61%. Comparing base (ece711c) to head (7f32082).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #282   +/-   ##
=======================================
  Coverage   99.61%   99.61%           
=======================================
  Files          14       14           
  Lines         522      522           
  Branches       48       48           
=======================================
  Hits          520      520           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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