From ba3bbf5b537610b9d8beec3a79b050f54abeb393 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 28 Mar 2026 14:05:02 -0700 Subject: [PATCH] fix: add missing mattermost/matrix/dingtalk toolsets + platform consistency tests (salvage #3512) (#3583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixing mattermost configuration parsing bugs * fix: add homeassistant to skills_config + platform consistency tests Follow-up for cherry-picked #3512: - Add homeassistant to skills_config.py PLATFORMS (was in tools_config but missing from skills_config) - Add 3 consistency tests that verify all platforms in tools_config have matching toolset definitions, gateway includes, and skills_config entries — prevents this class of bug from recurring --------- Co-authored-by: DaneelV3 --- hermes_cli/skills_config.py | 4 +++ hermes_cli/tools_config.py | 1 + tests/hermes_cli/test_tools_config.py | 50 +++++++++++++++++++++++++++ toolsets.py | 20 ++++++++++- 4 files changed, 74 insertions(+), 1 deletion(-) diff --git a/hermes_cli/skills_config.py b/hermes_cli/skills_config.py index d1d8d50a3..df08a815a 100644 --- a/hermes_cli/skills_config.py +++ b/hermes_cli/skills_config.py @@ -24,6 +24,10 @@ PLATFORMS = { "whatsapp": "📱 WhatsApp", "signal": "📡 Signal", "email": "📧 Email", + "homeassistant": "🏠 Home Assistant", + "mattermost": "💬 Mattermost", + "matrix": "💬 Matrix", + "dingtalk": "💬 DingTalk", } # ─── Config Helpers ─────────────────────────────────────────────────────────── diff --git a/hermes_cli/tools_config.py b/hermes_cli/tools_config.py index 35758cd15..4bb9b2c81 100644 --- a/hermes_cli/tools_config.py +++ b/hermes_cli/tools_config.py @@ -138,6 +138,7 @@ PLATFORMS = { "matrix": {"label": "💬 Matrix", "default_toolset": "hermes-matrix"}, "dingtalk": {"label": "💬 DingTalk", "default_toolset": "hermes-dingtalk"}, "api_server": {"label": "🌐 API Server", "default_toolset": "hermes-api-server"}, + "mattermost": {"label": "💬 Mattermost", "default_toolset": "hermes-mattermost"}, } diff --git a/tests/hermes_cli/test_tools_config.py b/tests/hermes_cli/test_tools_config.py index 6af9f6629..4a25e35ee 100644 --- a/tests/hermes_cli/test_tools_config.py +++ b/tests/hermes_cli/test_tools_config.py @@ -237,3 +237,53 @@ def test_save_platform_tools_still_preserves_mcp_with_platform_default_present() # Deselected configurable toolset removed assert "terminal" not in saved + + +# ── Platform / toolset consistency ──────────────────────────────────────────── + + +class TestPlatformToolsetConsistency: + """Every platform in tools_config.PLATFORMS must have a matching toolset.""" + + def test_all_platforms_have_toolset_definitions(self): + """Each platform's default_toolset must exist in TOOLSETS.""" + from hermes_cli.tools_config import PLATFORMS + from toolsets import TOOLSETS + + for platform, meta in PLATFORMS.items(): + ts_name = meta["default_toolset"] + assert ts_name in TOOLSETS, ( + f"Platform {platform!r} references toolset {ts_name!r} " + f"which is not defined in toolsets.py" + ) + + def test_gateway_toolset_includes_all_messaging_platforms(self): + """hermes-gateway includes list should cover all messaging platforms.""" + from hermes_cli.tools_config import PLATFORMS + from toolsets import TOOLSETS + + gateway_includes = set(TOOLSETS["hermes-gateway"]["includes"]) + # Exclude non-messaging platforms from the check + non_messaging = {"cli", "api_server"} + for platform, meta in PLATFORMS.items(): + if platform in non_messaging: + continue + ts_name = meta["default_toolset"] + assert ts_name in gateway_includes, ( + f"Platform {platform!r} toolset {ts_name!r} missing from " + f"hermes-gateway includes" + ) + + def test_skills_config_covers_tools_config_platforms(self): + """skills_config.PLATFORMS should have entries for all gateway platforms.""" + from hermes_cli.tools_config import PLATFORMS as TOOLS_PLATFORMS + from hermes_cli.skills_config import PLATFORMS as SKILLS_PLATFORMS + + non_messaging = {"api_server"} + for platform in TOOLS_PLATFORMS: + if platform in non_messaging: + continue + assert platform in SKILLS_PLATFORMS, ( + f"Platform {platform!r} in tools_config but missing from " + f"skills_config PLATFORMS" + ) diff --git a/toolsets.py b/toolsets.py index c9f39e75f..e1e780ef3 100644 --- a/toolsets.py +++ b/toolsets.py @@ -333,6 +333,24 @@ TOOLSETS = { "includes": [] }, + "hermes-mattermost": { + "description": "Mattermost bot toolset - self-hosted team messaging (full access)", + "tools": _HERMES_CORE_TOOLS, + "includes": [] + }, + + "hermes-matrix": { + "description": "Matrix bot toolset - decentralized encrypted messaging (full access)", + "tools": _HERMES_CORE_TOOLS, + "includes": [] + }, + + "hermes-dingtalk": { + "description": "DingTalk bot toolset - enterprise messaging platform (full access)", + "tools": _HERMES_CORE_TOOLS, + "includes": [] + }, + "hermes-sms": { "description": "SMS bot toolset - interact with Hermes via SMS (Twilio)", "tools": _HERMES_CORE_TOOLS, @@ -342,7 +360,7 @@ TOOLSETS = { "hermes-gateway": { "description": "Gateway toolset - union of all messaging platform tools", "tools": [], - "includes": ["hermes-telegram", "hermes-discord", "hermes-whatsapp", "hermes-slack", "hermes-signal", "hermes-homeassistant", "hermes-email", "hermes-sms"] + "includes": ["hermes-telegram", "hermes-discord", "hermes-whatsapp", "hermes-slack", "hermes-signal", "hermes-homeassistant", "hermes-email", "hermes-sms", "hermes-mattermost", "hermes-matrix", "hermes-dingtalk"] } }