|
Replace global lazy singletons with explicit AppContainer + lifespan
- Create navi/core/container.py with AppContainer dataclass and create_container() - Rewrite navi/api/deps.py: remove module-level singletons, add _container global fallback + set_container(), use _resolve_container() for all getters - Replace @app.on_event with @asynccontextmanager lifespan in main.py - Update routes to use Depends(get_scheduler) instead of calling get_scheduler() - Fix FastAPI body parsing bug: remove dataclass parameters from Depends getters (FastAPI was treating AppContainer sub-dependencies as Body params, forcing embed=True on all endpoint body params and causing 422 errors) - Update websocket.py to use _resolve_container() instead of get_registries() - Update integration test fixtures to build AppContainer and call set_container() - Remove obsolete tests/unit/test_startup.py (tests removed _on_startup) - Fix test_scheduler_loop.py fixture (get_registries no longer exists) All 387 tests pass (excluding websocket hang tests). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |
|---|
|
|
| navi/api/deps.py |
|---|
| navi/api/routes/admin.py |
|---|
| navi/api/routes/sessions.py |
|---|
| navi/api/websocket.py |
|---|
| navi/core/__init__.py |
|---|
| navi/core/container.py 0 → 100644 |
|---|
| navi/main.py |
|---|
| tests/integration/conftest.py |
|---|
| tests/integration/test_api_routes.py |
|---|
| tests/integration/test_scheduler_loop.py |
|---|
| tests/unit/test_startup.py 100644 → 0 |
|---|