Skip to content

Ask before restoring into production; the gate never fires #789

Closed

Description

@EVWorth

Severity: P1 (data safety)

What happens

  1. Open ?mock=connected, then connect to "Production (read-only)" from the connection tab menu (status bar shows a PROD badge).
  2. Toolbar → Restore. Browse picks shop_backup.sql. Choose connection "Production (read-only)", database shop.
  3. Click Restore.

The restore starts immediately. No "Run on production?" dialog appears, although the dialog's own comment says a restore is "the most destructive thing this app runs" and was meant to be gated (#588).

Cause

src/components/backup/RestoreDialog.tsx:119-128 calls confirmDestructive({ sql: [], ... }). src/stores/productionGuardStore.ts:119-120 returns true without asking when none of the statements is destructive, and an empty array has none, so the prompt is never shown.

Fix

Pass alwaysAsk: true from the restore (the import path already uses alwaysAsk for a truncated scan at src/components/import/ImportDialog.tsx:225). Add a test that a restore on a production connection calls the guard's ask.

Part of #783.

Activity

  1. added
    bug
    on Oct 21, 2026
  2. added a commit that references this issue on Oct 23, 2026
    0a0dcad
  3. added a commit that references this issue on Oct 23, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions