mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-29 06:31:32 +00:00
refactor: remove dead code — 1,784 lines across 77 files (#9180)
Deep scan with vulture, pyflakes, and manual cross-referencing identified: - 41 dead functions/methods (zero callers in production) - 7 production-dead functions (only test callers, tests deleted) - 5 dead constants/variables - ~35 unused imports across agent/, hermes_cli/, tools/, gateway/ Categories of dead code removed: - Refactoring leftovers: _set_default_model, _setup_copilot_reasoning_selection, rebuild_lookups, clear_session_context, get_logs_dir, clear_session - Unused API surface: search_models_dev, get_pricing, skills_categories, get_read_files_summary, clear_read_tracker, menu_labels, get_spinner_list - Dead compatibility wrappers: schedule_cronjob, list_cronjobs, remove_cronjob - Stale debug helpers: get_debug_session_info copies in 4 tool files (centralized version in debug_helpers.py already exists) - Dead gateway methods: send_emote, send_notice (matrix), send_reaction (bluebubbles), _normalize_inbound_text (feishu), fetch_room_history (matrix), _start_typing_indicator (signal), parse_feishu_post_content - Dead constants: NOUS_API_BASE_URL, SKILLS_TOOL_DESCRIPTION, FILE_TOOLS, VALID_ASPECT_RATIOS, MEMORY_DIR - Unused UI code: _interactive_provider_selection, _interactive_model_selection (superseded by prompt_toolkit picker) Test suite verified: 609 tests covering affected files all pass. Tests for removed functions deleted. Tests using removed utilities (clear_read_tracker, MEMORY_DIR) updated to use internal APIs directly.
This commit is contained in:
parent
a66fc1365d
commit
8d023e43ed
77 changed files with 44 additions and 1784 deletions
|
|
@ -1831,45 +1831,4 @@ class TestMatrixPresence:
|
|||
assert result is False
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Emote & notice
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class TestMatrixMessageTypes:
|
||||
def setup_method(self):
|
||||
self.adapter = _make_adapter()
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_emote(self):
|
||||
"""send_emote should call send_message_event with m.emote."""
|
||||
mock_client = MagicMock()
|
||||
# mautrix returns EventID string directly
|
||||
mock_client.send_message_event = AsyncMock(return_value="$emote1")
|
||||
self.adapter._client = mock_client
|
||||
|
||||
result = await self.adapter.send_emote("!room:ex", "waves hello")
|
||||
assert result.success is True
|
||||
assert result.message_id == "$emote1"
|
||||
call_args = mock_client.send_message_event.call_args
|
||||
content = call_args.args[2] if len(call_args.args) > 2 else call_args.kwargs.get("content")
|
||||
assert content["msgtype"] == "m.emote"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_notice(self):
|
||||
"""send_notice should call send_message_event with m.notice."""
|
||||
mock_client = MagicMock()
|
||||
mock_client.send_message_event = AsyncMock(return_value="$notice1")
|
||||
self.adapter._client = mock_client
|
||||
|
||||
result = await self.adapter.send_notice("!room:ex", "System message")
|
||||
assert result.success is True
|
||||
assert result.message_id == "$notice1"
|
||||
call_args = mock_client.send_message_event.call_args
|
||||
content = call_args.args[2] if len(call_args.args) > 2 else call_args.kwargs.get("content")
|
||||
assert content["msgtype"] == "m.notice"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_emote_empty_text(self):
|
||||
self.adapter._client = MagicMock()
|
||||
result = await self.adapter.send_emote("!room:ex", "")
|
||||
assert result.success is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue