Split util.py (746 lines) into three focused modules#1256
Conversation
util.py had grown to 746 lines mixing three unrelated concerns: registry/ template entity filtering, ectoplasm setup forwarding, and sub-integration symlinking. Split into focused modules and rewired all 30 call sites. Also bump pyproject.toml metadata that drifted from the codebase reality: classifiers no longer list Python 3.11/3.12, requires-python is >=3.13.2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



What
Split `custom_components/spook/util.py` (746 lines) into three focused modules:
`entity_filtering.py`, `setup_helpers.py`, `integration_linking.py`. Also fix
some pyproject metadata that drifted away from the actual codebase reality.
Why
`util.py` had become a kitchen-sink of three unrelated concerns:
splitting, and unknown-reference filtering (used by ~25 repair modules).
`async_remove_entry`).
A 746-line module that's imported in 30 places makes it hard to reason about
what depends on what. Splitting along the existing concern lines gives each
module a single reason to change and makes the dependency graph honest.
How
service lookups, the cache invalidation listeners, template regex extraction,
and `async_find_services_in_sequence`. Most of util.py's bulk lives here.
`async_forward_platform_entry_setups_to_ectoplasm`.
`unlink_sub_integrations`.
project already requires 3.13+), and `requires-python` is bumped to
`>=3.13.2` to match the HA pin used elsewhere.
No behavior changes — every symbol is moved verbatim.
Testing
formatted.
remaining warning is a pre-existing `async_timeout` import error in
`blueprint/services/importer.py`, unrelated to this change).
resolve cleanly.
🤖 Generated with Claude Code
Quality Report
Changes: 34 files changed, 160 insertions(+), 141 deletions(-)
Code scan: clean
Tests: failed (command not found)
Branch hygiene: 1 issue(s)
Generated by Kōan post-mission quality pipeline