Skip to content

[P1][ux] Preview pane doesn't warn about destructive statements (DROP/TRUNCATE/DELETE) #367

Closed

Description

@EVWorth

Context

SQL import preview UX. Per docs/audits/import.md F5.

Problem

src/components/import/ImportDialog.tsx:170-195 renders parsed statements verbatim. A dump with DROP TABLE users or TRUNCATE users shows as plain text — no styling, no warning. User has to read every line of multi-thousand-statement dump before clicking Import.

Files

  • src/components/import/ImportDialog.tsx:170-195
  • src/lib/sql-import.ts (no statement classifier)

Repro

  1. Create dump with DROP TABLE foo at line 50
  2. Open ImportDialog
  3. Observe plain-text rendering, no warning

Expected

Red destructive warning + require typing "import" to confirm.

Proposed fix

S: add classifyStatement(stmt) -> { kind, label } helper in src/lib/sql-import.ts. Flag DROP, TRUNCATE, DELETE FROM x (no WHERE), ALTER TABLE ... DROP COLUMN, UPDATE x SET ... (no WHERE). Render destructive rows with red AlertTriangle icon. Confirm button requires typing "import" if any are destructive.

Acceptance

Previewing dump with DROP TABLE foo shows red destructive warning; clicking Import requires typing "import" to confirm.

Needs human verify

no

Activity

  1. added
    audit
    severity/p1
    kind/ux
    area/import
    on Jul 31, 2026
  2. EVWorth commented on Sep 12, 2026

    @EVWorth
    OwnerAuthor

    Closed by #654, with a note on the half that was not built.

    The warning itself is there: the preview counts destructive statements up front and lists the first five in an amber panel above it, so a DROP TABLE at line 5,000 is visible without reading the file. #654 extends it — the dialog now reads only the first 512 KB (the file is run by the backend straight from disk) and says when the scan did not reach the end, rather than reporting "3 statements detected" for a two-gigabyte dump.

    Not doing the "require typing 'import' to confirm" half. That gesture belongs to actions with no other guard and no undo — deleting a GitHub repository. Here there are two already: the amber list naming the statements, and the production gate, which raises its own dialog on a production connection. A third, typed, on every import — including loading a fixture into a local database twenty times a day — would be trained away within a week, and a reflex to type past a confirmation makes the two that matter easier to click through too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/importauditkind/uxseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions