fix(ha-api): an unreachable Home Assistant no longer aborts startup - #46
Merged
Conversation
`HAClient.async_validate` set `aiohttp.ClientTimeout(total=...)` on its requests but caught only `(aiohttp.ClientError, PermissionError)`. An expired total timeout surfaces as the builtin `TimeoutError`, which is an `OSError` and not an `aiohttp.ClientError`, so it escaped and took startup with it — the one failure the validation exists to report was the one that killed the simulator instead of degrading to "continue without HA". `OSError` joins the except tuple, and the four failure shapes a caller can hit are pinned by tests: timeout, refused connection, unauthorized, and a bare transport error. Also records the retirement notice in the README: this simulator emulates firmware prior to r202633 and gives way to panelbench once that ships. Release 1.0.18.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
HAClient.async_validatesetsaiohttp.ClientTimeout(total=_TIMEOUT_S)on its requests but caught only(aiohttp.ClientError, PermissionError). An expired total timeout surfaces as the builtinTimeoutError— anOSError, not anaiohttp.ClientError— so it escaped the handler and aborted startup. The one failure validation exists to report was the one that killed the simulator instead of degrading to "continue without HA".OSErrorjoins the except tuple. Four failure shapes are now pinned by tests: timeout, refused connection, unauthorized, and a bare transport error.Verified against the installed stack (aiohttp 3.13.3, Python 3.14):
issubclass(TimeoutError, aiohttp.ClientError)isFalse,issubclass(TimeoutError, OSError)isTrue, andasyncio.TimeoutError is TimeoutError.Also
pyproject.toml,__init__.py,config.yamland the Dockerfile by thesync-versionhook.Test
451 passed, 3 failed— the 3 failures are pre-existing onmainand untouched here (same counts before and after this change). They come from dependabot'sebus-sdk0.1.5 → 0.19.0 bump in 9d4369d, which auto-merged because CI runs no test job:test_graph_builder_topology.py(2) — the vendoredgraph_builderstill calls the 0.1.xDevice(parent_id=, root_id=)/add_child()API. Synthetic fixtures only; no shipped mapping useschild-of-parent, so published shapes are unaffected.test_main_logging.py::test_sdk_homie_logger_still_emits_at_info— the SDK no longer pins thehomielogger to INFO at import, which is the premise that guard exists to catch.Pre-commit (the CI gate) passes clean: ruff, ruff-format, mypy --strict, sync-version.