Skip to content

Phase 4.5: Extract all remaining admin endpoints from orchestrator#572

Merged
shikhalev merged 1 commit intomainfrom
server/phase-4.5-admin-endpoints
Mar 13, 2026
Merged

Phase 4.5: Extract all remaining admin endpoints from orchestrator#572
shikhalev merged 1 commit intomainfrom
server/phase-4.5-admin-endpoints

Conversation

@shikhalev
Copy link
Collaborator

Summary

The final (and largest) step of orchestrator endpoint extraction. All 52 inline @app endpoints removed.

Extracted 17 unique endpoints into 3 new routers:

  • modules/speech/router_voices.py — voice selection + test (/admin/voices, /admin/voice, /admin/voice/test), 4 endpoints
  • modules/llm/router_models.py — HuggingFace model management (/admin/models/*), 10 endpoints
  • modules/monitoring/router_logs.py — log viewing + SSE streaming (/admin/logs/*), 3 endpoints

Removed 35 dead duplicate endpoints:

  • 25 LLM endpoints (shadowed by modules/llm/router.py)
  • 6 monitoring endpoints (shadowed by modules/monitoring/router_monitor.py)
  • 6 services endpoints (shadowed by modules/speech/router_services.py)

Also cleaned up:

  • 18 dead Pydantic model classes
  • get_current_tts_service() helper
  • 16 unused imports
Metric Before After Change
orchestrator.py lines 2471 1121 -1350 (-55%)
Inline @app endpoints 52 0 -52
Total Phase 4 reduction 4287 1121 -3166 (-74%)

orchestrator.py now contains only: imports, middleware setup, router registration, global service variables, startup/shutdown lifecycle, and static file serving.

Test plan

  • ruff check passes on all changed files
  • ruff format --check passes
  • pytest tests/ — all 65 tests pass
  • Zero inline @app.get/post/put/delete endpoints remain
  • Verify /admin/voices returns voice list
  • Verify /admin/models/list returns models
  • Verify /admin/logs returns log list
  • Verify all previously-duplicate endpoints still work via module routers

Closes #550

🤖 Generated with Claude Code

Phase 4.5 of orchestrator decomposition (Strangler Fig):

Extract 17 unique endpoints into 3 new routers:
- modules/speech/router_voices.py: voice selection + test (4 endpoints)
- modules/llm/router_models.py: HuggingFace model management (10 endpoints)
- modules/monitoring/router_logs.py: log viewing + SSE streaming (3 endpoints)

Remove 35 dead duplicate endpoints that were shadowed by module routers:
- 25 LLM endpoints (duplicated in modules/llm/router.py)
- 6 monitoring endpoints (duplicated in modules/monitoring/router_monitor.py)
- 6 services endpoints (duplicated in modules/speech/router_services.py)

Also removed: 18 dead Pydantic models, get_current_tts_service() helper,
and 16 unused imports (time, Dict, List, Depends, HTTPException, FileResponse,
StreamingResponse, BaseModel, User, get_current_user, require_permission,
PROVIDER_TYPES, async_audit_logger, get_model_manager, get_service_manager,
get_system_monitor).

Orchestrator: 2471 → 1121 lines (-1350, -55%)
Zero inline @app endpoints remain — only startup/shutdown + static files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shikhalev shikhalev merged commit edb43de into main Mar 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 4.5: Оставшиеся admin endpoints → domain routers

1 participant