Skip to content

feat(cli): add schema change cancel command#571

Merged
aparajon merged 2 commits into
mainfrom
amp/cancel-cli
Jun 29, 2026
Merged

feat(cli): add schema change cancel command#571
aparajon merged 2 commits into
mainfrom
amp/cancel-cli

Conversation

@aparajon

@aparajon aparajon commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Why

Once the backend can record and drive permanent cancel requests, operators need a first-class CLI entry point instead of overloading stop for terminal aborts.

What

  • Add schemabot cancel for permanent schema change cancellation
  • Call the cancel API from the CLI client
  • Prompt for explicit confirmation before cancelling — permanent and non-resumable — with -y / --auto-approve to skip, consistent with apply and rollback
  • Defer cancellable-state decisions to the server instead of a client-side allowlist, so valid non-terminal states (e.g. PlanetScale setup phases, paused/resuming) are not wrongly blocked
  • Render cancel-specific command output and accepted/skipped counts

Risk Assessment

Low — this is a thin CLI layer on top of the backend cancel API (#573).


PR summary updated by Claude Code (Opus 4.8).

@aparajon aparajon force-pushed the amp/cancel-command branch from df39832 to 007b603 Compare June 27, 2026 23:37
@aparajon aparajon changed the base branch from amp/cancel-command to amp/cancel-backend June 27, 2026 23:38
@aparajon aparajon force-pushed the amp/cancel-backend branch from 489d378 to d213486 Compare June 28, 2026 01:53
@aparajon aparajon force-pushed the amp/cancel-backend branch from d213486 to 6457f03 Compare June 28, 2026 02:02
@aparajon aparajon force-pushed the amp/cancel-backend branch from 6457f03 to 8bed941 Compare June 28, 2026 15:42
@aparajon aparajon force-pushed the amp/cancel-backend branch from 8bed941 to 5dc8ddc Compare June 28, 2026 15:52
@aparajon aparajon force-pushed the amp/cancel-backend branch from 5dc8ddc to 667b9d8 Compare June 28, 2026 16:39
Base automatically changed from amp/cancel-backend to main June 28, 2026 18:05
Copilot AI review requested due to automatic review settings June 29, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new schemabot cancel CLI command to request permanent schema change cancellation via the backend cancel API, with dedicated CLI output rendering.

Changes:

  • Register a new top-level cancel CLI command and implement its execution flow (preflight progress check → cancel API call → rendered output).
  • Add cancel-specific response handling (accepted wrapper) and success-output template including cancelled/skipped counts.
  • Introduce cancel output formatting alongside existing stop/start templates.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
pkg/cmd/main.go Registers the new cancel subcommand in the root CLI.
pkg/cmd/internal/templates/progress.go Adds CancelData + WriteCancelSuccess for cancel-specific CLI output.
pkg/cmd/commands/common.go Adds a CancelResponse wrapper so checkAccepted can be reused.
pkg/cmd/commands/cancel.go Implements the schemabot cancel command logic and state gating.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/commands/cancel.go
Comment thread pkg/cmd/commands/cancel.go
Comment thread pkg/cmd/commands/cancel.go Outdated
- Prompt for explicit "yes" confirmation before cancelling, unless -y /
  --auto-approve is passed, consistent with apply and rollback. Cancellation is
  permanent and non-resumable, so it should not run unattended by default.
- Drop the hard-coded cancellable-state allowlist. The no-active and
  already-terminal (except stopped) early returns already mirror the server's
  reject cases; the server is the source of truth for which remaining states are
  cancellable, so the allowlist only risked wrongly blocking valid non-terminal
  states (e.g. PlanetScale setup phases, paused/resuming).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aparajon aparajon marked this pull request as ready for review June 29, 2026 16:13
@aparajon aparajon requested review from Kiran01bm and morgo as code owners June 29, 2026 16:13
@aparajon aparajon merged commit c78401a into main Jun 29, 2026
32 checks passed
@aparajon aparajon deleted the amp/cancel-cli branch June 29, 2026 16:26
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.

3 participants