Commit b66e8fc
fix(search): floor-area and bulk-control hardening follow-ups (#2243)
* fix: name the cost of a floor-registry outage in area resolution
A dead floor registry suppresses all fuzzy area matching, but the only
line the caller saw was the generic fetch warning. Return a resolution
warning that names the consequence and the recovery, and derive the
availability flag from the parse outcome so the two predicates cannot
desync.
* fix: route ha_search partial_reason through the shared merger
_finalize_partial_state concatenated with its own separator and no
de-duplication while the module's other three writers used
_merge_partial_reason. Also fall back to the exception type name when a
branch exception's message is empty, so a timeout no longer produces
partial_reason 'entities: '.
* refactor: fold the bulk-row skip blocks into one helper
Seven copies of log/build/append collapse into _skip_bulk_operation, and
the dead err_response['index'] writes go with them — create_error_response
already lifts every context key to the top level. The allowed-key literal
now reads its keys back from BulkControlOperation so the runtime validator
cannot drift from the advertised schema.
* fix: reject boolean bulk timeouts at both validation layers
Pydantic's lax mode coerces true to 1.0 and float(True) is 1.0, so
timeout_seconds: true was silently accepted as a one-second wait on both
the transport schema and the runtime batch validator. The field now
carries strict=True (matching validate_first) and the runtime helper
rejects bools before float() sees them; its return collapses to
float | None so the caller no longer re-invalidates None. A swallowed
ValidationError in ha_bulk_control now logs the schema's reason, which is
the only place that detail survives.
* fix: fail a bulk batch whose every operation is invalid
An empty operations list already raised, but a batch where every row
failed validation returned the success-shaped response with
successful_commands: 0. The batch-item carve-out from AGENTS.md's
raise-on-failure rule exists to protect successful siblings, and there
are none — so raise with the skipped rows in the payload, still ahead of
the component probe so nothing dispatches. Mixed batches keep failing
soft.
* fix: name where a bulk parameters JSON string failed to parse
The JSONDecodeError was caught unbound, so the caller was told only that
its parameters were invalid JSON. Thread the decoder's reason and offset
into the message, and lead every bulk validation-failure suggestion list
with the row-shape guidance models get wrong most often.
* docs: correct the model-facing bulk descriptions and stale comments
validate_first said it prevents dispatch, but the component batch path
detects the missing entity from the captured pre-state afterwards. The
parameters description never said the per-domain key list is a silent
allowlist, and _DOMAIN_PARAMS carried no warning that a new parameter
disappears at dispatch until it is added there. Also restores the
exact-first rationale on _match_area_ids and reflects the shortened final
poll in get_device_operation_status.
* test: cover the bulk and floor-expansion branches nothing reached
Pins entity aggregation through floor expansion (a second area on the
floor with its own entity), a bare floor_id as the area filter, the
non-string entity_id branch, and a parameters string that parses to a
list rather than an object.
* chore: satisfy CodeQL implicit-concat check in bulk suggestions
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xih4pUWhifP1zhQe3iaKVD
* fix: reject string bulk timeouts at runtime to match the strict schema
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xih4pUWhifP1zhQe3iaKVD
* fix: skip oversized bulk timeouts instead of aborting the batch
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xih4pUWhifP1zhQe3iaKVD
* fix: reject null bulk parameters and classify non-dict rows as invalid
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xih4pUWhifP1zhQe3iaKVD
* fix: skip pathologically nested bulk parameters instead of aborting the batch
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xih4pUWhifP1zhQe3iaKVD
* fix: stringify non-string bulk operation keys before sorting
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xih4pUWhifP1zhQe3iaKVD
* fix: redact logged bulk inputs and treat a missing registry result as an outage
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xih4pUWhifP1zhQe3iaKVD
---------
Co-authored-by: kingpanther13 <kingpanther13@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 0d15c19 commit b66e8fc
10 files changed
Lines changed: 574 additions & 174 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
| 49 | + | |
| 50 | + | |
46 | 51 | | |
47 | 52 | | |
48 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
483 | 485 | | |
484 | 486 | | |
485 | 487 | | |
| |||
657 | 659 | | |
658 | 660 | | |
659 | 661 | | |
660 | | - | |
661 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
662 | 671 | | |
663 | 672 | | |
664 | 673 | | |
| |||
768 | 777 | | |
769 | 778 | | |
770 | 779 | | |
771 | | - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
772 | 784 | | |
773 | 785 | | |
774 | 786 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
330 | 329 | | |
331 | 330 | | |
332 | 331 | | |
| |||
2217 | 2216 | | |
2218 | 2217 | | |
2219 | 2218 | | |
2220 | | - | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
2221 | 2224 | | |
2222 | 2225 | | |
2223 | 2226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| |||
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
97 | 104 | | |
98 | 105 | | |
99 | 106 | | |
| |||
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
111 | | - | |
112 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
113 | 122 | | |
114 | 123 | | |
115 | 124 | | |
| |||
1531 | 1540 | | |
1532 | 1541 | | |
1533 | 1542 | | |
1534 | | - | |
| 1543 | + | |
| 1544 | + | |
1535 | 1545 | | |
1536 | 1546 | | |
1537 | 1547 | | |
| |||
1559 | 1569 | | |
1560 | 1570 | | |
1561 | 1571 | | |
1562 | | - | |
| 1572 | + | |
1563 | 1573 | | |
1564 | 1574 | | |
1565 | 1575 | | |
1566 | 1576 | | |
1567 | | - | |
| 1577 | + | |
1568 | 1578 | | |
1569 | 1579 | | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
1570 | 1590 | | |
1571 | 1591 | | |
1572 | 1592 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
363 | 373 | | |
364 | 374 | | |
365 | 375 | | |
| |||
370 | 380 | | |
371 | 381 | | |
372 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
373 | 395 | | |
374 | 396 | | |
375 | 397 | | |
376 | 398 | | |
377 | 399 | | |
378 | 400 | | |
| 401 | + | |
| 402 | + | |
379 | 403 | | |
380 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
381 | 423 | | |
382 | 424 | | |
383 | 425 | | |
| |||
0 commit comments