Commit 0d7151e
fix: add post-operation verification to group config tools (#853)
* fix: add post-operation verification to group config tools
Apply the existing wait_for_entity_registered/removed pattern
(already used by automations, scripts, and helpers) to group
config tools:
- ha_config_set_group: verify group.{object_id} entity is queryable
after group.set service call
- ha_config_remove_group: verify entity is removed after group.remove
service call
Groups use fire-and-forget service calls (group.set/group.remove)
that acknowledge the command before the entity state updates, which
can cause false success responses. This is the same pattern that
was already fixed for automations (#708) and scripts.
Other tools flagged in #709 (zones, labels, areas) use synchronous
WebSocket registry operations that return the actual result data,
so they don't have the same false-success risk.
Partial fix for #709
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: add post-operation verification to zone config tools
- ha_set_zone (create): re-query zone/list to verify new zone
appears in registry
- ha_remove_zone: re-query zone/list to verify zone is gone
Zones use WebSocket registry operations that are synchronous, but
the zone entity (zone.xxx) registration can lag. Re-querying the
registry confirms the operation persisted.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* revert: remove redundant zone registry re-query verification
Gemini correctly identified that re-querying zone/list after a
synchronous WebSocket zone/create is redundant — the success
response already confirms the registry update. The real state
machine lag (zone.xxx entity registration) would need
wait_for_entity_registered, but zone entity_ids can't be reliably
predicted from the name.
Keep groups verification only — group.set is a fire-and-forget
service call where entity_id IS predictable (group.{object_id}).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: add post-operation verification to integration config tools
- ha_set_integration_enabled: re-query config entry to verify
disabled_by field matches the requested state (skipped when
require_restart=True since change is deferred)
- ha_delete_config_entry: re-query config entry to verify it's
actually gone (404 = expected success, skipped when
require_restart=True)
These operations use synchronous REST/WebSocket calls that are
more reliable than service calls, but the issue (#709) flagged
them as high-risk since they report success without confirming
the operation's side effects.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* revert: remove unnecessary integration verification
Integration tools use synchronous REST/WebSocket calls that either
succeed or throw — no false-success scenario exists. The issue's
"high risk" classification was wrong for these tools. Only
fire-and-forget service calls (like group.set) can produce false
successes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test: add regression tests for group verification
- test_created_group_is_immediately_queryable: after
ha_config_set_group returns success, verify the entity is
actually queryable via ha_get_state
- test_removed_group_is_immediately_gone: after
ha_config_remove_group returns success, verify the entity
is no longer queryable
These tests would fail if the wait_for_entity_registered/removed
verification were reverted, confirming the fix prevents false
success responses.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: handle nested data key in group verification test
ha_get_state response wraps entity data under a "data" key.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: kingpanther13 <kingpanther13@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent c3d726a commit 0d7151e
2 files changed
Lines changed: 148 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
136 | 148 | | |
137 | 149 | | |
138 | 150 | | |
| |||
225 | 237 | | |
226 | 238 | | |
227 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
228 | 251 | | |
229 | 252 | | |
230 | 253 | | |
231 | 254 | | |
232 | 255 | | |
233 | 256 | | |
| 257 | + | |
234 | 258 | | |
235 | 259 | | |
236 | 260 | | |
| |||
253 | 277 | | |
254 | 278 | | |
255 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
256 | 287 | | |
257 | 288 | | |
258 | 289 | | |
| |||
285 | 316 | | |
286 | 317 | | |
287 | 318 | | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
288 | 330 | | |
289 | 331 | | |
290 | 332 | | |
291 | 333 | | |
292 | 334 | | |
| 335 | + | |
293 | 336 | | |
294 | 337 | | |
295 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
0 commit comments