fix(dbus): dedupe docker vs generic debug logs on connect failure#274
fix(dbus): dedupe docker vs generic debug logs on connect failure#274bluetoothbot wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
=======================================
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR deduplicates DBus connection-failure debug hints by making the docker-specific and generic log messages mutually exclusive, and adds a regression test to ensure only the appropriate hint is emitted per environment.
Changes:
- Add
else:branches so only one debug hint is logged for each connect failure type in docker vs non-docker. - Add a parametrized async test covering three exception types across docker/non-docker environments.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_init.py | Adds a parametrized test asserting docker vs host logging hints don’t overlap. |
| src/bluetooth_adapters/dbus.py | Makes docker-specific vs generic debug logs mutually exclusive via else: branches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pass | ||
|
|
||
| async def connect(self): | ||
| raise exc |
| assert docker_only_marker in docker_text | ||
| assert generic_marker not in docker_text | ||
| assert generic_marker in host_text | ||
| assert docker_only_marker not in host_text |
PR Review — fix(dbus): dedupe docker vs generic debug logs on connect failureClean, surgical fix for the duplicate-log bug introduced in #232. The Checklist
SummaryClean, surgical fix for the duplicate-log bug introduced in #232. The Automated review by Kōan9a9d09a |
When `is_docker_env()` returned True, the three connect-error handlers (`FileNotFoundError`, `BrokenPipeError`, `ConnectionRefusedError`) emitted both the docker-specific hint and the generic hint, producing two near-duplicate debug lines per failure. The generic log was tacked on without an `else:` branch in Bluetooth-Devices#232. Make the two logs mutually exclusive so each environment surfaces one targeted hint. Adds a parametrized test asserting one-message-per-env across all three exception types. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rebase with requested adjustmentsBranch Changes applied
StatsActions performed
CI statusCI will be checked asynchronously. Automated by Kōan |
9a9d09a to
d3984a3
Compare
What
Make the docker-specific and generic debug hints in
_get_dbus_managed_objectsmutually exclusive instead of both firing in docker.Why
In
dbus.py, the three connect-error handlers (FileNotFoundError,BrokenPipeError,ConnectionRefusedError) gained aif is_docker_env(): _LOGGER.debug(...)branch in #232 — but the original generic_LOGGER.debug(...)was left in place without anelse:. Result: in docker, every connect failure produces two near-duplicate debug lines (one docker-flavored, one generic). Noise during triage.How
Add
else:to the three handlers so each environment surfaces exactly one targeted hint. No behavior change outside docker; pure log dedupe.Testing
Added
test_connect_failure_logs_one_message_per_env— parametrized over the three exception types, runs each twice (docker on/off) and asserts the docker hint appears only in docker, the generic hint only on the host. 54 tests pass, ruff clean, coverage unchanged at 98%.Quality Report
Changes: 2 files changed, 76 insertions(+), 10 deletions(-)
Code scan: clean
Tests: passed (1
PASSED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline