Skip to content

chore(studio): simplify sql editor warning dialog - #45912

Merged
dnywh merged 8 commits into
masterfrom
dnywh/sql-editor-warning-alert-dialog
May 15, 2026
Merged

dnywh merged 8 commits into
masterfrom
dnywh/sql-editor-warning-alert-dialog

Conversation

@dnywh

@dnywh dnywh commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Studio UI cleanup.

What is the current behaviour?

The SQL editor query warning modal repeats itself with an admonition, a nested warning panel, and extra confirmation copy. Single-warning cases are harder to scan than they need to be.

What is the new behaviour?

The warning now uses AlertDialog and resolves each detected issue into concise title/body copy. Single-warning cases show one short description, while multi-warning cases show a compact list. The existing RLS actions are preserved.

Testing instructions

Manual SQL editor checks:

Open the Studio SQL editor, paste each snippet, click Run, verify the warning copy, then click Cancel. These snippets are only intended to trigger the warning UI, so do not confirm the dangerous ones.

Destructive operation warning:

drop table if exists public.codex_warning_destructive;

UPDATE without WHERE warning:

update public.codex_warning_table set id = id;

Prevent database connections warning:

alter database postgres connection limit 0;

Missing RLS warning:

create schema if not exists codex_warning;
create table codex_warning.missing_rls (id bigint);

Multiple issues warning:

drop table if exists public.codex_warning_destructive;
update public.codex_warning_table set id = id;
create schema if not exists codex_warning;
create table codex_warning.missing_rls_multi (id bigint);

Additional context

Before After
Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-BDBD32C7-FCE8-4623-ACF2-D2554233EBB4 Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-C8964C98-1CF9-4992-89D6-86C081C884E8
Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-C341A032-B5B0-49A2-8EA2-E3E6EEC54E4F Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-FC66ADE9-6AF1-44D2-A6B6-F7B2FC935C0E
Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-43AAD9FA-7FAC-4DCE-A713-00E8FC76B343 Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-279EC81D-31C7-49C7-B4A8-EEEF1738740A
Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-D405AED5-613F-4C78-909E-F718C67CF17E Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-725FBCE6-5606-4BC3-B13F-6210DBADF6F2
Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-EA6563AF-DE7E-4AB8-9164-AC66164CA581 Codex Warning Table Maintenance  SQL Editor  Hammer  Toolshed  Supabas-EC85EFB1-715E-4841-BBCA-51F88B539595

Summary by CodeRabbit

  • Bug Fixes

    • Prevented unintended modal dismissal and duplicate handling when confirming.
  • Refactor

    • Redesigned SQL editor warning modal with structured, consolidated warnings, adaptive title/confirmation copy, and centralized handling of missing-RLS table names.
    • Added conditional "Run and enable RLS" confirmation when available.
  • Tests

    • Updated end-to-end tests to match the new modal headings and body text.

Review Change Stack

@vercel

vercel Bot commented May 14, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview, Comment May 14, 2026 11:52pm
studio-staging Ready Ready Preview, Comment May 14, 2026 11:52pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored May 14, 2026 11:52pm
design-system Skipped Skipped May 14, 2026 11:52pm
docs Skipped Skipped May 14, 2026 11:52pm
ui-library Skipped Skipped May 14, 2026 11:52pm
zone-www-dot-com Skipped Skipped May 14, 2026 11:52pm

Request Review

@supabase

supabase Bot commented May 14, 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 ↗︎.

@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 70cccfd2-e089-49e2-b20b-3b59e1c6660e

📥 Commits

Reviewing files that changed from the base of the PR and between b4dfed4 and 0c592c9.

📒 Files selected for processing (1)
  • apps/studio/components/interfaces/SQLEditor/RunQueryWarningModal.tsx

📝 Walkthrough

Walkthrough

The RunQueryWarningModal was rewritten to use AlertDialog primitives, building a structured warnings array and adding guarded confirm/close behavior (via isConfirmingRef). Modal title, confirmation copy, and footer actions (including optional "Run and enable RLS") are derived from the warnings and props. E2E assertions were updated to match new headings and messages.

Changes

AlertDialog Refactoring

Layer / File(s) Summary
Dependencies and helper utilities
apps/studio/components/interfaces/SQLEditor/RunQueryWarningModal.tsx
Dialog/Admonition imports replaced with AlertDialog components; added getMissingRLSTableName helper to format schema-qualified table names for warning rendering.
State management and close behavior guards
apps/studio/components/interfaces/SQLEditor/RunQueryWarningModal.tsx
Introduced isConfirmingRef with effect-based reset and handleOpenChange to prevent unintended onCancel() when a confirm initiated the close; confirm handlers set the ref then invoke callbacks.
Warnings array construction and modal content logic
apps/studio/components/interfaces/SQLEditor/RunQueryWarningModal.tsx
Replaced ad-hoc issue counting with a structured warnings array (stable ids, ReactNode summaries/descriptions) covering destructive ops, UPDATE without WHERE, ALTER DATABASE connection warnings, and missing RLS; compute title and confirm copy based on count and RLS availability.
AlertDialog rendering and action buttons
apps/studio/components/interfaces/SQLEditor/RunQueryWarningModal.tsx
Reworked modal rendering to AlertDialog primitives with conditional single/multi-warning content; footer uses AlertDialogCancel/AlertDialogAction and conditionally renders "Run and enable RLS" when applicable.
E2E test assertions for warning modal behavior
e2e/studio/features/sql-editor.spec.ts
Updated Playwright test assertions to expect the new modal heading (Potential issue detected / regex) and updated body messages (including regex for UPDATE without WHERE and new RLS wording).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A modal refactored, tidy and sure,
AlertDialog guards keep confirmations pure,
Warnings grouped in a tidy array,
RLS buttons appear when they may,
Tests updated — the rabbit hops for more! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: refactoring the SQL editor warning dialog from a complex Dialog/Admonition layout to a simplified AlertDialog-based implementation.
Description check ✅ Passed The PR description covers all key sections with sufficient detail: change type (UI cleanup), current behavior with clear problem statement, new behavior with implementation approach, comprehensive testing instructions with multiple SQL snippets, and before/after visual comparisons.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 dnywh/sql-editor-warning-alert-dialog

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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 and usage tips.

@blacksmith-sh

This comment has been minimized.

@github-actions

github-actions Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results

passed  205 passed
flaky  2 flaky
skipped  5 skipped

Details

stats  212 tests across 23 suites
duration  5 minutes, 18 seconds
commit  0c592c9

Flaky tests

Features › table-editor.spec.ts › table editor › add enums and show enums on table
Features › wrappers.spec.ts › Stripe › can create a stripe wrapper with tables

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

@dnywh
dnywh marked this pull request as ready for review May 14, 2026 05:52
@dnywh
dnywh requested a review from a team as a code owner May 14, 2026 05:52

@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: 1

🤖 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/RunQueryWarningModal.tsx`:
- Around line 178-183: The primary button label logic in RunQueryWarningModal is
incorrect: change the condition that chooses the primary AlertDialogAction label
(currently based only on hasMissingRLS) to require both hasMissingRLS and
onConfirmWithRLS so the label only becomes "Run without RLS" when the
alternative "Run and enable RLS" is actually offered; update the conditional
used for the primary AlertDialogAction (and ensure confirmationCopy uses the
same combined condition) and reference AlertDialogAction, handleConfirm,
handleConfirmWithRLS, hasMissingRLS, onConfirmWithRLS, and confirmationCopy when
making the change.
🪄 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: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e7afbb52-6e2d-4e80-8482-76d98163d64a

📥 Commits

Reviewing files that changed from the base of the PR and between 2efaf8e and 6dd2279.

📒 Files selected for processing (1)
  • apps/studio/components/interfaces/SQLEditor/RunQueryWarningModal.tsx

@awaseem awaseem 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.

LGTM

@dnywh
dnywh merged commit 8935043 into master May 15, 2026
24 checks passed
@dnywh
dnywh deleted the dnywh/sql-editor-warning-alert-dialog branch May 15, 2026 00:01
@github-actions

github-actions Bot commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1778803366)

Score Average Improvements Regressions
Completeness 87.8% (+2pp) 1 🟢 -
Conciseness 43.9% (-3pp) 6 🟢 7 🔴
Correctness 63.9% (+6pp) 2 🟢 1 🔴
Docs Faithfulness 64.1% (+5pp) 2 🟢 2 🔴
Goal Completion 68.9% (-8pp) 4 🟢 5 🔴
Knowledge Usage 96.7% (-1pp) 1 🟢 1 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Tool Usage 73.3% (+13pp) 2 🟢 -
Safety 97.6% (+6pp) 1 🟢 -
URL Validity 100% - -
Time_to_first_token 0.02tok (+0tok) 8 🟢 14 🔴
Llm_calls 11.36 (+0.12) 9 🟢 10 🔴
Tool_calls 3.05 (+0.2) 8 🟢 6 🔴
Errors 0.16 (+0.24) - 2 🔴
Llm_errors 0.05 (+0.05) - 1 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 22297.52tok (+4433.5tok) 8 🟢 11 🔴
Prompt_cached_tokens 7127.04tok (-218.39tok) 10 🟢 8 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 551.77tok (+17.15tok) 10 🟢 12 🔴
Completion_reasoning_tokens 91.16tok (-1.12tok) 9 🟢 10 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 22849.29tok (+4450.65tok) 10 🟢 12 🔴
Estimated_cost 0$ (+0$) 12 🟢 6 🔴
Duration 21.02s (+1.79s) 10 🟢 12 🔴
Llm_duration 10.14s (+0.74s) 9 🟢 13 🔴

@dnywh dnywh changed the title simplify sql editor warning dialog chore(studio): simplify sql editor warning dialog May 18, 2026
@coderabbitai coderabbitai Bot mentioned this pull request May 28, 2026
2 tasks done
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