Remove RootContext — adopt handler constructor DI
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 368
Description
## Background
Manager API handlers currently depend on `RootContext`, a god object with ~50 fields. The goal is to eliminate this dependency by setting up all dependencies via `DependencyComposer` before server setup, then injecting only the required dependencies into each Handler constructor.
## Target State
```python
resources = await stack.enter_composer(ManagerDependencyComposer(), input)
session_handler = SessionHandler(
processors=resources.processing.processors,
registry=resources.agents.registry,
)
```
## Tracks
- **Track A (Composer Development)**: 7 independent Composer modules
- **Track B (Handler Conversion)**: function-based → class-based constructor DI
- **Track C (Integration)**: Composer integration + create_app() wiring + RootContext removal
## Phase Diagram
```
Phase 1 (parallel, 9 issues) Phase 2 (integration)
┌─ Plugins ────┐
├─ Messaging ──┤
├─ Domain ─────┤
├─ Agents ─────┼──→ Composer Integration ──┐
├─ Orchestr. ──┤ ├──→ Wire create_app() + Remove RootContext
├─ Processing ─┤ │
├─ System ─────┘ │
├─ Handlers 1 ────────────────────────────┤
└─ Handlers 2 ────────────────────────────┘
```
JIRA Issue: BA-4395
Contributor guide
Research direction
Start by mapping the Manager API handlers, RootContext, DependencyComposer, ManagerDependencyComposer, and create_app() wiring described in the issue. Review the three tracks and their dependencies before choosing a focused conversion task. Done means handlers receive only required constructor dependencies, create_app() uses the composer, and RootContext is removed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100