Ensure person loads after recorder (#142585)

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
J. Nick Koston 2025-04-11 09:39:30 -10:00 committed by GitHub
parent 9d10d8f55e
commit 2c316c5820
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View File

@ -53,6 +53,7 @@ from .components import (
logbook as logbook_pre_import, # noqa: F401
lovelace as lovelace_pre_import, # noqa: F401
onboarding as onboarding_pre_import, # noqa: F401
person as person_pre_import, # noqa: F401
recorder as recorder_import, # noqa: F401 - not named pre_import since it has requirements
repairs as repairs_pre_import, # noqa: F401
search as search_pre_import, # noqa: F401

View File

@ -2,7 +2,7 @@
"domain": "onboarding",
"name": "Home Assistant Onboarding",
"codeowners": ["@home-assistant/core"],
"dependencies": ["auth", "http", "person"],
"dependencies": ["auth", "http"],
"documentation": "https://www.home-assistant.io/integrations/onboarding",
"integration_type": "system",
"quality_scale": "internal"

View File

@ -924,7 +924,7 @@ async def test_setup_hass_invalid_core_config(
"external_url": "https://abcdef.ui.nabu.casa",
},
"map": {},
"person": {"invalid": True},
"frontend": {"invalid": True},
}
],
)
@ -1560,6 +1560,11 @@ async def test_no_base_platforms_loaded_before_recorder(hass: HomeAssistant) ->
# we remove the platform YAML schema support for sensors
"websocket_api": {"sensor.py"},
}
# person is a special case because it is a base platform
# in the sense that it creates entities in its namespace
# but its not used by other integrations to create entities
# so we want to make sure it is not loaded before the recorder
base_platforms = BASE_PLATFORMS | {"person"}
integrations_before_recorder: set[str] = set()
for _, integrations, _ in bootstrap.STAGE_0_INTEGRATIONS:
@ -1592,7 +1597,7 @@ async def test_no_base_platforms_loaded_before_recorder(hass: HomeAssistant) ->
problems: dict[str, set[str]] = {}
for domain in integrations:
domain_with_base_platforms_deps = (
integrations_all_dependencies[domain] & BASE_PLATFORMS
integrations_all_dependencies[domain] & base_platforms
)
if domain_with_base_platforms_deps:
problems[domain] = domain_with_base_platforms_deps
@ -1600,7 +1605,7 @@ async def test_no_base_platforms_loaded_before_recorder(hass: HomeAssistant) ->
f"Integrations that are setup before recorder have base platforms in their dependencies: {problems}"
)
base_platform_py_files = {f"{base_platform}.py" for base_platform in BASE_PLATFORMS}
base_platform_py_files = {f"{base_platform}.py" for base_platform in base_platforms}
for domain, integration in all_integrations.items():
integration_base_platforms_files = (