From 05f81d04df8b7e4de16199f5b25a97e8a51c3323 Mon Sep 17 00:00:00 2001 From: chihlasm Date: Fri, 27 Mar 2026 11:51:18 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20CI=20failures=20=E2=80=94=20SQ?= =?UTF-8?q?LAlchemy=20mapper=20conflict=20and=20lint=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add back_populates to SessionBranch.session ↔ AISession.branches to fix SQLAlchemy InvalidRequestError that broke all backend tests - Remove unused 'tree' variable in command-palette.spec.ts - Suppress setState-in-effect lint rule in TaskLane (intentional sync) Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/app/models/ai_session.py | 1 + backend/app/models/session_branch.py | 2 +- frontend/e2e/command-palette.spec.ts | 2 +- frontend/src/components/assistant/TaskLane.tsx | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/app/models/ai_session.py b/backend/app/models/ai_session.py index 85d5ef4e..3cc3f11d 100644 --- a/backend/app/models/ai_session.py +++ b/backend/app/models/ai_session.py @@ -247,6 +247,7 @@ class AISession(Base): branches: Mapped[list["SessionBranch"]] = relationship( "SessionBranch", foreign_keys="SessionBranch.session_id", + back_populates="session", cascade="all, delete-orphan", order_by="SessionBranch.branch_order", ) diff --git a/backend/app/models/session_branch.py b/backend/app/models/session_branch.py index a6e648f1..6bdb8655 100644 --- a/backend/app/models/session_branch.py +++ b/backend/app/models/session_branch.py @@ -51,7 +51,7 @@ class SessionBranch(Base): updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), onupdate=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="branches") parent_branch: Mapped[Optional["SessionBranch"]] = relationship("SessionBranch", remote_side="SessionBranch.id", foreign_keys=[parent_branch_id]) fork_point_step: Mapped[Optional["AISessionStep"]] = relationship("AISessionStep", foreign_keys=[fork_point_step_id]) status_changed_by_user: Mapped[Optional["User"]] = relationship("User", foreign_keys=[status_changed_by]) diff --git a/frontend/e2e/command-palette.spec.ts b/frontend/e2e/command-palette.spec.ts index 7461cc98..f059b984 100644 --- a/frontend/e2e/command-palette.spec.ts +++ b/frontend/e2e/command-palette.spec.ts @@ -29,7 +29,7 @@ test.describe('command palette smoke tests', () => { test('searches and shows AI Assistant option', async ({ page }) => { const api = await createAuthenticatedApiContext() - const tree = await createTroubleshootingTree(api, { + await createTroubleshootingTree(api, { name: uniqueName('PW Palette Search Flow'), }) diff --git a/frontend/src/components/assistant/TaskLane.tsx b/frontend/src/components/assistant/TaskLane.tsx index 22423b75..956291ef 100644 --- a/frontend/src/components/assistant/TaskLane.tsx +++ b/frontend/src/components/assistant/TaskLane.tsx @@ -101,7 +101,8 @@ export function TaskLane({ questions, actions, onSubmit, onClose, loading }: Tas } }, [handleMouseMove, handleMouseUp]) - // Reset when new tasks come in + // Reset when new tasks come in from AI response + // eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: syncs derived state from prop changes useEffect(() => { setTasks([ ...questions.map((q): QuestionResponse => ({