Commit 1967976
fix: address sidelined silent-failure findings + fix connection-drop test
Three findings I previously marked "out of scope" — wrongly, per
AGENTS.md § Boy Scout Rule which explicitly forbids that escape hatch:
1. WS dispatcher swallowed handler exceptions without a traceback
(``websocket_client.py:403``). The bare ``logger.error(f"... {e}")``
gave operators one line and no stack, so a handler bug
(AttributeError on a malformed event, KeyError on schema drift)
would silently stop nudging the waiter's ``asyncio.Event`` and the
calling waiter would time out reporting "not found." Added
``exc_info=True`` so the traceback lands in logs. The dispatcher
itself still swallows so one buggy handler can't kill the WS — but
the bug is now visible.
2. ``wait_for_automation_entity_by_unique_id`` emitted a redundant
"Automation with unique_id X was not found" warning at the same
level as ``_ws_wait_for_condition``'s generic timeout warning.
Replaced the redundant warning with a conditional one that fires
only when REST sampling was wedged the entire budget, so operators
can distinguish "automation truly not published" from "REST channel
down."
3. Transient ``HomeAssistantAPIError`` from ``get_states()`` was
debug-only with no signal at timeout time. Now tracked in the
closure cell and surfaced in the new conditional warning above
("timed out with every REST sample failing; last error: ...").
Also fixes ``test_connection_drop_during_discovery_falls_back_to_rest``
which I wrote against the wrong nudge shape: the original noise event
didn't match the discovery filter so the wait timed out at the
backstop instead of dropping. Rewritten to mirror
``test_connection_drop_before_wait_loop_falls_back_to_rest`` — drop
``ws_client.is_connected`` inside the post-subscribe sample so the
connection-drop branch routes us straight to ``_legacy_poll_until``.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c944597 commit 1967976
3 files changed
Lines changed: 65 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
403 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
404 | 415 | | |
405 | 416 | | |
406 | 417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1131 | 1131 | | |
1132 | 1132 | | |
1133 | 1133 | | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
1138 | 1141 | | |
1139 | 1142 | | |
1140 | 1143 | | |
1141 | 1144 | | |
1142 | 1145 | | |
1143 | 1146 | | |
1144 | 1147 | | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
1145 | 1151 | | |
1146 | 1152 | | |
1147 | 1153 | | |
| 1154 | + | |
1148 | 1155 | | |
1149 | 1156 | | |
1150 | 1157 | | |
| |||
1207 | 1214 | | |
1208 | 1215 | | |
1209 | 1216 | | |
1210 | | - | |
1211 | | - | |
1212 | | - | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
1213 | 1229 | | |
1214 | 1230 | | |
1215 | 1231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1022 | 1022 | | |
1023 | 1023 | | |
1024 | 1024 | | |
1025 | | - | |
| 1025 | + | |
1026 | 1026 | | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1044 | 1050 | | |
1045 | | - | |
1046 | 1051 | | |
1047 | | - | |
1048 | | - | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
| 1052 | + | |
1057 | 1053 | | |
1058 | | - | |
1059 | 1054 | | |
1060 | 1055 | | |
1061 | 1056 | | |
1062 | | - | |
1063 | 1057 | | |
1064 | 1058 | | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
0 commit comments