Commit 466ce2c
committed
fix: widen WS not-found substring check to "doesn't exist" phrasing
PR #1397 CI on commit 70b9edf failed both required-trio E2E lanes:
AssertionError: Expected error code RESOURCE_NOT_FOUND, got:
{'code': 'SERVICE_CALL_FAILED', 'message': "Failed to delete category:
Command failed: Category ID doesn't exist", ...}
HA Core's category-registry remove path surfaces the not-found case
with the phrasing ``Category ID doesn't exist`` — not ``not found``.
The KP13-review-item-4 substring check at the six mutation sites
(``tools_zones.py:317/404``, ``tools_labels.py:249/338``,
``tools_categories.py:255/361``) only matched ``"not found"``, so the
branch fell through to ``SERVICE_CALL_FAILED`` against the live HA
test container.
Widened the check to accept either phrasing at all six sites:
if "not found" in error_str or "doesn't exist" in error_str:
Mirrors the pre-#1297 ``test_category_crud.py`` assertion which already
accepted both phrasings (``"doesn't exist" in error_msg or "not found"
in error_msg``) — that's the empirical signal that both forms are in
HA's WS-bridge vocabulary across this surface.
New unit test ``test_remove_with_doesnt_exist_phrasing`` in
``TestCategoryMutationRoutesNotFoundToResourceNotFound`` pins the
``"doesn't exist"`` branch directly against the same mock shape that
HA Core returned in CI.1 parent 70b9edf commit 466ce2c
4 files changed
Lines changed: 25 additions & 6 deletions
File tree
- src/ha_mcp/tools
- tests/src/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
255 | | - | |
| 255 | + | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | | - | |
| 404 | + | |
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
343 | 362 | | |
344 | 363 | | |
345 | 364 | | |
| |||
0 commit comments