fix(terminal): avoid lazy-loading tool manifest in async websocket handler

The container-user resolver introduced in 9f72093 accessed
'tool_type.manifest', which triggers a SQLAlchemy lazy load inside the
async WebSocket coroutine and raises MissingGreenlet. Fetch the manifest
explicitly with db_session.get() instead, matching the pattern used in
instance_service.py.

- Replace relationship access with explicit async loads in
  _resolve_container_user().
- Add unit tests covering manifest, base-definition, legacy, and missing
  manifest cases.
- Update project map artifacts.

Quality gates: pytest tests/api tests/services/test_terminal_manager_multi.py tests/unit (247 passed), ruff check (clean).
This commit is contained in:
2026-06-19 11:48:41 +02:00
parent 19f91c085e
commit b32fea671f
18 changed files with 298 additions and 101 deletions
+7 -1
View File
@@ -2,7 +2,7 @@
dir: apps/api/tests
## role
Provides shared test infrastructure and fixtures for FastAPI API integration tests.
Provides shared pytest fixtures and test utilities for FastAPI application testing across the API test suite.
## parent
index: apps/api/.pi-map.index.md
map: apps/api/.pi-map.md
@@ -19,6 +19,12 @@ map: apps/api/.pi-map.md
- apps/api/tests/system
index: apps/api/tests/system/.pi-map.index.md
map: apps/api/tests/system/.pi-map.md
- apps/api/tests/test_routers
index: apps/api/tests/test_routers/.pi-map.index.md
map: apps/api/tests/test_routers/.pi-map.md
- apps/api/tests/tools
index: apps/api/tests/tools/.pi-map.index.md
map: apps/api/tests/tools/.pi-map.md
- apps/api/tests/unit
index: apps/api/tests/unit/.pi-map.index.md
map: apps/api/tests/unit/.pi-map.md