fix: retarget _send_dingtalk/_send_matrix tests to plugin _standalone_send + restore dingtalk token redaction

CI (test shard 6) caught tests/tools/test_send_message_missing_platforms.py
importing the removed _send_dingtalk/_send_matrix helpers. Added thin
pre-migration-shaped shims around the plugins' _standalone_send (same pattern
mattermost/HA used in this file). Also restored access_token redaction in the
dingtalk plugin's _standalone_send error path (the legacy _send_dingtalk
returned via _error() which redacts URL secrets; the bare plugin return leaked
the webhook access_token in exception text) by reusing send_message_tool._error
via lazy import.
This commit is contained in:
teknium1 2026-06-07 06:22:53 -07:00
parent f2a7adba54
commit 91da240eb8
No known key found for this signature in database
2 changed files with 31 additions and 4 deletions

View file

@ -1554,7 +1554,15 @@ async def _standalone_send(
return {"error": f"DingTalk API error: {data.get('errmsg', 'unknown')}"}
return {"success": True, "platform": "dingtalk", "chat_id": chat_id}
except Exception as e:
return {"error": f"DingTalk send failed: {e}"}
# Redact the access_token from webhook URLs that may appear in the
# exception text. Reuse send_message_tool._error's redaction so the
# logic stays single-sourced (lazy import avoids a circular at module
# load). Falls back to a plain message if that helper is unavailable.
try:
from tools.send_message_tool import _error as _redact_error
return _redact_error(f"DingTalk send failed: {e}")
except Exception:
return {"error": f"DingTalk send failed: {e}"}
def interactive_setup() -> None: