test+fix: rewrite migrated-platform test imports; fix connected-check discovery, telegram extra precedence, prompt_choice import

- Sweep test imports gateway.platforms.{telegram,feishu,matrix,dingtalk,whatsapp}
  (+ telegram_network / feishu satellites) -> plugins.platforms.<x>.adapter
  across ~68 test files; both 'from X import' and 'from gateway.platforms import X'
  forms.
- _is_platform_connected now forces discover_plugins() before the registry
  lookup so get_connected_platforms() works on directly-constructed GatewayConfig
  (fixes dingtalk-recognised tests after its checker moved to the plugin).
- telegram _apply_yaml_config no longer re-emits generic shared-config keys
  (reply_prefix etc.) that _merge_platform_map already merges with top-level
  precedence, while still passing through telegram-specific extras (base_url).
- prompt_choice lives in hermes_cli.setup, not cli_output — fixed the import in
  feishu/dingtalk interactive_setup and the test patch target.
- test_setup_feishu rewritten to drive interactive_setup via the plugin.
This commit is contained in:
teknium1 2026-06-07 05:27:58 -07:00
parent 736ffb3bc1
commit f080fedf13
No known key found for this signature in database
66 changed files with 669 additions and 648 deletions

View file

@ -1565,9 +1565,9 @@ def interactive_setup() -> None:
lazy-imported so the plugin's module-load surface stays minimal.
"""
from hermes_cli.config import get_env_value, save_env_value
from hermes_cli.setup import prompt_choice
from hermes_cli.cli_output import (
prompt,
prompt_choice,
prompt_yes_no,
print_header,
print_success,

View file

@ -5300,9 +5300,9 @@ def interactive_setup() -> None:
_PLATFORMS["feishu"] dict. CLI helpers are lazy-imported.
"""
from hermes_cli.config import get_env_value, save_env_value
from hermes_cli.setup import prompt_choice
from hermes_cli.cli_output import (
prompt,
prompt_choice,
prompt_yes_no,
print_header,
print_info,

View file

@ -6252,8 +6252,21 @@ def _apply_yaml_config(yaml_cfg: dict, telegram_cfg: dict) -> dict | None:
for _key in ("guest_mode", "disable_link_previews", "observe_unmentioned_group_messages"):
if _key in telegram_cfg:
extras.setdefault(_key, telegram_cfg[_key])
# Pass through telegram-specific extra keys (e.g. base_url proxy override),
# but EXCLUDE the generic shared-config keys that _merge_platform_map in
# gateway/config.py already merges with correct top-level-over-nested
# precedence. The apply_yaml_config_fn dispatch merges our return via
# dict.update() (clobber), so re-emitting those generic keys here would
# undo that precedence (top-level losing to a nested-fallback block).
_GENERIC_MERGE_KEYS = {
"reply_prefix", "reply_in_thread", "reply_to_mode",
"unauthorized_dm_behavior", "notice_delivery", "require_mention",
"channel_skill_bindings", "channel_prompts", "gateway_restart_notification",
"allow_from", "allow_admin_from", "dm_policy", "group_policy",
}
for _k, _v in _telegram_extra.items():
extras.setdefault(_k, _v)
if _k not in _GENERIC_MERGE_KEYS:
extras.setdefault(_k, _v)
return extras or None