Repository navigation
Add warning in SQL editor when running alter db commands which prevents connections to the DB - #43584
Conversation
…t connections to database
|
The latest updates on your projects. Learn more about Vercel for GitHub. 9 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Repository UI (inherited), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes centralize SQL-safety detection by introducing a new exported type Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant SQLEditor
participant Validator as "Validator\n(constants + utils)"
participant RunQueryWarningModal as "RunQueryWarningModal"
participant Server as "Server/Database"
User->>SQLEditor: Click "Run" with SQL
SQLEditor->>Validator: analyze SQL (destructive / updateWithoutWhere / alterDBConnection)
Validator-->>SQLEditor: PotentialIssues (object or undefined)
alt issues detected
SQLEditor->>RunQueryWarningModal: show(potentialIssues)
RunQueryWarningModal-->>User: display warnings
User->>RunQueryWarningModal: Confirm
RunQueryWarningModal-->>SQLEditor: onConfirm (clear potentialIssues)
SQLEditor->>Server: execute SQL
Server-->>SQLEditor: execution result
SQLEditor-->>User: show result
else no issues
SQLEditor->>Server: execute SQL
Server-->>SQLEditor: execution result
SQLEditor-->>User: show result
end
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. Comment |
|
Tested on staging |
🎭 Playwright Test ResultsDetails
Flaky testsFeatures › realtime-inspector.spec.ts › Realtime Inspector › Broadcast Messages › broadcast modal validates JSON payload Skipped testsFeatures › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected |
…ter-database-statements-in-sql
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@e2e/studio/features/sql-editor.spec.ts`:
- Around line 170-192: The test currently only verifies the warning modal is
visible but not that it blocks execution; update the test to intercept/monitor
the POST to the query endpoint (the pg-meta ... query?key= request) before
clicking the SQL run button and assert that no such POST is sent until the user
confirms the modal; use the existing UI hooks like
page.getByTestId('sql-run-button'), the modal heading 'Potential issue detected
with', and the modal confirm button (instead of Cancel) to trigger the request,
then assert the POST is observed after confirmation; apply the same
interception/assertion pattern to the other similar tests that check this modal.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Repository UI (inherited), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 2423c626-d2b7-427f-b39f-c1d0f88a986b
📒 Files selected for processing (1)
e2e/studio/features/sql-editor.spec.ts
Braintrust eval report
|
Context
Adds a warning if running an
ALTER DATABASEcommand that prevents connections to the database. This would lock the dashboard out of the database, and re-configuring the setting will require a direct connection to the DBTo test