Commit 2eb3508
fix(tools_integrations): Path 4 idempotency keys on structured code only
Drop the generic ``"not found" in error_msg.lower()`` substring fallback
from the Path 4 (config subentry) idempotent-success branch. The check
now relies solely on the structured ``error_code == "not_found"`` from
the HA ``config_entries/subentries/delete`` response.
Generic substring matching was too permissive: HA error messages like
"Repository not found" or "Integration not found" returned by unrelated
failure modes would have silently classified as idempotent success,
masking real errors. The structured ``code: "not_found"`` is the
contract HA uses for this operation; if a future HA version emits a
different code, the tool surfaces SERVICE_CALL_FAILED rather than
mis-classifying — the safer default for a destructive operation.
Adopts Gemini Code Assist finding on PR #1424 (inline thread on the
substring check). Existing Path 4 unit test
(test_delete_helpers_integrations_subentry_not_found_is_idempotent)
mocks the response with ``code: "not_found"`` so it remains the canonical
contract pin; no test changes needed. Sibling-sweep across the other
three idempotent branches confirmed they already key on structured
discriminators (Path 1: state+registry probes, Path 2: lookup-helper
reason field, Path 3: HomeAssistantAPIError.status_code).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c13e064 commit 2eb3508
1 file changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1639 | 1639 | | |
1640 | 1640 | | |
1641 | 1641 | | |
1642 | | - | |
1643 | | - | |
1644 | | - | |
1645 | | - | |
1646 | | - | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
1647 | 1652 | | |
1648 | | - | |
| 1653 | + | |
1649 | 1654 | | |
1650 | 1655 | | |
1651 | 1656 | | |
| |||
0 commit comments