fix: add back_populates to SessionHandoff and SessionResolutionOutput relationships

SQLAlchemy SAWarning about overlapping relationships was promoted to
an error by pytest filterwarnings=error, crashing mapper initialization
and causing 500s on every request — cascading to 423+ test failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-27 17:46:07 +00:00
parent c7abe905f7
commit e130976803
3 changed files with 4 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ class SessionHandoff(Base):
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
# Relationships
session: Mapped["AISession"] = relationship("AISession", foreign_keys=[session_id])
session: Mapped["AISession"] = relationship("AISession", foreign_keys=[session_id], back_populates="handoffs")
handed_off_by_user: Mapped["User"] = relationship("User", foreign_keys=[handed_off_by])
source_branch: Mapped[Optional["SessionBranch"]] = relationship("SessionBranch", foreign_keys=[source_branch_id])
claimed_by_user: Mapped[Optional["User"]] = relationship("User", foreign_keys=[claimed_by])