3636@router .post ("/step" )
3737def step (
3838 request : ENautilusStepRequest ,
39- context : Annotated [
40- SessionContext ,
41- Depends (SessionContextGuard (require = [ContextField .PROBLEM ]))
42- ],
39+ context : Annotated [SessionContext , Depends (SessionContextGuard (require = [ContextField .PROBLEM ]))],
4340) -> ENautilusStepResponse :
4441 """Steps the E-NAUTILUS method."""
4542 db_session = context .db_session
@@ -244,7 +241,10 @@ def get_representative(
244241@router .post ("/finalize" )
245242def finalize_enautilus (
246243 request : ENautilusFinalizeRequest ,
247- context : Annotated [SessionContext , Depends (get_session_context )],
244+ context : Annotated [
245+ SessionContext ,
246+ Depends (SessionContextGuard (require = [ContextField .PROBLEM , ContextField .PARENT_STATE ])),
247+ ],
248248) -> ENautilusFinalizeResponse :
249249 """Finalize E-NAUTILUS by selecting the final solution.
250250
@@ -362,8 +362,7 @@ def finalize_enautilus(
362362
363363@router .get ("/session_tree/{session_id}" )
364364def get_session_tree (
365- session_id : int ,
366- db_session : Annotated [Session , Depends (get_session )],
365+ session_id : int , context : Annotated [SessionContext , Depends (SessionContextGuard ())]
367366) -> ENautilusSessionTreeResponse :
368367 """Extract the full E-NAUTILUS decision tree for a session.
369368
@@ -372,11 +371,13 @@ def get_session_tree(
372371
373372 Args:
374373 session_id: The interactive session ID.
375- db_session : The database session .
374+ context : The context of the query .
376375
377376 Returns:
378377 ENautilusSessionTreeResponse with nodes, edges, root_ids, and decision_events.
379378 """
379+ db_session = context .db_session
380+
380381 # Query step states
381382 step_stmt = (
382383 select (StateDB )
0 commit comments