[loop-cycle-1] refactor: split cascade.py into focused modules (#1342) #1448

Merged
Timmy merged 1 commits from refactor/split-cascade-py into main 2026-03-24 18:39:07 +00:00
Owner

Summary

Splits cascade.py (1241 lines) into 4 focused modules:

  • models.py (138 lines) — Data classes: ProviderStatus, CircuitState, ContentType, ProviderMetrics, ModelCapability, Provider, RouterConfig
  • health.py (137 lines) — HealthMixin: circuit breaker, health tracking, quota checks
  • providers.py (318 lines) — ProviderCallsMixin: API call methods for ollama, openai, anthropic, grok, vllm_mlx
  • cascade.py (718 lines) — Thin orchestrator inheriting from both mixins

Results

  • All 966 tests pass
  • All existing imports from cascade.py still work (re-exports maintained)
  • init.py exports unchanged
  • 42% reduction in cascade.py line count (1241 → 718)
  • Net overhead: only 70 lines (imports/re-exports)

Closes #1342

## Summary Splits `cascade.py` (1241 lines) into 4 focused modules: - **`models.py`** (138 lines) — Data classes: ProviderStatus, CircuitState, ContentType, ProviderMetrics, ModelCapability, Provider, RouterConfig - **`health.py`** (137 lines) — HealthMixin: circuit breaker, health tracking, quota checks - **`providers.py`** (318 lines) — ProviderCallsMixin: API call methods for ollama, openai, anthropic, grok, vllm_mlx - **`cascade.py`** (718 lines) — Thin orchestrator inheriting from both mixins ## Results - All 966 tests pass - All existing imports from cascade.py still work (re-exports maintained) - __init__.py exports unchanged - 42% reduction in cascade.py line count (1241 → 718) - Net overhead: only 70 lines (imports/re-exports) Closes #1342
Timmy added 1 commit 2026-03-24 18:38:52 +00:00
refactor: split cascade.py into 4 modules (models, health, providers, orchestrator)
Some checks failed
Tests / lint (pull_request) Failing after 8s
Tests / test (pull_request) Has been skipped
59520721be
- Extract data models (enums, dataclasses) to models.py (138 lines)
- Extract health/circuit breaker mixin to health.py (137 lines)
- Extract provider API calls mixin to providers.py (318 lines)
- Trim cascade.py to orchestrator with mixin inheritance (718 lines)
- All existing imports preserved via re-exports from cascade.py
- Update test patches to reference health._quota_monitor
- 966 tests pass, 0 failures
Timmy merged commit 8a7a34499c into main 2026-03-24 18:39:07 +00:00
Timmy deleted branch refactor/split-cascade-py 2026-03-24 18:39:08 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1448