Skip to content

Commit 765d164

Browse files
committed
refactor(BA-5712): address slice D review feedback
- repositories/session/creators.py: docstring pointed to a non-existent ``owner_id`` attribute on SessionRow; clarify that the scope_id comes from ``user_uuid`` (the owner's UUID). - repositories/session/db_source/db_source.py: drop the redundant ``session_row.user_uuid is not None`` guard (the column is non-nullable); update the ``_find_dependent_sessions`` docstring to reference ``owner_id`` instead of the removed ``access_key`` param.
1 parent 207f7a9 commit 765d164

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/ai/backend/manager/repositories/session/creators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class SessionRowCreatorSpec(CreatorSpec[SessionRow]):
1717
This spec is designed for retrofitting existing code that already builds
1818
SessionRow instances. It simply returns the provided row in build_row().
1919
20-
For scope information needed by RBACEntityCreator, use the row's owner_id
21-
field as the scope_id with ScopeType.USER.
20+
For scope information needed by RBACEntityCreator, use the row's user_uuid
21+
field (the owner's UUID) as the scope_id with ScopeType.USER.
2222
"""
2323

2424
row: SessionRow

src/ai/backend/manager/repositories/session/db_source/db_source.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ async def modify_session(
305305
if session_row is None:
306306
raise SessionNotFound(f"Session not found (id:{session_id})")
307307

308-
if session_name and session_row.user_uuid is not None:
308+
if session_name:
309+
# ``SessionRow.user_uuid`` is non-nullable, so we only need to
310+
# gate on whether a new name was provided.
309311
# Check the owner of the target session has any session with the same name
310312
try:
311313
sess = await SessionRow.get_session(
@@ -379,7 +381,7 @@ async def _find_dependent_sessions(
379381
380382
:param db_sess: Database session
381383
:param root_session_name_or_id: Root session name or ID
382-
:param access_key: Access key of the session owner
384+
:param owner_id: UUID of the session owner
383385
:param allow_stale: Whether to allow stale sessions
384386
:return: Tuple of (root_session_id, set of dependent session IDs)
385387
"""

0 commit comments

Comments
 (0)