From f4a73abbd01831888afc297cd80ff3d9fd32b008 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Sat, 6 Jun 2026 18:25:43 -0700 Subject: [PATCH] chore(gateway): drop HOMEASSISTANT from /update allowlist (#40736) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Home Assistant is a bundled plugin now (#40709) and declares allow_update_command=True on its PlatformEntry. The registry fallback in _handle_update_command already covers it, so the frozenset entry is a redundant double-allow — same cleanup #40711 did for Discord and Mattermost. Adds a registry-fallback test mirroring the existing discord/mattermost cases. --- gateway/run.py | 2 +- tests/gateway/test_update_command.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gateway/run.py b/gateway/run.py index dc8e0f14cc0..4faaa0dabe8 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -14976,7 +14976,7 @@ class GatewayRunner: _UPDATE_ALLOWED_PLATFORMS = frozenset({ Platform.TELEGRAM, Platform.SLACK, Platform.WHATSAPP, Platform.SIGNAL, Platform.MATRIX, - Platform.HOMEASSISTANT, Platform.EMAIL, Platform.SMS, Platform.DINGTALK, + Platform.EMAIL, Platform.SMS, Platform.DINGTALK, Platform.FEISHU, Platform.WECOM, Platform.WECOM_CALLBACK, Platform.WEIXIN, Platform.BLUEBUBBLES, Platform.QQBOT, Platform.LOCAL, }) diff --git a/tests/gateway/test_update_command.py b/tests/gateway/test_update_command.py index 39d805edb49..17c466f9612 100644 --- a/tests/gateway/test_update_command.py +++ b/tests/gateway/test_update_command.py @@ -468,6 +468,31 @@ class TestUpdateCommandPlatformGate: assert "only available from messaging platforms" not in result + @pytest.mark.asyncio + async def test_allows_homeassistant_via_registry_fallback(self, monkeypatch): + """Same as DISCORD/MATTERMOST: HOMEASSISTANT is now plugin-migrated + (PR #40709) and not in the hardcoded frozenset; the registry must + keep /update working via ``allow_update_command=True``. + """ + from gateway.run import GatewayRunner + + assert Platform.HOMEASSISTANT not in GatewayRunner._UPDATE_ALLOWED_PLATFORMS + + from hermes_cli.plugins import PluginManager + PluginManager().discover_and_load(force=True) + from gateway.platform_registry import platform_registry + ha_entry = platform_registry.get("homeassistant") + assert ha_entry is not None + assert ha_entry.allow_update_command is True + + runner = _make_runner() + event = _make_event(platform=Platform.HOMEASSISTANT) + monkeypatch.setenv("HERMES_MANAGED", "") + + result = await runner._handle_update_command(event) + + assert "only available from messaging platforms" not in result + @pytest.mark.asyncio async def test_allows_builtin_platform_in_allowlist(self, monkeypatch): """``Platform.TELEGRAM`` is in the hardcoded allowlist — gate