feat(l1): FlowProposal l1_session_id source linkage (nullable source_session_id + exactly-one check)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 15:34:05 -04:00
parent 9a5cbc35ae
commit 0796874376
5 changed files with 113 additions and 7 deletions

View File

@@ -139,4 +139,9 @@ class L1WalkSession(Base):
account: Mapped["Account"] = relationship("Account")
created_by: Mapped["User"] = relationship("User", foreign_keys=[created_by_user_id])
flow: Mapped[Optional["Tree"]] = relationship("Tree")
flow_proposal: Mapped[Optional["FlowProposal"]] = relationship("FlowProposal")
# Two FK paths exist between L1WalkSession and FlowProposal
# (L1WalkSession.flow_proposal_id here, FlowProposal.l1_session_id there),
# so each relationship must name its foreign_keys explicitly.
flow_proposal: Mapped[Optional["FlowProposal"]] = relationship(
"FlowProposal", foreign_keys="[L1WalkSession.flow_proposal_id]"
)