Skip to content

Deprecate use of config entry listener with reloading methods in config entries#169198

Merged
MartinHjelmare merged 6 commits intodevfrom
gj-20260426-01
May 7, 2026
Merged

Deprecate use of config entry listener with reloading methods in config entries#169198
MartinHjelmare merged 6 commits intodevfrom
gj-20260426-01

Conversation

@gjohansson-ST
Copy link
Copy Markdown
Member

@gjohansson-ST gjohansson-ST commented Apr 26, 2026

Breaking change

Proposed change

When using a config entry listener in combination with async_update_reload_and_abort or _abort_if_unique_id_configured there 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 unifi still has this from core integrations, which has a PR open to fix it)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]
  • I have followed the [perfect PR recommendations][perfect-pr]
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated for [www.home-assistant.io][docs-repository]

If the code communicates with devices, web services, or third-party tools:

  • The [manifest file][manifest-docs] has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

  • I have reviewed two other [open pull requests][prs] in this repository.

Copilot AI review requested due to automatic review settings April 26, 2026 15:48
@gjohansson-ST gjohansson-ST requested a review from a team as a code owner April 26, 2026 15:48
@home-assistant home-assistant Bot added cla-signed core deprecation Indicates a breaking change to happen in the future labels Apr 26, 2026
@gjohansson-ST gjohansson-ST added this to the 2026.5.0b0 milestone Apr 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) and async_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.

Comment thread homeassistant/config_entries.py Outdated
Comment thread tests/test_config_entries.py
@gjohansson-ST gjohansson-ST marked this pull request as draft April 26, 2026 16:26
Co-authored-by: Copilot <copilot@github.com>
@gjohansson-ST gjohansson-ST marked this pull request as ready for review April 26, 2026 18:03
Copilot AI review requested due to automatic review settings April 26, 2026 18:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

Comment thread homeassistant/config_entries.py Outdated
Comment thread homeassistant/config_entries.py Outdated
Comment thread homeassistant/config_entries.py Outdated
Comment thread homeassistant/config_entries.py Outdated
Comment thread tests/test_config_entries.py
Co-authored-by: Copilot <copilot@github.com>
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@home-assistant home-assistant Bot marked this pull request as draft April 29, 2026 10:41
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

Copilot AI review requested due to automatic review settings May 3, 2026 12:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread tests/test_config_entries.py
Comment thread tests/test_config_entries.py Outdated
@gjohansson-ST gjohansson-ST marked this pull request as ready for review May 3, 2026 18:28
Copilot AI review requested due to automatic review settings May 3, 2026 18:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@MartinHjelmare
Copy link
Copy Markdown
Member

MartinHjelmare commented May 6, 2026

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.

@MartinHjelmare MartinHjelmare marked this pull request as draft May 6, 2026 18:22
@gjohansson-ST
Copy link
Copy Markdown
Member Author

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.
Now updated

@gjohansson-ST gjohansson-ST marked this pull request as ready for review May 6, 2026 18:38
Copilot AI review requested due to automatic review settings May 6, 2026 18:38
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread homeassistant/config_entries.py
@MartinHjelmare MartinHjelmare merged commit f886b60 into dev May 7, 2026
89 of 90 checks passed
@MartinHjelmare MartinHjelmare deleted the gj-20260426-01 branch May 7, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed core deprecation Indicates a breaking change to happen in the future

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants