Skip to content

chore(gateway): drop plugin-migrated platforms from /update allowlist#40711

Merged
teknium1 merged 1 commit into
mainfrom
hermes/ha-update-allowlist-32525
Jun 6, 2026
Merged

chore(gateway): drop plugin-migrated platforms from /update allowlist#40711
teknium1 merged 1 commit into
mainfrom
hermes/ha-update-allowlist-32525

Conversation

@teknium1

@teknium1 teknium1 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Drops Platform.DISCORD and Platform.MATTERMOST from the hardcoded _UPDATE_ALLOWED_PLATFORMS frozenset in gateway/run.py. Both are bundled plugins now (Discord #24356, Mattermost #31748) and declare allow_update_command=True on their PlatformEntry; _handle_update_command already falls back to the registry for platforms not in the frozenset. The double-allow becomes a single, load-bearing registry flag.

Salvage of #32525 by @kshitijk4poor onto current main (original branch was 1211 commits behind). Cherry-pick preserved authorship; cleanly re-verified.

Changes

  • gateway/run.py: remove Platform.DISCORD + Platform.MATTERMOST from _UPDATE_ALLOWED_PLATFORMS; Platform.HOMEASSISTANT retained (its migration is the sibling PR — drop it there)
  • tests/gateway/test_update_command.py: +5 cases pinning every branch of the allowlist gate (programmatic interfaces blocked, plugin platforms pass via registry fallback, built-ins still pass via frozenset)

Validation

Result
Registry flag discord/mattermost/teams/irc/line/google_chat/ntfy/simplex all allow_update_command=True
Frozenset DISCORD + MATTERMOST removed, HOMEASSISTANT retained
Tests 34 passed in test_update_command.py (+5 new gate-coverage cases)

Original PR: #32525

Infographic

home-assistant-bundled-plugin

`gateway/run.py::_UPDATE_ALLOWED_PLATFORMS` was a hardcoded frozenset
listing every messaging platform allowed to invoke the `/update` slash
command.  Plugin-migrated platforms (currently Discord and Mattermost,
soon also Home Assistant via #32500) declare `allow_update_command=True`
on their `PlatformEntry`, and `_handle_update_command` already falls
back to the registry when a platform isn't in the frozenset.  The result
was a silent redundancy: those entries said "allowed" twice, and the
registry flag was a no-op for them in practice.

  - Removed `Platform.DISCORD` and `Platform.MATTERMOST` from the frozenset.
  - Updated the docstring to make the split explicit (built-ins live in
    the frozenset; plugins use `allow_update_command` on the registry entry).

The remaining frozenset entries are all still built-in platforms living
under `gateway/platforms/` today.  Future plugin migrations should drop
their entry from the frozenset as part of the migration PR (or in a
sibling chore PR like this one).

Added a `TestUpdateCommandPlatformGate` test class that pins down all
three branches of the gate so future changes don't silently regress:

  - Programmatic interfaces (`Platform.WEBHOOK`, `Platform.API_SERVER`)
    must remain blocked.
  - Plugin-migrated platforms (Discord, Mattermost) must pass via the
    registry fallback.
  - Built-in platforms in the hardcoded frozenset (Telegram) must
    still pass without needing the registry.

The gate previously had zero direct test coverage — its only existing
coverage was `test_no_adapter_for_platform` which exercised a different
code path.
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/ha-update-allowlist-32525 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9962 on HEAD, 9962 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5167 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change P3 Low — cosmetic, nice to have comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins labels Jun 6, 2026
@teknium1 teknium1 merged commit ef7e516 into main Jun 6, 2026
30 of 31 checks passed
@teknium1 teknium1 deleted the hermes/ha-update-allowlist-32525 branch June 6, 2026 18:48
teknium1 added a commit that referenced this pull request Jun 7, 2026
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.
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
…ch#40736)

Home Assistant is a bundled plugin now (NousResearch#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 NousResearch#40711 did for Discord and
Mattermost. Adds a registry-fallback test mirroring the existing
discord/mattermost cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants