fix(mypy): narrow legacy approval task_id before dict key

This commit is contained in:
Abhimanyu Saharan
2026-02-12 10:37:10 +00:00
parent 8bd606a8dc
commit dce2061491

View File

@@ -196,10 +196,11 @@ async def pending_approval_conflicts_by_task(
legacy_statement = legacy_statement.where(col(Approval.id) != exclude_approval_id)
legacy_rows = list(await session.exec(legacy_statement))
for legacy_task_id, approval_id, _created_at in legacy_rows:
if legacy_task_id is None:
for legacy_task_id_opt, approval_id, _created_at in legacy_rows:
if legacy_task_id_opt is None:
continue
conflicts.setdefault(legacy_task_id, approval_id)
# mypy: SQL rows can include NULL task_id; guard before using as dict[UUID, UUID] key.
conflicts.setdefault(legacy_task_id_opt, approval_id)
return conflicts