Skip to content

backup create: add --emergency and --emergency-source flags - #1488

Draft
maxenglander wants to merge 3 commits into
mainfrom
cursor/add-emergency-backup-flags-21af
Draft

maxenglander wants to merge 3 commits into
mainfrom
cursor/add-emergency-backup-flags-21af

Conversation

@maxenglander

@maxenglander maxenglander commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds two new flags to pscale backup create:

  • --emergency — requests an emergency backup that clones data from a live tablet instead of waiting for the next scheduled backup.
  • --emergency-source — selects the tablet type to clone from: primary or replica. rdonly is rejected.

The create request body sends these as emergency and emergency_source.

Validation

  • --emergency-source is required when --emergency is set.
  • --emergency-source is rejected when --emergency is not set.
  • --emergency-source values are validated against primary and replica. rdonly and any other value are rejected.
  • No client-side default is applied to either flag; both are sent on the existing CreateBackupRequest when provided.

Out of scope

  • No retention flags were added or changed.
  • Only this CLI repo was touched. api-bb and app-bb are unchanged.

Docs

Updated the CLI's agent-facing reference (AGENTS.md, embedded and served via pscale agent-guide --skill) with an "Emergency backups" section documenting the flags and their required/rejected relationship, plus the flag help text and command Long description shown in pscale backup create --help.

Testing

  • go test ./internal/cmd/backup/ -run TestBackup_Create
  • Added unit tests covering: success with both flags set, --emergency without --emergency-source (error), --emergency-source without --emergency (error), an invalid --emergency-source value (error), and rdonly (error).
Open in Web Open in Cursor 

--emergency requests an emergency backup that clones data from a live
tablet instead of waiting for the next scheduled backup.
--clone-tablet-type selects the tablet type to clone from (primary,
replica, or rdonly) and is required with --emergency, rejected
otherwise. No client-side default is applied; both fields are sent on
the existing create-backup request.

Co-authored-by: max <max@planetscale.com>
@maxenglander
maxenglander requested a review from a team as a code owner October 24, 2026 03:58
@maxenglander
maxenglander marked this pull request as draft October 24, 2026 04:00
The create request sends emergency_source. --emergency-source is required
with --emergency and rejected without it. Values stay primary, replica,
and rdonly.

Co-authored-by: max <max@planetscale.com>
@cursor cursor Bot changed the title backup create: add --emergency and --clone-tablet-type flags backup create: add --emergency and --emergency-source flags Oct 24, 2026
rdonly is rejected. Allowed values are primary and replica.

Co-authored-by: max <max@planetscale.com>

This branch has not been deployed

No deployments
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