fix: resolve CI failures — SQLAlchemy mapper conflict and lint errors

- 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) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-27 11:51:18 +00:00
parent 1225b55786
commit 05f81d04df
4 changed files with 5 additions and 3 deletions

View File

@@ -247,6 +247,7 @@ class AISession(Base):
branches: Mapped[list["SessionBranch"]] = relationship( branches: Mapped[list["SessionBranch"]] = relationship(
"SessionBranch", "SessionBranch",
foreign_keys="SessionBranch.session_id", foreign_keys="SessionBranch.session_id",
back_populates="session",
cascade="all, delete-orphan", cascade="all, delete-orphan",
order_by="SessionBranch.branch_order", order_by="SessionBranch.branch_order",
) )

View File

@@ -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)) updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc))
# Relationships # 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]) 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]) 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]) status_changed_by_user: Mapped[Optional["User"]] = relationship("User", foreign_keys=[status_changed_by])

View File

@@ -29,7 +29,7 @@ test.describe('command palette smoke tests', () => {
test('searches and shows AI Assistant option', async ({ page }) => { test('searches and shows AI Assistant option', async ({ page }) => {
const api = await createAuthenticatedApiContext() const api = await createAuthenticatedApiContext()
const tree = await createTroubleshootingTree(api, { await createTroubleshootingTree(api, {
name: uniqueName('PW Palette Search Flow'), name: uniqueName('PW Palette Search Flow'),
}) })

View File

@@ -101,7 +101,8 @@ export function TaskLane({ questions, actions, onSubmit, onClose, loading }: Tas
} }
}, [handleMouseMove, handleMouseUp]) }, [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(() => { useEffect(() => {
setTasks([ setTasks([
...questions.map((q): QuestionResponse => ({ ...questions.map((q): QuestionResponse => ({