mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
chore(gateway): drop HOMEASSISTANT from /update allowlist (#40736)
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.
This commit is contained in:
parent
5b43bf7d02
commit
f4a73abbd0
2 changed files with 26 additions and 1 deletions
|
|
@ -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,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue