Files
cleveragents-core/features/plan_cli_cancel_revert_coverage.feature
freemo 48cff5cfe0 refactor(cli): rename plan lifecycle-list and lifecycle-apply to match specification
Renames `plan lifecycle-list` to `plan list` and `plan lifecycle-apply` to `plan apply` to align with the specification's canonical command names. Removes legacy V2 plan commands that occupied those names.

- Renamed CLI command registrations from lifecycle-list/lifecycle-apply to list/apply
- Removed legacy V2 apply and list commands (~200 lines)
- Updated apply shortcut in main.py to delegate to v3 lifecycle
- Added defensive null check for plan existence in apply command
- Updated 63+ test, doc, and benchmark files for consistency

Closes #881

Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
2026-04-02 19:09:04 +00:00

92 lines
4.6 KiB
Gherkin

Feature: Plan CLI cancel, revert, and list rich coverage
As a developer
I want to exercise the uncovered cancel_plan, revert_plan,
and list_plans rich table rendering paths
So that coverage for plan.py lines 1817, 1821-1822, 1845-1855, 1878-1888 is achieved
Background:
Given a CLI runner for cancel-revert coverage
And a mocked lifecycle service for cancel-revert coverage
# ---------- list rich table rendering (lines 1817, 1820-1822) ----------
Scenario: list in rich format renders created_at timestamp
Given the service returns plans with project links and timestamps for rich list
When I invoke list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Lifecycle Plans"
Scenario: list in rich format renders automation profile column
Given the service returns plans with an automation profile for rich list
When I invoke list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Lifecycle Plans"
Scenario: list in rich format renders multiple project links
Given the service returns a plan with three project links for rich list
When I invoke list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "more"
Scenario: list in rich format renders invariant count
Given the service returns plans with invariants for rich list
When I invoke list in rich format for cancel-revert coverage
Then the cancel-revert command should succeed
# ---------- cancel_plan (lines 1845-1855) ----------
Scenario: cancel_plan succeeds in rich format without reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel in rich format without reason for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan cancelled"
Scenario: cancel_plan succeeds in rich format with reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel in rich format with reason "no longer needed" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan cancelled"
And the cancel-revert output should contain "no longer needed"
Scenario: cancel_plan succeeds in JSON format without reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel with format "json" and no reason for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "plan_id"
And the cancel-revert output should not contain "cancel_reason"
Scenario: cancel_plan succeeds in JSON format with reason
Given the service can cancel a plan for cancel-revert coverage
When I invoke cancel with format "json" and reason "obsolete" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "cancel_reason"
And the cancel-revert output should contain "obsolete"
# ---------- revert_plan (lines 1878-1888) ----------
Scenario: revert_plan succeeds in rich format with default phase
Given the service can revert a plan for cancel-revert coverage
When I invoke revert in rich format with default phase for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan Reverted"
And the cancel-revert output should contain "Reversion count"
Scenario: revert_plan succeeds in rich format with reason
Given the service can revert a plan for cancel-revert coverage
When I invoke revert in rich format with reason "constraints too strict" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "Plan Reverted"
Scenario: revert_plan succeeds in JSON format
Given the service can revert a plan for cancel-revert coverage
When I invoke revert with format "json" for cancel-revert coverage
Then the cancel-revert command should succeed
And the cancel-revert output should contain "plan_id"
And the cancel-revert output should contain "reversion_reason"
Scenario: revert_plan rejects invalid phase
Given the service can revert a plan for cancel-revert coverage
When I invoke revert with invalid phase "bogus" for cancel-revert coverage
Then the cancel-revert command should abort
And the cancel-revert output should contain "Invalid phase"