Skip to content

Add validator to prevent integration domain overrides of core - #5442

Open
ludeeus wants to merge 2 commits into
mainfrom
claude/core-domain-override-validator-hs911z
Open

Add validator to prevent integration domain overrides of core#5442
ludeeus wants to merge 2 commits into
mainfrom
claude/core-domain-override-validator-hs911z

Conversation

@ludeeus

@ludeeus ludeeus commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

This PR adds a new validator that checks whether a HACS integration is attempting to override a domain that already exists in Home Assistant core. This prevents accidental or intentional conflicts with core integrations.

Key Changes

  • New validator: core_domain_override.py - Validates that integration domains don't conflict with core Home Assistant domains

    • Fetches the list of core integration domains from https://next.home-assistant.io/integrations.json
    • Uses the "next" site to catch domains landing in upcoming releases before they ship
    • Skips validation if no domain is defined (handled by integration_manifest check instead)
    • Handles fetch failures and invalid JSON gracefully with appropriate error messages
  • Comprehensive test coverage: test_core_domain_override_check.py with 5 test cases

    • Domain not in core (passes validation)
    • Domain overrides core domain (fails validation)
    • Core integrations fetch failure (fails validation)
    • Invalid JSON response (fails validation)
    • No domain defined (skips fetch, passes validation)
  • Integration into validation pipeline: Updated action tests to include the new validator

    • Check count increased from 9 to 10 for integration validation
    • Updated all relevant test snapshots and logs

Implementation Details

  • Validator only applies to HacsCategory.INTEGRATION repositories
  • Gracefully handles network errors and malformed responses by raising ValidationException
  • Documentation link provided: Add core domain override check documentation documentation#700
  • Added test fixtures and API usage snapshots for proper test isolation

Adds an integration-only action check that fails when the integration
domain from manifest.json matches a Home Assistant core integration
domain. The core domain list is read from the integrations.json file
published by the Home Assistant site.

HACS policy already states that integrations overriding a core
integration are not accepted as defaults, but until now that was only
enforced by a reviewer reading the hacs/default pull request.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qc22QRVJF4ssjo7wPzBn2A
Copilot AI review requested due to automatic review settings July 31, 2026 13:05
@ludeeus ludeeus added the pr: action Changes to actions label Jul 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces a new validation step in the HACS action validation pipeline to detect when an integration’s manifest domain conflicts with an existing Home Assistant core integration domain, using the next.home-assistant.io/integrations.json domain list to catch upcoming core additions.

Changes:

  • Added core_domain_override validator that fetches core integration domains and fails validation on domain collisions.
  • Added dedicated validator tests and updated action/validation snapshots (API usage + logs) to account for the new check.
  • Added proxy fixture for next.home-assistant.io/integrations.json and updated action test setup to mock the new endpoint.

Reviewed changes

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

Show a summary per file
File Description
custom_components/hacs/validate/core_domain_override.py New validator that fetches core domains and blocks domain overrides.
tests/validate/test_core_domain_override_check.py Test coverage for pass/fail/skip and error conditions for the new validator.
tests/action/test_hacs_action_integration.py Updates action test to mock the new endpoint and adjust expected check counts.
tests/fixtures/proxy/next.home-assistant.io/integrations.json Adds proxy fixture for the new external endpoint used by the validator.
tests/snapshots/api-usage/tests/validate/test_core_domain_override_check*.json Captures expected external calls for the new validator tests.
tests/snapshots/api-usage/tests/validate/test_async_run_repository_checkstest-async-run-repository-checks.json Updates expected external calls due to the new validator being executed.
tests/snapshots/api-usage/tests/action/test_hacs_action_integration*.json Updates action snapshots to include the new endpoint call.
tests/snapshots/action/test_hacs_action_integration/*.log Updates logs to include the new validator and updated check counts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread custom_components/hacs/validate/core_domain_override.py
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@ludeeus
ludeeus marked this pull request as ready for review July 31, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: action Changes to actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants