test(dingtalk): cover get_connected_platforms + null platform_toolsets

Follow-ups to the salvaged commits in this PR:

* gateway/config.py — strip trailing whitespace from youngDoo's diff
  (line 315 had ~140 trailing spaces).

* hermes_cli/tools_config.py — replace `config.get("platform_toolsets", {})`
  with `config.get("platform_toolsets") or {}`. Handles the case where the
  YAML key is present but explicitly null (parses as None, previously
  crashed with AttributeError on the next line's .get(platform)).
  Cherry-picked from yyq4193's #9003 with attribution.

* tests/gateway/test_config.py — 4 new tests for TestGetConnectedPlatforms
  covering DingTalk via extras, via env vars, disabled, and missing creds.

* tests/hermes_cli/test_tools_config.py — regression test for the null
  platform_toolsets edge case.

* scripts/release.py — add kagura-agent, youngDoo, yyq4193 to AUTHOR_MAP.

Co-authored-by: yyq4193 <39405770+yyq4193@users.noreply.github.com>
This commit is contained in:
Teknium 2026-04-17 05:40:44 -07:00 committed by Teknium
parent 47a0dd1024
commit c60b6dc317
5 changed files with 62 additions and 2 deletions

View file

@ -40,6 +40,19 @@ def test_get_platform_tools_preserves_explicit_empty_selection():
assert enabled == set()
def test_get_platform_tools_handles_null_platform_toolsets():
"""YAML `platform_toolsets:` with no value parses as None — the old
``config.get("platform_toolsets", {})`` pattern would then crash with
``NoneType has no attribute 'get'`` on the next line. Guard against that.
"""
config = {"platform_toolsets": None}
enabled = _get_platform_tools(config, "cli")
# Falls through to defaults instead of raising
assert enabled
def test_platform_toolset_summary_uses_explicit_platform_list():
config = {}