fix(ping): accept indigo.Dict results (live-smoke regression) - #31
Conversation
…ry real ping Live jarvis smoke: indigo.device.ping returns an indigo.Dict, which is dict-like but not a dict subclass, so the guard raised 'may not support ping' for every device. Duck-typed access with a TypeError/KeyError fallback keeps the descriptive error for genuinely unsupported devices. 350 tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EYAGXd4bE9D9Z5kZeSHeo7
📝 WalkthroughWalkthroughThe ping handler now accepts Indigo’s dict-like ping results, preserves success and timing output behavior, and raises ChangesPing compatibility and release metadata
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Indigo` MCP Lite.indigoPlugin/Contents/Server Plugin/tools/control.py:
- Around line 183-187: Update the exception handling around the ping result in
the device control function to explicitly chain the replacement ValueError,
using `from None` to keep the user-facing unsupported-device error clean.
Preserve the existing exception types and message.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f4547c76-1a60-4de9-9a9c-3bbb6828ea78
📒 Files selected for processing (4)
Indigo MCP Lite.indigoPlugin/Contents/Info.plistIndigo MCP Lite.indigoPlugin/Contents/Server Plugin/tools/control.pypyproject.tomltests/test_control_device_extras.py
| except (TypeError, KeyError, IndexError): | ||
| raise ValueError( | ||
| f"ping returned no result for device {device_id} — the device " | ||
| "may not support ping (Z-Wave/Insteon only)" | ||
| f"ping returned no usable result for device {device_id} — the " | ||
| "device may not support ping (Z-Wave/Insteon only)" | ||
| ) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Make exception chaining explicit.
Ruff B904 flags this raise inside an except block. Use from None to preserve the clean unsupported-device error, or from err if the original mapping failure should remain visible.
Suggested fix
- except (TypeError, KeyError, IndexError):
+ except (TypeError, KeyError, IndexError):
raise ValueError(
f"ping returned no usable result for device {device_id} — the "
"device may not support ping (Z-Wave/Insteon only)"
- )
+ ) from None📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| except (TypeError, KeyError, IndexError): | |
| raise ValueError( | |
| f"ping returned no result for device {device_id} — the device " | |
| "may not support ping (Z-Wave/Insteon only)" | |
| f"ping returned no usable result for device {device_id} — the " | |
| "device may not support ping (Z-Wave/Insteon only)" | |
| ) | |
| except (TypeError, KeyError, IndexError): | |
| raise ValueError( | |
| f"ping returned no usable result for device {device_id} — the " | |
| "device may not support ping (Z-Wave/Insteon only)" | |
| ) from None |
🧰 Tools
🪛 Ruff (0.15.21)
[warning] 184-187: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling
(B904)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Indigo` MCP Lite.indigoPlugin/Contents/Server Plugin/tools/control.py around
lines 183 - 187, Update the exception handling around the ping result in the
device control function to explicitly chain the replacement ValueError, using
`from None` to keep the user-facing unsupported-device error clean. Preserve the
existing exception types and message.
Source: Linters/SAST tools
Live jarvis smoke after the wave merge caught this:
indigo.device.pingreturns anindigo.Dict— dict-like, not adictsubclass — so theisinstance(result, dict)guard from the review hardening rejected every real ping with 'may not support ping'. Now duck-typed (result["Success"]with TypeError/KeyError fallback), keeping the descriptive error for genuinely unsupported devices. 350 tests (2 new incl. a dict-like fixture). 2026.6.0 → 2026.6.1.🤖 Generated with Claude Code
https://claude.ai/code/session_01EYAGXd4bE9D9Z5kZeSHeo7
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores