Remove the integration's database, migrations, DAOs and business modules #172

Member

Task ad67fc44-f4ff-4538-b6db-946e6d087d57 — feature 18 (HA Integration as API Client).

The integration no longer owns a database: it creates no SQLite file, runs no migrations, and has no DAO/engine/business modules of its own — those live only in custom_components/nestquest/core/ (untouched).

  • __init__.py: all DB ownership and wiring removed (open/migrate/store path, runtime database field, corrupt/missing-DB handling, startup backfill, day-rollover materialization listener, missed-sweep listener, admin-allowlist seeding). Setup now builds the API client, the coordinator, and the SSE subscription, registers only complete_quest, and sets up/unloads cleanly.
  • Deleted the Feature-15 re-export shim/DB/DAO/engine/business modules; nothing in the integration references a deleted module.
  • options_flow.py: admin-allowlist section and DB-owned settings removed; kept panel_idle_timeout (panel-facing), update_interval, snapshot_staleness, api_base_url, panel_token. Strings/translations updated.
  • Blueprints untouched.
  • Tests: DB-wiring tests removed; API client, coordinator, SSE, sensor, complete_quest proxy, config/options flow and blueprint tests kept/migrated to scripted panel-route payloads; core-plane tests migrated to core.* imports.

Checks: TZ=UTC uv run pytest -q → 1675 passed; grep -r "aiosqlite\|nestquest.db\|sqlite3" custom_components/nestquest/ returns nothing outside core/.

Done-condition: the grep returns nothing outside core/, and the integration's tests pass with the DB path wiring removed.

Task ad67fc44-f4ff-4538-b6db-946e6d087d57 — feature 18 (HA Integration as API Client). The integration no longer owns a database: it creates no SQLite file, runs no migrations, and has no DAO/engine/business modules of its own — those live only in `custom_components/nestquest/core/` (untouched). - `__init__.py`: all DB ownership and wiring removed (open/migrate/store path, runtime `database` field, corrupt/missing-DB handling, startup backfill, day-rollover materialization listener, missed-sweep listener, admin-allowlist seeding). Setup now builds the API client, the coordinator, and the SSE subscription, registers only `complete_quest`, and sets up/unloads cleanly. - Deleted the Feature-15 re-export shim/DB/DAO/engine/business modules; nothing in the integration references a deleted module. - `options_flow.py`: admin-allowlist section and DB-owned settings removed; kept `panel_idle_timeout` (panel-facing), `update_interval`, `snapshot_staleness`, `api_base_url`, `panel_token`. Strings/translations updated. - Blueprints untouched. - Tests: DB-wiring tests removed; API client, coordinator, SSE, sensor, complete_quest proxy, config/options flow and blueprint tests kept/migrated to scripted panel-route payloads; core-plane tests migrated to `core.*` imports. Checks: `TZ=UTC uv run pytest -q` → 1675 passed; `grep -r "aiosqlite\|nestquest.db\|sqlite3" custom_components/nestquest/` returns nothing outside `core/`. Done-condition: the grep returns nothing outside core/, and the integration's tests pass with the DB path wiring removed.
dev_agent added 1 commit 2026-09-23 09:02:16 -04:00
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.
review_agent left a comment
Member

Independent Claude Sonnet 5 review completed for this exact commit.

Independent Claude Sonnet 5 review completed for this exact commit.
dev_agent merged commit a3f2adcf43 into feature/430f7f98-7650-43e9-aa98-4b340303602a-ha-integration-as-api-client 2026-09-23 09:11:30 -04:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Maniacs_Mansion/NestQuest#172