From 9dd30efc2e658d85ca1ad3843dc45cb439319c7c Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Fri, 15 May 2026 14:49:54 +0000 Subject: [PATCH] batch3 T1 review fixes: Pane discriminated union + index naming - Restructure Pane as a tagged union over kind so checking kind narrows state - Rename session_panes_session_idx -> idx_session_panes_session for naming consistency with idx_sessions_project, idx_messages_session Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/server/src/schema.sql | 2 +- apps/server/src/types/api.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/server/src/schema.sql b/apps/server/src/schema.sql index 66ca449..ef62af4 100644 --- a/apps/server/src/schema.sql +++ b/apps/server/src/schema.sql @@ -56,4 +56,4 @@ CREATE TABLE IF NOT EXISTS session_panes ( created_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(), UNIQUE (session_id, position) ); -CREATE INDEX IF NOT EXISTS session_panes_session_idx ON session_panes (session_id); +CREATE INDEX IF NOT EXISTS idx_session_panes_session ON session_panes (session_id); diff --git a/apps/server/src/types/api.ts b/apps/server/src/types/api.ts index 73068db..6ce6d80 100644 --- a/apps/server/src/types/api.ts +++ b/apps/server/src/types/api.ts @@ -91,15 +91,18 @@ export type ChatPaneState = Record; export type PaneState = ChatPaneState | FileBrowserPaneState; -export interface Pane { +interface PaneBase { id: string; session_id: string; position: number; - kind: PaneKind; - state: PaneState; created_at: string; } +export type Pane = PaneBase & ( + | { kind: 'chat'; state: ChatPaneState } + | { kind: 'file_browser'; state: FileBrowserPaneState } +); + export interface PaneCreateRequest { kind: PaneKind; position?: number; // optional; if omitted, append at end