5febbbc93b
CI / push-validation (pull_request) Successful in 57s
CI / lint (pull_request) Successful in 1m21s
CI / quality (pull_request) Successful in 1m19s
CI / typecheck (pull_request) Successful in 1m32s
CI / build (pull_request) Successful in 1m22s
CI / security (pull_request) Successful in 1m35s
CI / helm (pull_request) Successful in 1m33s
CI / unit_tests (pull_request) Successful in 6m48s
CI / docker (pull_request) Successful in 1m50s
CI / integration_tests (pull_request) Successful in 10m28s
CI / coverage (pull_request) Successful in 11m59s
CI / status-check (pull_request) Successful in 3s
- Add list-mode to rollback_plan: when no checkpoint ID given, list available checkpoints instead of aborting (fixes feature file scenario) - Add CleverAgentsError import to rollback_plan function scope - Rewrite plan_cli_rollback_steps.py with correct mocking pattern: patch get_container, use plan_app with ["rollback", ...] args, :S parse modifiers to avoid AmbiguousStep, proper exception hierarchy - Rename 4 conflicting @then step patterns to be rollback-specific: "the rollback output should be valid JSON/YAML", "the plan rollback should succeed", "no rollback confirmation prompt should be shown" - Fix JSON/YAML assertion steps to check format_output envelope structure (data is nested under "data" key in the envelope) - Update plan_cli_rollback.feature to match renamed step patterns ISSUES CLOSED: #9612
157 lines
8.1 KiB
Gherkin
157 lines
8.1 KiB
Gherkin
@phase2 @plan @cli @rollback
|
|
Feature: Plan rollback CLI command
|
|
As a user
|
|
I want to list available checkpoints and restore a plan to a checkpoint via CLI
|
|
So that I can recover from failed plan executions
|
|
|
|
# ───────────────────────────────────────────────────────────
|
|
# List mode scenarios (agents plan rollback)
|
|
# ───────────────────────────────────────────────────────────
|
|
|
|
Scenario: List checkpoints for a plan
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has 3 checkpoints
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
Then the output should list 3 checkpoints
|
|
And each checkpoint should show ID, timestamp, and metadata
|
|
|
|
Scenario: List checkpoints with empty list
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has no checkpoints
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
Then the output should indicate no checkpoints available
|
|
|
|
Scenario: List checkpoints with rich output format
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has 2 checkpoints
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV --format rich"
|
|
Then the output should be formatted as a rich table
|
|
And the table should contain checkpoint IDs and metadata
|
|
|
|
Scenario: List checkpoints with JSON output format
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has 2 checkpoints
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV --format json"
|
|
Then the rollback output should be valid JSON
|
|
And the JSON should contain a list of checkpoints
|
|
|
|
Scenario: List checkpoints with YAML output format
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has 2 checkpoints
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV --format yaml"
|
|
Then the rollback output should be valid YAML
|
|
And the YAML should contain a list of checkpoints
|
|
|
|
Scenario: List checkpoints with plain output format
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has 2 checkpoints
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV --format plain"
|
|
Then the output should be plain text
|
|
And the text should contain checkpoint IDs
|
|
|
|
# ───────────────────────────────────────────────────────────
|
|
# Restore mode scenarios (agents plan rollback <id> <checkpoint-id>)
|
|
# ───────────────────────────────────────────────────────────
|
|
|
|
Scenario: Restore plan to checkpoint with confirmation
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV" with confirmation
|
|
Then the plan rollback should succeed
|
|
And the output should show rollback summary
|
|
|
|
Scenario: Restore plan to checkpoint with --yes flag
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes"
|
|
Then the plan rollback should succeed
|
|
And no rollback confirmation prompt should be shown
|
|
|
|
Scenario: Restore plan to checkpoint with --to-checkpoint option
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV --to-checkpoint 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes"
|
|
Then the plan rollback should succeed
|
|
|
|
Scenario: Restore plan to non-existent checkpoint
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01NONEXISTENT0000000000000 --yes"
|
|
Then the command should fail with not found error
|
|
|
|
Scenario: Restore applied plan fails
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan is marked as applied
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes"
|
|
Then the command should fail with "plan is already applied"
|
|
|
|
Scenario: Restore plan without checkpoint ID shows error
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
Then the output should list available checkpoints
|
|
|
|
Scenario: Restore plan with JSON output format
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes --format json"
|
|
Then the rollback output should be valid JSON
|
|
And the JSON should contain rollback summary
|
|
|
|
Scenario: Restore plan with YAML output format
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes --format yaml"
|
|
Then the rollback output should be valid YAML
|
|
And the YAML should contain rollback summary
|
|
|
|
# ───────────────────────────────────────────────────────────
|
|
# Atomic rollback verification
|
|
# ───────────────────────────────────────────────────────────
|
|
|
|
Scenario: Rollback is atomic - no partial state on failure
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes"
|
|
Then the rollback should be atomic
|
|
And the plan state should be consistent
|
|
|
|
Scenario: Rollback shows restored files count
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes"
|
|
Then the output should show the number of restored files
|
|
|
|
Scenario: Rollback shows changed paths
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV --yes"
|
|
Then the output should list changed paths
|
|
|
|
# ───────────────────────────────────────────────────────────
|
|
# Error handling scenarios
|
|
# ───────────────────────────────────────────────────────────
|
|
|
|
Scenario: Rollback with invalid plan ID
|
|
When I run "agents plan rollback INVALID_PLAN_ID"
|
|
Then the command should fail with validation error
|
|
|
|
Scenario: Rollback with missing plan
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV"
|
|
Then the command should fail with not found error
|
|
|
|
Scenario: Rollback cancelled by user
|
|
Given a plan "01ARZ3NDEKTSV4RRFFQ69G5FAV" exists
|
|
And the plan has a checkpoint "01BRZ4NFEKTSV4RRFFQ69G5FAV"
|
|
And the plan is not applied
|
|
When I run "agents plan rollback 01ARZ3NDEKTSV4RRFFQ69G5FAV 01BRZ4NFEKTSV4RRFFQ69G5FAV" and cancel confirmation
|
|
Then the rollback should be cancelled
|
|
And the plan state should remain unchanged
|