From 1f85ecc8125321f8cf11f0f1ccc088737b580240 Mon Sep 17 00:00:00 2001 From: coder-bot Date: Mon, 17 Aug 2026 23:31:01 +0000 Subject: [PATCH] WIP checkpoint: Address review feedback: Scaffold FastAPI backend project structure --- backend/app/database.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/app/database.py b/backend/app/database.py index 095cf72..9d917b2 100644 --- a/backend/app/database.py +++ b/backend/app/database.py @@ -28,11 +28,15 @@ class Base(DeclarativeBase): async def get_db() -> AsyncSession: - """Dependency that yields an async database session.""" + """Dependency that yields an async database session. + + Handlers are responsible for committing or rolling back their own + transactions. This avoids the double-commit problem where the + session is committed both here and in the handler. + """ async with async_session_factory() as session: try: yield session - await session.commit() except Exception: await session.rollback() raise