Commit f3d9ac3
fix(tools_integrations): address kp13 review subset (8 of 10 + 4 NITs)
Addresses 8 of kp13's 10 numbered review items + all 4 while-you're-in
bullets on PR #1424. Items 1 and 6 (Path 4 happy-path schema
harmonization and IDEMPOTENT-SUCCESS CONTRACT docstring rewrite) are
held pending the design-clarification response in issue-comment
4527825242.
Contract / schema:
- Drop the ``result`` passthrough key from Path 4 happy-path return
(no other path returns it). [Item 2]
Docstring / contract accuracy:
- Field descriptions for ``target``, ``helper_type``, ``subentry_id``,
``confirm`` switched from "delete"/"deletion" to "remove"/"removal"
to match the public tool verb. [Item 7]
- ``uniform for all three paths`` updated to ``four`` in both confirm
and empty/whitespace gates; Path 4 added to the empty-target gate's
enumeration. [Item 8]
- Stale ``ha_delete_helpers_integrations`` reference in
docs/superpowers/specs/2026-05-21-1288-auto-backup-design.md updated.
[Item 9]
Error handling:
- Narrowed ``_get_entry_id_for_flow_helper`` broad ``except Exception``
to ``(OSError, TimeoutError)``. KeyError/AttributeError/TypeError now
propagate so programmer bugs surface instead of being mis-classified
as ``WEBSOCKET_DISCONNECTED``. [Item 10]
Tests:
- Replaced the tautological OR-disjunct in
test_simple_path_non_404_apierror_propagates with two independent
assertions so a regression that leaks ``already_deleted`` into a
non-``ENTITY_NOT_FOUND`` code still fails. [Item 5a]
- Pass ``status_code=404`` to ``HomeAssistantAPIError`` in
test_simple_path_disabled_state_check_apierror_resolves_via_registry
— the test now actually exercises the 404 narrow it claims to cover.
[Item 5b]
- New test_direct_path_non_404_apierror_surfaces_structured_error pins
the Path 3 narrow (non-404 surfaces as structured error). [Item 4]
- New test_remove_helpers_integrations_subentry_string_error_surfaces_
service_call_failed pins the Path 4 dict-only narrow against
string-form ``"error": "not found"`` regressions. [Item 3]
While you're in there (Boy-Scout):
- Module comment near the private ``_delete_*`` helpers explaining the
prefix-asymmetry (HA backend verb vs public ``remove`` family).
- Tightened "three deletion kinds in four paths" phrasing.
- FLOW contract bullet now lists ``bare_id_not_supported`` as a third
failure mode (raises ``ENTITY_NOT_FOUND``).
- ``state_gone`` block comment compressed to one note about the
never-existed-target consequence of the APIError-404 branch.
76 affected unit tests pass locally; ruff clean on touched files.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 922a2ab commit f3d9ac3
4 files changed
Lines changed: 96 additions & 33 deletions
File tree
- docs/superpowers/specs
- src/ha_mcp/tools
- tests/src/unit
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| |||
1131 | 1137 | | |
1132 | 1138 | | |
1133 | 1139 | | |
1134 | | - | |
| 1140 | + | |
1135 | 1141 | | |
1136 | 1142 | | |
1137 | 1143 | | |
| |||
1149 | 1155 | | |
1150 | 1156 | | |
1151 | 1157 | | |
1152 | | - | |
| 1158 | + | |
1153 | 1159 | | |
1154 | 1160 | | |
1155 | 1161 | | |
| |||
1159 | 1165 | | |
1160 | 1166 | | |
1161 | 1167 | | |
1162 | | - | |
| 1168 | + | |
1163 | 1169 | | |
1164 | 1170 | | |
1165 | 1171 | | |
| |||
1168 | 1174 | | |
1169 | 1175 | | |
1170 | 1176 | | |
1171 | | - | |
| 1177 | + | |
1172 | 1178 | | |
1173 | 1179 | | |
1174 | 1180 | | |
| |||
1191 | 1197 | | |
1192 | 1198 | | |
1193 | 1199 | | |
1194 | | - | |
1195 | | - | |
1196 | | - | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
1197 | 1203 | | |
1198 | 1204 | | |
1199 | 1205 | | |
| |||
1227 | 1233 | | |
1228 | 1234 | | |
1229 | 1235 | | |
1230 | | - | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
1231 | 1239 | | |
1232 | 1240 | | |
1233 | 1241 | | |
| |||
1261 | 1269 | | |
1262 | 1270 | | |
1263 | 1271 | | |
1264 | | - | |
| 1272 | + | |
1265 | 1273 | | |
1266 | 1274 | | |
1267 | 1275 | | |
| |||
1279 | 1287 | | |
1280 | 1288 | | |
1281 | 1289 | | |
1282 | | - | |
| 1290 | + | |
1283 | 1291 | | |
1284 | 1292 | | |
1285 | 1293 | | |
1286 | | - | |
1287 | | - | |
1288 | | - | |
1289 | | - | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
1290 | 1299 | | |
1291 | 1300 | | |
1292 | 1301 | | |
| |||
1339 | 1348 | | |
1340 | 1349 | | |
1341 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1342 | 1357 | | |
1343 | 1358 | | |
1344 | 1359 | | |
| |||
1680 | 1695 | | |
1681 | 1696 | | |
1682 | 1697 | | |
1683 | | - | |
1684 | 1698 | | |
1685 | 1699 | | |
1686 | 1700 | | |
| |||
1806 | 1820 | | |
1807 | 1821 | | |
1808 | 1822 | | |
1809 | | - | |
1810 | | - | |
1811 | | - | |
1812 | | - | |
1813 | | - | |
1814 | | - | |
1815 | | - | |
1816 | | - | |
1817 | | - | |
1818 | | - | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
1819 | 1830 | | |
1820 | 1831 | | |
1821 | 1832 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
211 | 233 | | |
212 | 234 | | |
213 | 235 | | |
| |||
386 | 408 | | |
387 | 409 | | |
388 | 410 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
394 | 418 | | |
395 | 419 | | |
396 | 420 | | |
| |||
438 | 462 | | |
439 | 463 | | |
440 | 464 | | |
441 | | - | |
| 465 | + | |
442 | 466 | | |
443 | 467 | | |
444 | 468 | | |
| |||
0 commit comments