GeezerVison is showing github.com — feat: report whether async_update_interfaces brought every interface up by UTKARSH698 · Pull Request #1946 · python-zeroconf/python-zeroconf
Conversation
Closes #1916
Summary
async_update_interfaces returned None, so a caller could not tell that the requested interfaces were not brought up: a failed listen socket rebuild and an interface that failed to bind or re-join were only logged. A failed rebuild also stored the requested interfaces and ip_version as the retained configuration although nothing changed. This makes async_update_interfaces, update_interfaces and AsyncZeroconf.async_update_interfaces return whether every requested interface is up, and keeps the stored configuration when the reconcile did not run.
Details
AsyncEngine.async_update_interfaces now returns an InterfaceUpdateResult(applied, added, complete) instead of the added bool. added keeps driving the re-announce as before; applied is false only for the two early exits (no interfaces available, rebuild failed); complete is false when the rebuild failed, an interface was not added, or a staying interface could not re-join the rebuilt listen socket (_async_rebuild_listen_socket now returns whether all re-joined).
Zeroconf.async_update_interfaces only commits the configuration when applied, which is what the existing comment above it describes. A partial reconcile still commits, so the next rescan retries the interfaces that did not come up rather than reconciling back to the old set.
- I went with a return value rather than raising on a failed rebuild: failures stay logged and never raised, so existing adapter-change handlers keep the best-effort behaviour, and callers that ignore the result are unaffected. Happy to switch to raising for the rebuild case if you prefer that.
_core.py and _engine.py are not in TO_CYTHONIZE, so no .pxd changes.
Test plan
- New tests in
tests/test_interface_update.py for the public result: all interfaces up, an interface that fails to come up (config still stored), a failed rebuild and an empty interface set (config unchanged), and the sync update_interfaces wrapper. test_update_interfaces_rebuild_rejoin_failure_warns now also checks complete is false.
- The new and extended tests fail on
master and pass with this change. On master, a failed rebuild to IPVersion.V6Only returns None and stores V6Only while the instance is still on IPv4.
- Existing engine tests updated from the
added bool to result.added.
- Full suite on Windows, Python 3.11 (
SKIP_CYTHON=1): 508 passed. pre-commit passes (ruff, mypy, flake8, codespell, pyupgrade) and so does scripts/check_declaration_order.py.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
async_update_interfaces returned None, so a caller could not tell when
the requested configuration was not applied: a listen socket rebuild
that failed (for example IPv4 to dual-stack on a host without a usable
AF_INET6 socket) and an interface that failed to bind or re-join were
only logged. The rebuild failure also committed the requested interfaces
and ip_version as the retained configuration although nothing changed.
Return True when every requested interface is up and False otherwise,
from async_update_interfaces, update_interfaces and
AsyncZeroconf.async_update_interfaces. Keep the stored configuration
unchanged when the reconcile did not run. Failures are still logged
rather than raised, so the best-effort contract for adapter-change
handlers is unchanged.
Closes python-zeroconf#1916
|
Thanks for contributing! A quick note: this project is in the process of moving from LGPL-2.1 to Apache 2.0, and may keep LGPL-2.1-or-later as an OR option so GPL-2.0-only projects can keep using the library, see #1835.
By continuing with this pull request you agree that this new contribution is offered under both Apache 2.0 and LGPL-2.1-or-later, so it is covered under either outcome.
This notice does not affect your previous contributions. If you would like to consent to relicensing those as well, please post the consent statement on #1835; silence is never treated as consent for past work.
If offering this contribution under these licenses does not work for you, no hard feelings; reply with the exact phrase I do not agree to the Apache 2.0 license or simply close this pull request.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
codecov
Bot
commented
Nov 9, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.87%. Comparing base (7c44d72) to head (c52e18f).
⚠️ Report is 1 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1946 +/- ##
=======================================
Coverage 99.87% 99.87%
=======================================
Files 33 33
Lines 3944 3956 +12
Branches 574 575 +1
=======================================
+ Hits 3939 3951 +12
Misses 3 3
Partials 2 2
☔ View full report in Codecov by Harness.
📢 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Merging this PR will not alter performance
1 warning
⚠️ 1 benchmark is dominated by system calls
System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.
Learn more about system calls
See affected benchmarks
✅ 24 untouched benchmarks
Comparing UTKARSH698:fix/report-interface-update-outcome (c52e18f) with master (7c44d72)1
Footnotes
-
No successful run was found on master (a8ed0a8) during the generation of this report, so 7c44d72 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|