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) <noreply@anthropic.com>
This commit is contained in:
@@ -56,4 +56,4 @@ CREATE TABLE IF NOT EXISTS session_panes (
|
|||||||
created_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
|
created_at TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp(),
|
||||||
UNIQUE (session_id, position)
|
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);
|
||||||
|
|||||||
@@ -91,15 +91,18 @@ export type ChatPaneState = Record<string, never>;
|
|||||||
|
|
||||||
export type PaneState = ChatPaneState | FileBrowserPaneState;
|
export type PaneState = ChatPaneState | FileBrowserPaneState;
|
||||||
|
|
||||||
export interface Pane {
|
interface PaneBase {
|
||||||
id: string;
|
id: string;
|
||||||
session_id: string;
|
session_id: string;
|
||||||
position: number;
|
position: number;
|
||||||
kind: PaneKind;
|
|
||||||
state: PaneState;
|
|
||||||
created_at: string;
|
created_at: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Pane = PaneBase & (
|
||||||
|
| { kind: 'chat'; state: ChatPaneState }
|
||||||
|
| { kind: 'file_browser'; state: FileBrowserPaneState }
|
||||||
|
);
|
||||||
|
|
||||||
export interface PaneCreateRequest {
|
export interface PaneCreateRequest {
|
||||||
kind: PaneKind;
|
kind: PaneKind;
|
||||||
position?: number; // optional; if omitted, append at end
|
position?: number; // optional; if omitted, append at end
|
||||||
|
|||||||
Reference in New Issue
Block a user