From 2c316c582033e5e805a91e2a0b4bf8e3da1b6327 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 11 Apr 2025 09:39:30 -1000 Subject: [PATCH] Ensure person loads after recorder (#142585) Co-authored-by: Erik Montnemery --- homeassistant/bootstrap.py | 1 + homeassistant/components/onboarding/manifest.json | 2 +- tests/test_bootstrap.py | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 962c7871028..f88912478a7 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -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 diff --git a/homeassistant/components/onboarding/manifest.json b/homeassistant/components/onboarding/manifest.json index a4cf814eb2a..e57857896e0 100644 --- a/homeassistant/components/onboarding/manifest.json +++ b/homeassistant/components/onboarding/manifest.json @@ -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" diff --git a/tests/test_bootstrap.py b/tests/test_bootstrap.py index 7a4f9fda257..ebfc6b81e00 100644 --- a/tests/test_bootstrap.py +++ b/tests/test_bootstrap.py @@ -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 = (