Address PR #142 review: core isolation invariant and shim fixes
- Point recurrence purity scan at custom_components.nestquest.core.recurrence (P2.1); the shim only re-exports, so the real model was no longer scanned. - Make test_const/test_config_flow/test_dao_matrix module scans recursive (rglob) so custom_components/nestquest/core/ is covered (P2.2, P2.3); const.py name exclusion retained. - Add test_core_isolation: AST-scan every core module for homeassistant imports, relative imports climbing out of core (level > 1), absolute imports reaching custom_components.nestquest.<not core>, and bare 'import core'/'from core' (P2.4). - Drop the private re-export of _month_end/_nth_weekday_of_month from the recurrence shim; those are test-only, so move the two test imports to custom_components.nestquest.core.recurrence (P2.1/P3.1). - Fix shim docstrings and core/__init__.py to reference custom_components.nestquest.core.* instead of the unimportable 'core.*' paths (P3.2). - Note the migrations logger namespace move to custom_components.nestquest.core.migrations in RELEASE_NOTES.md (P3.3).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Re-export of :mod:`core.const` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.const` for the integration package.
|
||||
|
||||
The canonical constants live in :mod:`core.const` (the storage layer
|
||||
The canonical constants live in :mod:`custom_components.nestquest.core.const` (the storage layer
|
||||
extracted in task d0b691d8); this module re-exports them so existing
|
||||
``from .const import ...`` references inside the integration keep
|
||||
working without touching every import line.
|
||||
|
||||
@@ -5,7 +5,7 @@ SQLite storage layer: schema DDL, the versioned migration runner, the
|
||||
async connection wrapper, the path resolver, the domain constants and
|
||||
recurrence model, and the typed DAOs. Nothing in this package imports
|
||||
``homeassistant``; the integration wires it into HA at its own layer
|
||||
(constructing :class:`core.db.NestQuestDatabase` with an executor
|
||||
adapter backed by ``hass.async_add_executor_job``).
|
||||
(constructing :class:`custom_components.nestquest.core.db.NestQuestDatabase`
|
||||
with an executor adapter backed by ``hass.async_add_executor_job``).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Re-export of :mod:`core.dao_children` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.dao_children` for the integration package.
|
||||
|
||||
The children/admin DAO lives in :mod:`core.dao_children` (extracted in
|
||||
The children/admin DAO lives in
|
||||
:mod:`custom_components.nestquest.core.dao_children` (extracted in
|
||||
task d0b691d8); this module re-exports it so existing
|
||||
``from .dao_children import ...`` references inside the integration keep
|
||||
working.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Re-export of :mod:`core.dao_instances` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.dao_instances` for the integration package.
|
||||
|
||||
The instances/completion-events DAO lives in :mod:`core.dao_instances`
|
||||
The instances/completion-events DAO lives in
|
||||
:mod:`custom_components.nestquest.core.dao_instances`
|
||||
(extracted in task d0b691d8); this module re-exports it so existing
|
||||
``from .dao_instances import ...`` references inside the integration keep
|
||||
working.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Re-export of :mod:`core.dao_meta` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.dao_meta` for the integration package.
|
||||
|
||||
The meta-state DAO lives in :mod:`core.dao_meta` (extracted in task
|
||||
The meta-state DAO lives in
|
||||
:mod:`custom_components.nestquest.core.dao_meta` (extracted in task
|
||||
d0b691d8); this module re-exports it so existing
|
||||
``from .dao_meta import ...`` references inside the integration keep
|
||||
working.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""Re-export of :mod:`core.dao_presence` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.dao_presence` for the integration package.
|
||||
|
||||
The presence DAOs live in :mod:`core.dao_presence` (extracted in task
|
||||
d0b691d8); this module re-exports them so existing
|
||||
The presence DAOs live in
|
||||
:mod:`custom_components.nestquest.core.dao_presence` (extracted in
|
||||
task d0b691d8); this module re-exports them so existing
|
||||
``from .dao_presence import ...`` references inside the integration keep
|
||||
working.
|
||||
"""
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
"""Re-export of :mod:`core.dao_rules` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.dao_rules` for the integration package.
|
||||
|
||||
The schedule-rules/quest-definitions DAO lives in
|
||||
:mod:`core.dao_rules` (extracted in task d0b691d8); this module
|
||||
re-exports it so existing ``from .dao_rules import ...`` references
|
||||
inside the integration keep working.
|
||||
:mod:`custom_components.nestquest.core.dao_rules` (extracted in task
|
||||
d0b691d8); this module re-exports it so existing
|
||||
``from .dao_rules import ...`` references inside the integration keep
|
||||
working.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Re-export of :mod:`core.db` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.db` for the integration package.
|
||||
|
||||
The async SQLite wrapper lives in :mod:`core.db` (extracted in task
|
||||
The async SQLite wrapper lives in :mod:`custom_components.nestquest.core.db` (extracted in task
|
||||
d0b691d8) and is Home-Assistant-free: :class:`NestQuestDatabase` takes
|
||||
an executor callable rather than a ``hass`` object. This module
|
||||
re-exports it and provides :func:`make_database`, a thin adapter that
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Re-export of :mod:`core.migrations` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.migrations` for the integration package.
|
||||
|
||||
The versioned migration runner lives in :mod:`core.migrations`
|
||||
The versioned migration runner lives in
|
||||
:mod:`custom_components.nestquest.core.migrations`
|
||||
(extracted in task d0b691d8); this module re-exports it so existing
|
||||
``from .migrations import ...`` references inside the integration keep
|
||||
working.
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
"""Re-export of :mod:`core.recurrence` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.recurrence` for the integration package.
|
||||
|
||||
The recurrence model lives in :mod:`core.recurrence` (extracted in task
|
||||
d0b691d8); this module re-exports it so existing
|
||||
The recurrence model lives in :mod:`custom_components.nestquest.core.recurrence`
|
||||
(extracted in task d0b691d8); this module re-exports it so existing
|
||||
``from .recurrence import ...`` references inside the integration keep
|
||||
working.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from .core.recurrence import * # noqa: F401,F403
|
||||
from .core.recurrence import _month_end, _nth_weekday_of_month # noqa: F401
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Re-export of :mod:`core.schema` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.schema` for the integration package.
|
||||
|
||||
The declarative schema DDL lives in :mod:`core.schema` (extracted in
|
||||
The declarative schema DDL lives in
|
||||
:mod:`custom_components.nestquest.core.schema` (extracted in
|
||||
task d0b691d8); this module re-exports it so existing
|
||||
``from .schema import ...`` references inside the integration keep
|
||||
working.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Re-export of :mod:`core.store` for the integration package.
|
||||
"""Re-export of :mod:`custom_components.nestquest.core.store` for the integration package.
|
||||
|
||||
The path resolver lives in :mod:`core.store` (extracted in task
|
||||
d0b691d8) and is Home-Assistant-free: :func:`core.store.async_get_db_path`
|
||||
The path resolver lives in
|
||||
:mod:`custom_components.nestquest.core.store` (extracted in task
|
||||
d0b691d8) and is Home-Assistant-free:
|
||||
:func:`custom_components.nestquest.core.store.async_get_db_path`
|
||||
takes the full database path. This module re-exports it and provides
|
||||
the original ``async_get_db_path(hass)`` signature so the integration
|
||||
resolves the path from ``hass.config.path`` exactly as before.
|
||||
@@ -23,7 +25,8 @@ async def async_get_db_path(hass: HomeAssistant) -> Path:
|
||||
"""Return the absolute path to the NestQuest SQLite database file.
|
||||
|
||||
Resolves the database file from ``hass.config.path`` and delegates to
|
||||
:func:`core.store.async_get_db_path`, which ensures the parent
|
||||
directory exists off the event loop via :func:`asyncio.to_thread`.
|
||||
:func:`custom_components.nestquest.core.store.async_get_db_path`,
|
||||
which ensures the parent directory exists off the event loop via
|
||||
:func:`asyncio.to_thread`.
|
||||
"""
|
||||
return await _core_async_get_db_path(hass.config.path(SQLITE_DB_FILENAME))
|
||||
|
||||
Reference in New Issue
Block a user