Deprecate use of config entry listener with reloading methods in config entries#169198
Deprecate use of config entry listener with reloading methods in config entries#169198MartinHjelmare merged 6 commits intodevfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a deprecation warning path to discourage using config entry update listeners together with config-entry update helpers that also schedule reloads, since that combination can cause double reloads/races.
Changes:
- Log a
report_usage(..., breaks_in_ha_version="2026.11.0")warning when_abort_if_unique_id_configured(...)updates an entry that has update listeners and will also reload. - Log a similar warning from
async_update_reload_and_abort(...)before scheduling a reload. - Add a test that verifies the warning is logged for both the
_abort_if_unique_id_configured(reauth) andasync_update_reload_and_abort(reconfigure) paths when an update listener exists.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| homeassistant/config_entries.py | Adds report_usage logging for the deprecated “update listener + reload helper” pattern. |
| tests/test_config_entries.py | Adds coverage to confirm the deprecation warning is emitted when an update listener is present. |
Co-authored-by: Copilot <copilot@github.com>
MartinHjelmare
left a comment
There was a problem hiding this comment.
There's a related test failure. Otherwise looks good.
I suggest we merge this after the beta cut so any remaining integrations have a release cycle to address this. We should also publish a dev blog. Bump the stop working month.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
I can't add inline comments at the moment (thanks GitHub). Please bump the release date when this will stop working to 2026.12.0. Ie 6 months from 2026.6.0 when this PR will be released. |
Mistake on my side, I was counting it wrongly. |
Breaking change
Proposed change
When using a config entry listener in combination with
async_update_reload_and_abortor_abort_if_unique_id_configuredthere might be a double reload of the integration, or at least a race in between.This is now deprecated and will be changed raise error in 2026.12
(only
unifistill has this from core integrations, which has a PR open to fix it)Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: