Skip to content

Subsystem Test Maps

Per-subsystem "what's tested and how" docs. Each maps a subsystem's source modules to their test files, lists the behaviors under test, explains the setup patterns specific to that subsystem, and records the deliberate gaps. Numbered roughly by the start pipeline (core โ†’ queue โ†’ rooms โ†’ planning โ†’ learning โ†’ mapping) then peripheral subsystems and the HA-facing layers.

# Subsystem Map Cov
01 Core (orchestrator, lifecycle, progress, errors, storage) 01-core 96%
02 Jobs (start gate + active-job tracker) 02-jobs 95%
03 Queue (ordered clean queue) 03-queue 95%
04 Rooms (discovery, CRUD, access graph) 04-rooms 97%
05 Planning (rule eval, fan-out, path-block) 05-planning 95%
06 Learning (estimator, finalizer, history) 06-learning 96%
07 Mapping (trace pipeline, image stack, tracker) 07-mapping 96%
08 Battery (wear/health, sensors, sessions) 08-battery 96%
09 Maintenance (wear tracking, care guides) 09-maintenance 98%
10 Dock (action gating + dispatch) 10-dock 96%
11 Setup (workflow, drift, delete, entry wiring) 11-setup 97%
12 Profiles (per-room cleaning profiles) 12-profiles 96%
13 Onboarding (discovery + floor-type state) 13-onboarding 97%
14 Themes (card theme library) 14-themes 96%
15 Adapters (brand abstraction boundary) 15-adapters 97%ยน
16 Listeners (HA event โ†’ manager wiring) 16-listeners 98%
17 Services (HA service-call layer) 17-services 99%
18 Platforms & entities (sensor/button/number/switch/โ€ฆ) 18-platforms 98%

ยน Includes both shipped brand adapters (adapters/eufy/* and adapters/roborock/*), counted in the number. The framework adapter code (registry/loader/schema/brands) sits in the low-90s to 100%, and the Roborock adapter is ~96-100% across the board.

REWRITTEN 2026-11-11. This said the subsystem figure was "pulled down almost entirely by the CV segmentor (91%, 866 stmts)". That is no longer the explanation, and the figures were wrong besides: the segmentor has 868 statements, not 866, and sits at 95.43%. Nothing pulls this subsystem down notably now -- the remaining gap is eufy/adapter.py at 91.43%, which is almost all declaration dict and carries its own recorded ceiling rather than a shortfall. Both ceilings, and the arms that are reachable-but-unassertable, are written up in 15-adapters.

The per-subsystem Cov column is combined (statement + branch) coverage โ€” the single number pytest --cov-branch prints per row โ€” computed over exactly the modules each subsystem's table lists. Package __init__.py files (boot / re-export wiring) are deliberately not tabled, so they sit in the grand total but not the per-subsystem figures. The grand total below breaks out the statement-only figure too.

Total: 97.8% statement coverage (97% combined with --cov-branch, adapters included) over the source modules, all tests green. These numbers and the per-module tables are refreshed by scripts/update_test_docs.py.

Writing / updating a test map

Each map keeps five sections (see 10-dock as the compact template, 06-learning as the detailed one):

  1. Coverage map โ€” table of source module โ†’ stmts โ†’ cov% โ†’ test file โ†’ layer.
  2. What's tested โ€” per module, the behaviors (reference target-ID ranges).
  3. How it's tested โ€” the setup patterns (which fixtures, tmp_path vs integration hass, seeding helpers).
  4. Known gaps โ€” what's deliberately untested and why.

Measure a subsystem's coverage by running all its test files together (see ../02-running-tests.md), and link the matching docs/dev/ architecture file at the top.

Coverage conventions (apply everywhere)

  • # pragma: no cover is used only on pure log-only / best-effort except blocks (I/O writes, listener teardown) โ€” never on a block that escapes into a returned/persisted/user-visible value.
  • Deliberately measured (not pragma'd, even though they only log): fan-out skip-one-continue resilience and degraded-return excepts โ€” these are behavior.
  • Honest misses (not tested, not pragma'd): defensive continue / return [] guards (real control flow) and async_setup_entry boot wiring.