Skip to content

Conversation

epenet
Copy link
Contributor

@epenet epenet commented Jul 2, 2025

Breaking change

For developpers only: passing hass argument to verify_domain_control is deprecated. Please remove the argument.

Proposed change

Spotted whilst reviewing #146050, this is an alternative to #146057

There should be no need to pass hass to verify_domain_control, as that is now part of the ServiceCall object.

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

  • 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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

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

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

  • The manifest file 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 link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed core deprecation Indicates a breaking change to happen in the future labels Jul 2, 2025
@epenet epenet force-pushed the epenet-20250702-1210 branch from 2a1c639 to 01a7754 Compare July 2, 2025 10:49
@epenet epenet force-pushed the epenet-20250702-1210 branch from 52ce757 to b01cc38 Compare July 10, 2025 09:24
@epenet epenet marked this pull request as ready for review July 10, 2025 09:52
@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 09:52
Copy link
Contributor

@Copilot 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 deprecates the hass argument for verify_domain_control, introduces a new deprecated_hass_binding decorator to warn when hass is passed, updates service helper code to use the new signature, and adds tests for the new decorator and deprecation warning.

  • Replace bind_hass on verify_domain_control with @deprecated_hass_binding(breaks_in_ha_version="2026.2").
  • Update all component/service callsites to drop the explicit hass argument when decorating with verify_domain_control.
  • Add deprecated_hass_binding implementation and tests in tests/helpers/test_service.py and tests/helpers/test_deprecation.py.

Reviewed Changes

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

Show a summary per file
File Description
tests/helpers/test_service.py Parametrized existing tests to assert deprecation warning appears only when hass is used.
tests/helpers/test_deprecation.py Added test_deprecated_hass_binding to verify the new decorator strips hass and logs.
homeassistant/helpers/service.py Swapped @bind_hass for @deprecated_hass_binding and removed hass param from signature.
homeassistant/helpers/deprecation.py Introduced deprecated_hass_binding decorator.
homeassistant/components/*/… Updated all verify_domain_control(hass, DOMAIN) usages to verify_domain_control(DOMAIN).
Comments suppressed due to low confidence (1)

homeassistant/helpers/deprecation.py:141

  • The function definition uses invalid bracketed syntax ([**_P, _T]) which is a syntax error in Python. You should use standard parentheses for the signature (e.g., def deprecated_hass_binding(*, breaks_in_ha_version: str | None = None) -> Callable[..., ...]:) and declare type variables in annotations rather than in the def header.
def deprecated_hass_binding[**_P, _T](

@epenet epenet force-pushed the epenet-20250702-1210 branch from d7fc282 to 4c3d1c3 Compare August 10, 2025 15:20
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.

1 participant