Skip to content

fix(ping): accept indigo.Dict results (live-smoke regression) - #31

Merged
simons-plugins merged 1 commit into
mainfrom
fix/ping-indigo-dict
Jul 22, 2026
Merged

fix(ping): accept indigo.Dict results (live-smoke regression)#31
simons-plugins merged 1 commit into
mainfrom
fix/ping-indigo-dict

Conversation

@simons-plugins

@simons-plugins simons-plugins commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Live jarvis smoke after the wave merge caught this: indigo.device.ping returns an indigo.Dict — dict-like, not a dict subclass — so the isinstance(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

    • Improved device ping compatibility for Indigo responses that behave like dictionaries.
    • Ping results now continue to report success status and response time when supported.
  • Bug Fixes

    • Improved handling of unsupported or invalid ping responses with a clear error.
  • Tests

    • Added coverage for dictionary-like ping responses.
  • Chores

    • Updated the application and package version to 2026.6.1.

…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
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The ping handler now accepts Indigo’s dict-like ping results, preserves success and timing output behavior, and raises ValueError for unusable results. Tests cover the new mapping behavior, while package and plugin versions are bumped to 2026.6.1.

Changes

Ping compatibility and release metadata

Layer / File(s) Summary
Duck-typed ping result handling
Indigo MCP Lite.indigoPlugin/Contents/Server Plugin/tools/control.py, tests/test_control_device_extras.py
_ping_handler reads Success and TimeDelta through indexing, supports non-dict mappings, and includes coverage for valid and invalid ping results.
Release version metadata
pyproject.toml, Indigo MCP Lite.indigoPlugin/Contents/Info.plist
Package and plugin version values are updated from 2026.6.0 to 2026.6.1.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: ping now accepts indigo.Dict results and notes the regression context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ping-indigo-dict

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6fe3271 and 4c8ff5d.

📒 Files selected for processing (4)
  • Indigo MCP Lite.indigoPlugin/Contents/Info.plist
  • Indigo MCP Lite.indigoPlugin/Contents/Server Plugin/tools/control.py
  • pyproject.toml
  • tests/test_control_device_extras.py

Comment on lines +183 to 187
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)"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Suggested change
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

@simons-plugins
simons-plugins merged commit 47f6f36 into main Jul 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant