Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(sql-editor): truncate long connection names in the selector (#74326)

Steven Shults2c91a634ec1b
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index d7f679506fd0..3d16c915a21a 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5814,6 +5814,10 @@ snapshots:
hash: v1.k794b7964.77017514db35e3e357c05f6fa22aa864ae0bd2bb0053228c76ff022048fd1e3e.cHJ3Ov8xzBvR7HOK-RjCpjW1SbNP-ZKdOneMjgvo1_U
scenes-app-data-warehouse-settings-schemas--multi-schema--light:
hash: v1.k794b7964.5ffdf524ce0fccb08b6337e373019c4f8601698dbd2ed67c236128731535cce0.dCP7dQzs_qdpEswIIblxlI6tpTWrpUNYGke67f_ZzHc
+ scenes-app-data-warehouse-sql-editor--managed-warehouse-connection--dark:
+ hash: v1.k794b7964.d09b47ad01a9e133badd485b8d379f39d7fbff7f3e90fce5d8bda31dde99e854.Fz0b6MkRwO8N8vD_VmhzF3QTRE9CXUVbwZEd6QZ1h2g
+ scenes-app-data-warehouse-sql-editor--managed-warehouse-connection--light:
+ hash: v1.k794b7964.09e95ddff4424ba4d6435ea7b07a7347fddb55cd097f32738eb0cc3d5cfbfd3f.iICaMLjwq6Blk2kyDv4FA-tghl9Bi6fkPIVctuZQHDo
scenes-app-data-warehouse-sql-editor--top-tools-per-server--dark:
hash: v1.k794b7964.c5aa3840807ca349309a893b884ebc767c8fab70a82127532c1dae27d13f9f3d.51y_th6-WoFAlLgiWfsu6KUr3rxWjZzAbV84FIikvXQ
scenes-app-data-warehouse-sql-editor--top-tools-per-server--light:
diff --git a/frontend/src/scenes/data-warehouse/editor/ConnectionSelector.tsx b/frontend/src/scenes/data-warehouse/editor/ConnectionSelector.tsx
index 48117c68c02b..2f3715a8a415 100644
--- a/frontend/src/scenes/data-warehouse/editor/ConnectionSelector.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/ConnectionSelector.tsx
@@ -52,7 +52,11 @@ export function ConnectionSelector({ tabId }: ConnectionSelectorProps): JSX.Elem
<LemonSelect
size="small"
fullWidth
- className="flex-1"
+ // min-w-0 lets the flex item shrink past the label's min-content width, and
+ // truncateText ellipsizes the label — a long source name (e.g. "managed_warehouse
+ // (DuckDB)") otherwise wraps and spills out of the narrow database-tree sidebar.
+ className="flex-1 min-w-0"
+ truncateText={{ maxWidthClass: 'max-w-full' }}
value={connectionSelectorValue}
onChange={(nextValue) => {
if (!nextValue || nextValue === POSTHOG_WAREHOUSE) {
diff --git a/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx
index de4f4c6fa44d..7360aea9df5d 100644
--- a/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/SQLEditorScene.stories.tsx
@@ -80,6 +80,22 @@ const AVAILABLE_SOURCES = {
},
}
+// A managed warehouse's name is long enough to outgrow the database-tree sidebar, which is what made
+// the connection selector's label wrap and spill over the toolbar (support ticket 65030).
+// ManagedWarehouseConnection below is the visual-regression guard for that truncation.
+const MANAGED_WAREHOUSE_CONNECTION_ID = '01931b3a-0000-0000-0000-000000000001'
+const MANAGED_WAREHOUSE_CONNECTIONS = [
+ {
+ id: MANAGED_WAREHOUSE_CONNECTION_ID,
+ prefix: 'managed_warehouse',
+ engine: 'duckdb',
+ source_type: 'ManagedWarehouse',
+ access_method: 'direct',
+ supports_hogql: true,
+ description: null,
+ },
+]
+
const meta: Meta = {
component: App,
title: 'Scenes-App/Data Warehouse/SQL Editor',
@@ -122,3 +138,24 @@ export default meta
type Story = StoryObj<{}>
export const TopToolsPerServer: Story = {}
+
+// Selecting the managed warehouse puts its long name in the sidebar's connection selector, where it
+// has to ellipsize on one line rather than wrap or overflow into the Run button's toolbar.
+export const ManagedWarehouseConnection: Story = {
+ parameters: {
+ msw: {
+ mocks: {
+ get: {
+ '/api/projects/:team_id/external_data_sources/connections': () => [
+ 200,
+ MANAGED_WAREHOUSE_CONNECTIONS,
+ ],
+ '/api/projects/:team_id/external_data_sources/direct_connection_options': () => [200, []],
+ },
+ },
+ },
+ // The `c` hash param preselects the connection, so the selector renders the long label
+ // instead of the default "PostHog (ClickHouse)".
+ pageUrl: urls.sqlEditor({ query: SAMPLE_SQL, connectionId: MANAGED_WAREHOUSE_CONNECTION_ID }),
+ },
+}
diff --git a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.ts b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.ts
index 3c6b0c63e4b9..162208dc9753 100644
--- a/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.ts
+++ b/frontend/src/scenes/data-warehouse/editor/connectionSelectorLogic.test.ts
@@ -86,6 +86,32 @@ describe('connectionSelectorLogic', () => {
)
})
+ // Pins the label the ManagedWarehouseConnection story relies on — it's long enough to need
+ // truncating in the sidebar, which is the regression that story guards (support ticket 65030).
+ it('labels a managed warehouse with its prefix and engine', async () => {
+ mockConnectionsList.mockResolvedValue([
+ {
+ id: 'conn-duck',
+ prefix: 'managed_warehouse',
+ engine: 'duckdb',
+ source_type: 'ManagedWarehouse',
+ access_method: 'direct',
+ supports_hogql: true,
+ },
+ ])
+ logic = connectionSelectorLogic()
+ logic.mount()
+ logic.actions.maybeLoadConnectionOptions()
+
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(logic.values.connectionSelectOptions[0].options).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({ value: 'conn-duck', label: 'managed_warehouse (DuckDB)' }),
+ ])
+ )
+ })
+
it('derives the selected connection value from sql editor state', async () => {
expect(getConnectionSelectorValue(null, true, undefined)).toEqual(LOADING_CONNECTIONS)
expect(