refactor: Phase 2a — consolidate dashboard routes (27→22 files)

Merge related route files to reduce sprawl:
- voice.py ← voice_enhanced.py (enhanced pipeline merged in)
- swarm.py ← swarm_internal.py + swarm_ws.py (internal API + WebSocket)
- self_coding.py ← self_modify.py (self-modify endpoints merged in)
- Delete mobile_test.py route + template (test-only page, not for prod)
- Delete test_xss_prevention.py (tested the deleted mobile_test page)

Update app.py to use consolidated imports.
Update test_voice_enhanced.py patch paths.
Remove mobile_test.py from coverage omit (file deleted).

27 route files → 22. Tests: 1502 passed (1 removed with deleted page).

https://claude.ai/code/session_019oMFNvD8uSGSSmBMGkBfQN
This commit is contained in:
Claude
2026-02-26 21:30:39 +00:00
parent 4e11dd2490
commit d2c80fbf4c
13 changed files with 275 additions and 1061 deletions

View File

@@ -1,4 +1,4 @@
"""Tests for dashboard/routes/voice_enhanced.py — enhanced voice processing."""
"""Tests for enhanced voice processing (merged into dashboard/routes/voice.py)."""
from unittest.mock import MagicMock, patch
@@ -56,7 +56,7 @@ class TestVoiceEnhancedProcess:
mock_run.content = "Hello from Timmy!"
mock_agent.run.return_value = mock_run
with patch("dashboard.routes.voice_enhanced.create_timmy", return_value=mock_agent):
with patch("dashboard.routes.voice.create_timmy", return_value=mock_agent):
resp = client.post(
"/voice/enhanced/process",
data={"text": "tell me about Bitcoin", "speak_response": "false"},
@@ -69,7 +69,7 @@ class TestVoiceEnhancedProcess:
def test_chat_fallback_error_handling(self, client):
"""When the agent raises, the error should be captured gracefully."""
with patch(
"dashboard.routes.voice_enhanced.create_timmy",
"dashboard.routes.voice.create_timmy",
side_effect=RuntimeError("Ollama offline"),
):
resp = client.post(