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>
1 parent 0442efc commit 225742a953978a41dc9dd683448e04d959326039
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored on 18 May
Showing 11 changed files
View
navi/api/deps.py
View
navi/api/routes/admin.py
View
navi/api/routes/sessions.py
View
navi/api/websocket.py
View
navi/core/__init__.py
View
navi/core/container.py 0 → 100644
View
navi/main.py
View
tests/integration/conftest.py
View
tests/integration/test_api_routes.py
View
tests/integration/test_scheduler_loop.py
View
tests/unit/test_startup.py 100644 → 0