The integration no longer owns a database
The HA integration is now purely a client of the NestQuest API service (Feature 18): the API owns the SQLite file, the migrations, and every business rule, so keeping a second copy of that ownership inside the integration meant two sources of truth for household state, dead wiring (the startup backfill, the day-rollover materialization and sweep listeners, the corrupt-DB handling, the admin-allowlist seeding) and settings keys nothing consumes any more. Removed the integration's re-export/DB shim modules (db, store, migrations, schema, the five DAOs, completion, children, quest_definitions, admin_allowlist, presence, presence_management, materialize, recurrence, events, sweep); the bundled domain package at custom_components/nestquest/core/ is untouched and remains the single home of those engines. Setup now builds only the API client, the snapshot coordinator, and the SSE subscription, registers the one complete_quest proxy, and forwards the platforms. The options flow keeps only the keys the client itself consumes (API base URL + panel token, update interval, staleness, panel idle timeout); the horizon, rollover, notification and admin-allowlist settings moved out with the database (the API's settings store owns horizon/rollover, and the automations take their behaviour from blueprint inputs). The integration-plane tests now script the panel route's payloads and SSE frames instead of seeding a local database; the core-plane tests keep their coverage with imports pointed at core directly.
This commit is contained in:
@@ -6,8 +6,8 @@ import sqlite3
|
||||
|
||||
import pytest
|
||||
|
||||
from custom_components.nestquest.dao_children import ChildrenDao
|
||||
from custom_components.nestquest.dao_rules import (
|
||||
from custom_components.nestquest.core.dao_children import ChildrenDao
|
||||
from custom_components.nestquest.core.dao_rules import (
|
||||
ScheduleRuleRecord,
|
||||
ScheduleRuleStorage,
|
||||
ScheduleRulesDao,
|
||||
@@ -17,9 +17,9 @@ from custom_components.nestquest.dao_rules import (
|
||||
schedule_rule_from_storage,
|
||||
schedule_rule_to_storage,
|
||||
)
|
||||
from custom_components.nestquest.db import NestQuestDatabase
|
||||
from custom_components.nestquest.migrations import apply_migrations
|
||||
from custom_components.nestquest.recurrence import (
|
||||
from custom_components.nestquest.core.db import NestQuestDatabase
|
||||
from custom_components.nestquest.core.migrations import apply_migrations
|
||||
from custom_components.nestquest.core.recurrence import (
|
||||
RuleType,
|
||||
RuleValidationError,
|
||||
ScheduleRule,
|
||||
@@ -341,7 +341,7 @@ def test_rule_delete_concurrent_with_definition_create_is_safe(
|
||||
# delete task has been scheduled, so the create holds
|
||||
# the connection lock while the delete queues behind
|
||||
# it — then the create proceeds and wins.
|
||||
import custom_components.nestquest.dao_rules as dao_rules
|
||||
import custom_components.nestquest.core.dao_rules as dao_rules
|
||||
|
||||
original_validate = (
|
||||
dao_rules.QuestDefinitionsDao._validate_rule_exists
|
||||
|
||||
Reference in New Issue
Block a user