Skip to content

Reject manifest dependencies on core integrations in hassfest#169425

Merged
frenck merged 6 commits into
devfrom
hassfest-reject-core-integration-deps
Apr 29, 2026
Merged

Reject manifest dependencies on core integrations in hassfest#169425
frenck merged 6 commits into
devfrom
hassfest-reject-core-integration-deps

Conversation

@epenet
Copy link
Copy Markdown
Contributor

@epenet epenet commented Apr 29, 2026

Proposed change

Based on feedback from @arturpragacz in #169386

Add a hassfest check that rejects any manifest dependencies entry whose
domain is in homeassistant.bootstrap.CORE_INTEGRATIONS (currently
homeassistant and persistent_notification). These integrations are
loaded unconditionally during bootstrap before any other integration
starts, so listing them as a dependency in another integration's manifest
is meaningless and only adds noise.

ALLOWED_USED_COMPONENTS is updated to spread CORE_INTEGRATIONS
instead of listing the same domains explicitly, so the two stay in sync
by construction.

To avoid pulling homeassistant.bootstrap (and its eager component
pre-imports) into the hassfest import chain, CORE_INTEGRATIONS is
duplicated locally in script/hassfest/dependencies.py. A unit test
asserts the two sets stay equal so the duplicate cannot drift.

The recovery_mode manifest was the only integration tripping the new
rule, so its "dependencies": ["persistent_notification"] entry is
removed. The persistent_notification import in recovery_mode's code
remains valid: persistent_notification is in ALLOWED_USED_COMPONENTS
and is unconditionally loaded before recovery_mode anyway.

Three unit tests for _validate_dependencies are added: one asserting
that a core-integration dep produces an error, one asserting that a
non-core dep does not, and one asserting the duplicated
CORE_INTEGRATIONS stays aligned with homeassistant.bootstrap.

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

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
  • 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.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

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 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:

Core integrations (homeassistant, persistent_notification) are loaded
unconditionally during bootstrap, so listing them in another
integration's manifest dependencies has no effect. Reject these
declarations in hassfest and remove the existing offender in
recovery_mode.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (recovery_mode) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of recovery_mode can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign recovery_mode Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

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

Adds a hassfest validation rule to prevent integrations from listing bootstrap core integrations as manifest dependencies, reducing manifest noise and enforcing a clearer dependency model.

Changes:

  • Add hassfest validation to reject manifest dependencies entries that reference homeassistant.bootstrap.CORE_INTEGRATIONS.
  • Remove persistent_notification from recovery_mode’s manifest dependencies as it is unconditionally loaded.
  • Add unit tests covering allowed vs rejected dependency domains.

Reviewed changes

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

File Description
script/hassfest/dependencies.py Introduces a new dependency validation rule for core integrations.
tests/hassfest/test_dependencies.py Adds tests for the new _validate_dependencies behavior.
homeassistant/components/recovery_mode/manifest.json Removes an invalid/no-op dependency on a core integration.

Comment thread script/hassfest/dependencies.py Outdated
@epenet epenet marked this pull request as ready for review April 29, 2026 06:46
@epenet epenet requested a review from a team as a code owner April 29, 2026 06:46
Copilot AI review requested due to automatic review settings April 29, 2026 06:46
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 3 out of 3 changed files in this pull request and generated no new comments.

epenet and others added 2 commits April 29, 2026 06:58
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@epenet epenet marked this pull request as draft April 29, 2026 07:02
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 29, 2026 07:04
@epenet epenet marked this pull request as ready for review April 29, 2026 07:06
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 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread tests/hassfest/test_dependencies.py Outdated
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Nice! Thanks, @epenet 👍

../Frenck

                       

Blogging my personal ramblings at frenck.dev

@frenck frenck merged commit 8091f51 into dev Apr 29, 2026
81 of 82 checks passed
@frenck frenck deleted the hassfest-reject-core-integration-deps branch April 29, 2026 07:52
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants