Fix timer action 500s after FastAPI upgrade

FastAPI 0.141 raises when response serialization hits a lazy-load
(current_block.subject.options) in async context, where 0.115 silently
skipped it. Eager-load Subject.options in session get/timer and the TV
dashboard queries. Pin pydantic 2.13.5.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
derekcandClaude Opus 5.5 committed 2026-09-24 23:51:10 -07:00
1 parent 4130467b22
commit 5a2510059d
5 files changed
+10 -4

No files matched your search

+1 -1
View File
@@ -39,7 +39,7 @@ async def get_dashboard(tv_token: int, db: AsyncSession = Depends(get_db)):
DailySession.session_date == date.today(),
DailySession.is_active == True,
)
.options(selectinload(DailySession.current_block))
.options(selectinload(DailySession.current_block).selectinload(ScheduleBlock.subject).selectinload(Subject.options))
.limit(1)
)
session = session_result.scalar_one_or_none()
+2 -2
View File
@@ -172,7 +172,7 @@ async def get_session(
select(DailySession)
.join(Child)
.where(DailySession.id == session_id, Child.user_id == current_user.id)
.options(selectinload(DailySession.current_block).selectinload(ScheduleBlock.subject))
.options(selectinload(DailySession.current_block).selectinload(ScheduleBlock.subject).selectinload(Subject.options))
)
session = result.scalar_one_or_none()
if not session:
@@ -191,7 +191,7 @@ async def timer_action(
select(DailySession)
.join(Child)
.where(DailySession.id == session_id, Child.user_id == current_user.id)
.options(selectinload(DailySession.current_block).selectinload(ScheduleBlock.subject))
.options(selectinload(DailySession.current_block).selectinload(ScheduleBlock.subject).selectinload(Subject.options))
)
session = result.scalar_one_or_none()
if not session:
+1
View File
@@ -9,6 +9,7 @@ PyJWT==2.15.0
cryptography==50.0.1
passlib[bcrypt]==1.7.4
bcrypt==3.2.2
pydantic==2.13.5
pydantic-settings==2.5.2
alembic==1.20.0
Mako==1.4.3