Skip to content

feat(studio): SQL editor logs source — toolbar UI + creation flow - #48452

Merged
charislam merged 3 commits into
masterfrom
charislam/toolbar-ui-creation-flow
Jul 30, 2026
Merged

charislam merged 3 commits into
masterfrom
charislam/toolbar-ui-creation-flow

Conversation

@charislam

@charislam charislam commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

What

PR 6 of the SQL-editor "query source (Database vs Logs)" stack (builds on the merged PR 5, #48414). Adds the user-facing toolbar surface for the logs query source and consolidates the SQL-editor toolbar into a single source menu.

Everything stays behind sqlEditorLogsSource + otelLegacyLogs (dual-flag gated); with the flags off the toolbar is unchanged.

Changes

  • Consolidated source menu (QuerySourceMenu) — one Database ▾ / Logs ▾ dropdown that both labels the snippet's source and hosts the source-specific controls as flyout submenus:
    • Database: database selector (Primary / read replicas), Run as (role impersonation), and Row limit.
    • Logs: Time range — the same relative presets as the Logs Explorer plus a Custom range… calendar dialog.
  • Source is immutable — the Database/Logs rows aren't a toggle. An existing (materialized) snippet opens a fresh tab of the target source (never reinterpreting a query against the wrong backend); a blank new tab re-flavors in place. Extracted as the pure, unit-tested resolveSourceSwitch.
  • New-snippet-with-source threaded through /sql/new?source=, the nav "Create a new logs query" entry, and the duplicate flow. Logs snippets hide the (db-dialect) Export action.
  • Run-affordance guard — the Run button is disabled + annotated for a logs snippet on a non-ClickHouse org (sits above PR 5's execution short-circuit).
  • Retention entitlement gating — both preset and custom logs ranges past log.retention_days surface the upgrade prompt instead of applying silently. Prettify is disabled for logs (sql-formatter mangles ClickHouse).

Tests

  • querySource.test.ts — logDateRangesEqual (structural relative/absolute matching, incl. the "Last hour" vs "Last 1 hour" label case).
  • QuerySourceMenu.utils.test.ts — resolveSourceSwitch push-vs-replace / no-op behavior.

pnpm --filter studio typecheck · lint:ratchet · Prettier · SQL editor suite (307 tests) all green.

For reviewers

To test manually, enable the sqlEditorLogsSource feature flag for yourself on local/staging. There is no nav for Log SQL snippets currently (that is by design, this PR is big enough as-is), so to check an existing logs snippet, you can create one using the existing Logs Explorer, copy its UUID, and force navigate to that snippet in the SQL editor via URL.

Summary by CodeRabbit

  • New Features
    • Added support for creating and switching between database and logs queries.
    • Added log time-range presets and custom date-range selection.
    • Added database, run-as role, and row-limit controls.
    • Added read-replica selection, including options to create a new replica when available.
  • Improvements
    • Added clearer explanations when query execution is unavailable.
    • Disabled SQL formatting and query export where unsupported for logs queries.

Add the toolbar surface for the logs query source alongside database:
QuerySourceIndicator, LogsRangePicker, source-aware UtilityActions
gating (hide db selector/role/limit, show range picker, disable
prettify), a run-affordance gate for non-ClickHouse orgs, and
new-snippet-with-source threading through /sql/new, the nav new-query
flow, and the duplicate flow. Logs snippets hide the db-only Export
action. Dual-flag gated (sqlEditorLogsSource + otelLegacyLogs).
Replace the scattered QuerySourceIndicator + separate db selector / role /
limit / range-picker toolbar controls with a single consolidated source
dropdown (Database ▾ / Logs ▾). It labels the snippet source and hosts the
source-specific controls as flyout submenus: database selector, role
impersonation, and row limit for a database snippet; a time-range submenu
(presets + a custom-range calendar dialog) for a logs snippet.

Switching source respects immutability — an existing snippet opens a fresh
tab of the target source, while a blank new tab re-flavors in place. Both
preset and custom logs ranges gate on the log.retention_days entitlement and
surface the upgrade prompt past retention.
@charislam
charislam requested a review from a team as a code owner July 29, 2026 17:24
@supabase

supabase Bot commented Jul 29, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@vercel

vercel Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview Jul 30, 2026 9:14am
docs Ready Ready Preview, v0 Jul 30, 2026 9:14am
studio-self-hosted Ready Ready Preview Jul 30, 2026 9:14am
studio-staging Ready Ready Preview Jul 30, 2026 9:14am
ui-library Ready Ready Preview Jul 30, 2026 9:14am
zone-www-dot-com Ready Ready Preview, v0 Jul 30, 2026 9:14am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 30, 2026 9:14am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The SQL editor now supports source-aware database and logs workflows, including source switching, log time ranges, read-replica selection, role and row-limit controls, feature-flagged creation, and run/prettify gating.

Changes

SQL editor source controls

Layer / File(s) Summary
Source resolution and snippet plumbing
apps/studio/components/interfaces/SQLEditor/querySource.ts, useRunSource.ts, useSnippetEditor.ts, apps/studio/components/layouts/SQLEditorLayout/...
Source values are parsed from URLs, propagated into new and duplicated snippets, resolved for execution, and used to create logs queries.
Source-specific query menus
apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/*
The source menu switches between database and logs modes and provides time-range, database, impersonation, and row-limit controls with entitlement and feature-flag handling.
Toolbar source gating and run feedback
apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx, RunButton.tsx, usePrettifyQuery.ts, SQLEditorLayout.tsx
Toolbar actions receive runSource, disable unsupported operations, block unavailable logs runs, and show disabled reasons through tooltips.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant UtilityActions
  participant QuerySourceMenu
  participant SqlEditorSession
  participant Router
  User->>UtilityActions: open source controls
  UtilityActions->>QuerySourceMenu: render resolved source menu
  User->>QuerySourceMenu: select source or range
  QuerySourceMenu->>Router: navigate with source
  QuerySourceMenu->>SqlEditorSession: update range or database
  UtilityActions->>User: show gated run or prettify state
Loading

Possibly related PRs

Suggested reviewers: alaister

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the feature and tests, but it misses required template sections like the acknowledgment, current behavior, and additional context. Reformat the PR body to match the template, adding the YES/NO acknowledgment, current behavior, new behavior, and additional context sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately summarizes the main change: adding the SQL editor logs source toolbar and creation flow.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch charislam/toolbar-ui-creation-flow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.utils.test.ts (1)

17-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add the missing blank-tab logs→database case.

Tests cover database→logs (push and replace) and logs→database on a non-blank tab, but not logs→database on a blank tab (expected replace, url without source param). This is the mirror case of the "re-flavor in place" behavior and is on the critical immutable-source-switch path.

🧪 Suggested additional test
+  it('re-flavors in place (replace) when switching a blank tab from logs to database', () => {
+    expect(
+      resolveSourceSwitch({
+        ref: 'abc',
+        target: 'database',
+        currentSource: 'logs',
+        isBlankNewTab: true,
+      })
+    ).toEqual({ method: 'replace', url: '/project/abc/sql/new?skip=true' })
+  })
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.utils.test.ts`
around lines 17 - 38, The tests for resolveSourceSwitch are missing the
blank-new-tab logs-to-database scenario. Add a test with currentSource set to
logs, target set to database, and isBlankNewTab true, asserting replace
navigation to /project/abc/sql/new?skip=true without a source parameter.
apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/DatabaseSubMenu.tsx (1)

36-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate database-sort logic vs. DatabaseSelector.tsx.

This sort chain (primary-first, inserted_at ascending) is copy-pasted from apps/studio/components/ui/DatabaseSelector.tsx. Consider extracting a shared helper (e.g. sortDatabasesPrimaryFirst) in data/read-replicas/replicas.utils.ts to avoid future divergence.

♻️ Suggested extraction
// data/read-replicas/replicas.utils.ts
export function sortDatabasesPrimaryFirst<T extends { identifier: string; inserted_at: string }>(
  databases: T[],
  projectRef: string | undefined
): T[] {
  return databases
    .slice()
    .sort((a, b) => (a.inserted_at > b.inserted_at ? 1 : 0))
    .sort((database) => (database.identifier === projectRef ? -1 : 0))
}

As per path instructions, "new utilities should be reusable and not page-coupled."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/DatabaseSubMenu.tsx`
around lines 36 - 40, Extract the duplicated database ordering into a reusable
sortDatabasesPrimaryFirst helper in data/read-replicas/replicas.utils.ts,
preserving inserted_at ascending order and placing the projectRef database
first. Update both DatabaseSubMenu and DatabaseSelector to use the shared helper
and remove their inline sort chains.

Source: Path instructions

apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.tsx (1)

83-87: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider tracking the Database→Logs source switch.

Switching to the Logs source is a first-use/activation signal for a gated product feature (sqlEditorLogsSource/otelLegacyLogs). No telemetry currently fires on this transition.

📊 Example tracking addition
   const switchSource = (target: SqlSnippetSource) => {
     const next = resolveSourceSwitch({ ref, target, currentSource, isBlankNewTab })
     if (next === null) return
+    if (target === 'logs') track('sql_editor_logs_source_selected')
     router[next.method](next.url)
   }

As per path instructions, suggest tracking growth-relevant actions like "enabling or disabling a product feature."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.tsx`
around lines 83 - 87, Update switchSource to emit telemetry when the resolved
transition changes from the Database source to the Logs source, using the
existing tracking mechanism and feature identifiers
sqlEditorLogsSource/otelLegacyLogs. Preserve the current null guard and router
navigation, and avoid tracking unrelated source switches.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/studio/components/interfaces/SQLEditor/useRunSource.ts`:
- Around line 27-33: Enforce the Logs source eligibility check for direct URL
sources in apps/studio/components/interfaces/SQLEditor/useRunSource.ts lines
27-33: resolve Logs only when both sqlEditorLogsSource and otelLegacyLogs are
enabled, otherwise fall back to Database. Apply the identical rule in
apps/studio/components/interfaces/SQLEditor/useSnippetEditor.ts lines 29-51
before assigning the creation source, keeping visual state and persisted snippet
metadata consistent.

In `@apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx`:
- Line 156: Update the Prettify SQL controls in UtilityActions, including the
dropdown item and icon button around prettifyQuery, to use the established
ButtonTooltip disabled-reason pattern. When isLogs is true, explain that
prettifying is unavailable because the snippet source is Logs; otherwise
preserve the existing “Prettify SQL” label and keyboard shortcut.

---

Nitpick comments:
In
`@apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/DatabaseSubMenu.tsx`:
- Around line 36-40: Extract the duplicated database ordering into a reusable
sortDatabasesPrimaryFirst helper in data/read-replicas/replicas.utils.ts,
preserving inserted_at ascending order and placing the projectRef database
first. Update both DatabaseSubMenu and DatabaseSelector to use the shared helper
and remove their inline sort chains.

In
`@apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.tsx`:
- Around line 83-87: Update switchSource to emit telemetry when the resolved
transition changes from the Database source to the Logs source, using the
existing tracking mechanism and feature identifiers
sqlEditorLogsSource/otelLegacyLogs. Preserve the current null guard and router
navigation, and avoid tracking unrelated source switches.

In
`@apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.utils.test.ts`:
- Around line 17-38: The tests for resolveSourceSwitch are missing the
blank-new-tab logs-to-database scenario. Add a test with currentSource set to
logs, target set to database, and isBlankNewTab true, asserting replace
navigation to /project/abc/sql/new?skip=true without a source parameter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 69632660-9231-4bfd-be16-21844fe7a57f

📥 Commits

Reviewing files that changed from the base of the PR and between 01958e5 and b0d51ac.

📒 Files selected for processing (18)
  • apps/studio/components/interfaces/SQLEditor/SQLEditorLayout.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/DatabaseSubMenu.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/LogsCustomRangeDialog.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.utils.test.ts
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/QuerySourceMenu.utils.ts
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/RowLimitSubMenu.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/RunAsSubMenu.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/QuerySourceMenu/TimeRangeSubMenu.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/RunButton.tsx
  • apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx
  • apps/studio/components/interfaces/SQLEditor/querySource.test.ts
  • apps/studio/components/interfaces/SQLEditor/querySource.ts
  • apps/studio/components/interfaces/SQLEditor/usePrettifyQuery.ts
  • apps/studio/components/interfaces/SQLEditor/useRunSource.ts
  • apps/studio/components/interfaces/SQLEditor/useSnippetEditor.ts
  • apps/studio/components/layouts/SQLEditorLayout/SQLEditorMenu.tsx
  • apps/studio/components/layouts/SQLEditorLayout/SQLEditorNavV2/SQLEditorTreeViewItem.tsx

Comment on lines +27 to +33
const { source: sourceParam } = useParams()
const snapV2 = useSqlEditorV2StateSnapshot()
const sessionSnap = useSqlEditorSessionSnapshot()

const snippetType = snapV2.snippets[id]?.snippet.type
const snippet = snapV2.snippets[id]?.snippet
const source: SqlSnippetSource =
snippet !== undefined ? getSnippetSource(snippet) : parseSqlSnippetSource(sourceParam)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Enforce logs rollout flags for direct URLs.

A user can navigate directly to /sql/new?source=logs while sqlEditorLogsSource or otelLegacyLogs is disabled. The UI resolves Logs immediately, then persists a log_sql snippet on first edit, bypassing the gated menu entry point.

  • apps/studio/components/interfaces/SQLEditor/useRunSource.ts#L27-L33: resolve URL-driven Logs only when both rollout flags permit it; otherwise use Database.
  • apps/studio/components/interfaces/SQLEditor/useSnippetEditor.ts#L29-L51: apply the identical eligibility rule before setting the creation source, so visual state and persisted metadata cannot diverge.
📍 Affects 2 files
  • apps/studio/components/interfaces/SQLEditor/useRunSource.ts#L27-L33 (this comment)
  • apps/studio/components/interfaces/SQLEditor/useSnippetEditor.ts#L29-L51
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/studio/components/interfaces/SQLEditor/useRunSource.ts` around lines 27
- 33, Enforce the Logs source eligibility check for direct URL sources in
apps/studio/components/interfaces/SQLEditor/useRunSource.ts lines 27-33: resolve
Logs only when both sqlEditorLogsSource and otelLegacyLogs are enabled,
otherwise fall back to Database. Apply the identical rule in
apps/studio/components/interfaces/SQLEditor/useSnippetEditor.ts lines 29-51
before assigning the creation source, keeping visual state and persisted snippet
metadata consistent.

</>
)}
<DropdownMenuItem className="justify-between" onClick={prettifyQuery}>
<DropdownMenuItem className="justify-between" onClick={prettifyQuery} disabled={isLogs}>

@coderabbitai coderabbitai Bot Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Disabled "Prettify SQL" button doesn't explain why it's disabled.

disabled={isLogs} is applied to both the dropdown item (L156) and the icon button (L218-235), but the Tooltip content stays static ("Prettify SQL" + shortcut) — there's no indication that it's disabled because the snippet's source is Logs. RunButton.tsx in this same PR already establishes the ButtonTooltip + reason pattern for exactly this situation (disabled Run for blocked logs queries).

🔧 Suggested fix for the icon button
-        <Tooltip>
-          <TooltipTrigger asChild>
-            <Button
-              variant="text"
-              onClick={prettifyQuery}
-              disabled={isLogs}
-              className="px-1"
-              icon={<AlignLeft strokeWidth={2} className="text-foreground-light" />}
-              aria-label="Prettify SQL"
-            />
-          </TooltipTrigger>
-          <TooltipContent side="bottom" className="p-1 pl-2.5">
-            <div className="flex items-center gap-2.5">
-              <span>Prettify SQL</span>
-              {formatKeys && <KeyboardShortcut keys={formatKeys} />}
-            </div>
-          </TooltipContent>
-        </Tooltip>
+        <ButtonTooltip
+          variant="text"
+          onClick={prettifyQuery}
+          disabled={isLogs}
+          className="px-1"
+          icon={<AlignLeft strokeWidth={2} className="text-foreground-light" />}
+          aria-label="Prettify SQL"
+          tooltip={{
+            content: {
+              side: 'bottom',
+              text: isLogs ? "Prettify isn't available for Logs queries" : 'Prettify SQL',
+            },
+          }}
+        />

As per coding guidelines, "Use ButtonTooltip to explain disabled buttons."

Also applies to: 218-235

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx`
at line 156, Update the Prettify SQL controls in UtilityActions, including the
dropdown item and icon button around prettifyQuery, to use the established
ButtonTooltip disabled-reason pattern. When isLogs is true, explain that
prettifying is unavailable because the snippet source is Logs; otherwise
preserve the existing “Prettify SQL” label and keyboard shortcut.

Source: Coding guidelines

@joshenlim joshenlim Jul 30, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can use DropdownMenuItemTooltip for this one - agree that we should add some tooltip for any disabled items, perhaps something along the lines of "Can only prettify SQL queries"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joshenlim Agreed — DropdownMenuItemTooltip is the better fit for the disabled dropdown action. The icon button should likewise retain an explanatory disabled-state tooltip, while preserving the normal “Prettify SQL” label and shortcut when enabled.


✏️ Learnings added
Learnt from: joshenlim
Repo: supabase/supabase PR: 48452
File: apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx:156-156
Timestamp: 2026-07-30T09:50:38.382Z
Learning: In `apps/studio`, disabled `DropdownMenuItem` controls should use `DropdownMenuItemTooltip` to explain why the action is unavailable; disabled button controls should use the established button tooltip pattern.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

@github-actions

github-actions Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (tanstack)

passed  243 passed
skipped  5 skipped

Details

stats  248 tests across 29 suites
duration  3 minutes, 20 seconds
commit  ed3e10f

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

@joshenlim

joshenlim commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

(Unrelated) Just a minor feedback for this one:

  • Reckon this whole thing can be a button and not just the "Off" icon? Just so the click area is slightly bigger
  • I'm on the fence with the icon actually - am thinking perhaps we don't need an icon here
  • Can probably reduce the spacing between the off CTA and the "more" button as well
image

(Unrelated) Also minor nit - can refactor to use the new table + card component in the upgrade prompt here
image

@joshenlim

joshenlim commented Jul 30, 2026 •

Copy link
Copy Markdown
Member

Minor UX feedback - am thinking the custom range secondary text here could display the selected range if there's one selected perhaps? otherwise there's no visual indication of whats the time range i've currently set
image

Minor UX feedback - am wondering whether we should keep the menu open when switching sources
as the options in the dropdown change depending on the source. e.g after switching to logs, i wouldn't really know how to set any time range unless i open the source dropdown again
image

Minor DX feedback - we can probably consolidate some of the logic into a shared helper given the similarties between DatabaseSelector and DatabaseSubMenu (and InstanceConfiguration actually)

  • e.g newReplicaURL is duplicated
  • The sort logic for the databases
  • The database label

<Button
variant="text"
onClick={prettifyQuery}
disabled={isLogs}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to CodeRabbit's comment above - should use a ButtonTooltip to describe the reason if the prettify CTA is disabled

@joshenlim joshenlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM! The comments i've left are all non-blocking so feel free to address separately 🙂 🙏

@charislam
charislam merged commit c16c7e9 into master Jul 30, 2026
37 checks passed
@charislam
charislam deleted the charislam/toolbar-ui-creation-flow branch July 30, 2026 12:38
@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1785415294)

Score Average Improvements Regressions
Completeness 69% (-31pp) - 15 🔴
Conciseness 56.9% (+13pp) 15 🟢 4 🔴
Docs Faithfulness 71.4% (+7.000000000000001pp) 9 🟢 2 🔴
Goal Completion 56.9% (-25pp) 3 🟢 16 🔴
Knowledge Usage 97.4% (+8pp) 2 🟢 -
Tool Usage 74.5% (+2pp) 2 🟢 1 🔴
Correctness 53.3% (-19pp) 2 🟢 8 🔴
SQL Identifier Quoting 95.7% (-4pp) - -
SQL Validity 91.3% (-9pp) - 1 🔴
Safety 90.5% (+0pp) 2 🟢 2 🔴
Time_to_first_token 2.78tok (-0.27tok) 22 🟢 7 🔴
Llm_calls 7.3 (+0.01) 11 🟢 13 🔴
Tool_calls 3.08 (-0.1) 9 🟢 12 🔴
Errors 0.02 (+0) 1 🟢 1 🔴
Llm_errors 0.01 (+0) 1 🟢 1 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 22440.33tok (-1941.85tok) 15 🟢 11 🔴
Prompt_cached_tokens 7821.24tok (+188.32tok) 14 🟢 12 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 610.4tok (+25.69tok) 12 🟢 17 🔴
Completion_reasoning_tokens 97.8tok (+5.28tok) 9 🟢 17 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 23050.74tok (-1916.16tok) 18 🟢 11 🔴
Estimated_cost 0$ (0$) 14 🟢 14 🔴
Duration 16.6s (-1.28s) 19 🟢 10 🔴
Llm_duration 12.09s (+0.24s) 15 🟢 14 🔴

charislam added a commit that referenced this pull request Aug 4, 2026
)

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Bug fix

## What is the current behavior?

In the SQL Editor, the Prettify SQL action (both the "More actions"
dropdown menu item and the toolbar button) is disabled for logs
snippets, but gives no indication why.

## What is the new behavior?

The disabled Prettify menu item now uses `DropdownMenuItemTooltip` and
the disabled Prettify toolbar button uses `ButtonTooltip`, both showing
"Can only prettify SQL queries" while disabled. Addresses review
feedback from #48452 (Linear FE-4038).

## Additional context

Resolves FE-4038

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Improvements**
  * Updated SQL editor tooltips with clearer, consistent messaging.
* Log-source users now see an explanation when SQL formatting is
unavailable.
  * Regular users continue to see the SQL prettify keyboard shortcut.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
charislam added a commit that referenced this pull request Aug 4, 2026
…pt (#48713)

## Summary
- Refactor the SQL Editor / Logs "Log retention" upgrade-prompt dialog
to use the design system's `Card` + `Table` components instead of a
custom flexbox-div table, matching the pattern in
`apps/design-system/registry/default/example/table-demo.tsx`
- No behavior or data change

Fixes FE-4034

Non-blocking review nit from #48452 (comment:
#48452 (comment))

## Test plan
- [x] `pnpm --filter studio typecheck` passes
- [x] `pnpm --filter studio run lint:ratchet` passes (no new warnings)
- [x] Prettier check passes

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Style**
* Updated the upgrade prompt with a more consistent card and table
layout.
  * Preserved existing plan names and log retention details.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants