Files
cleveragents-core/features/plan_lifecycle_commands_coverage.feature
T
freemo 48cff5cfe0
CI / build (push) Successful in 18s
CI / lint (push) Failing after 31s
CI / helm (push) Successful in 33s
CI / typecheck (push) Successful in 50s
CI / security (push) Failing after 51s
CI / coverage (push) Has been skipped
CI / benchmark-regression (push) Has been skipped
CI / unit_tests (push) Failing after 1m50s
CI / docker (push) Has been skipped
CI / quality (push) Successful in 3m43s
CI / integration_tests (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / status-check (push) Has been cancelled
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

252 lines
11 KiB
Gherkin

Feature: Plan V3 Lifecycle Commands and Streaming Coverage
As a developer
I want to test V3 lifecycle commands and streaming in plan.py
So that previously uncovered lines/branches have test coverage
# ===================================================================
# V3 Lifecycle - use_action command
# ===================================================================
Scenario: Use action creates a plan from an available action with string arguments
Given I have a temporary test directory
When I invoke use_action with string argument "target_coverage=80"
Then the use_action CLI should succeed
And the lifecycle plan panel should be printed
Scenario: Use action parses integer and float argument values correctly
Given I have a temporary test directory
When I invoke use_action with args "count=42" and "ratio=3.14"
Then the use_action CLI should succeed
And the parsed arguments should contain integer 42 and float 3.14
Scenario: Use action parses boolean argument values correctly
Given I have a temporary test directory
When I invoke use_action with args "verbose=true" and "dry_run=false"
Then the use_action CLI should succeed
And the parsed arguments should contain booleans true and false
Scenario: Use action rejects invalid argument format without equals sign
Given I have a temporary test directory
When I invoke use_action with malformed argument "badarg"
Then the use_action CLI should abort
And the output should mention invalid argument format
Scenario: Use action falls back to action name lookup when ID not found
Given I have a temporary test directory
When I invoke use_action where get_action raises NotFoundError
Then the use_action CLI should succeed via name fallback
Scenario: Use action parses custom automation profile
Given I have a temporary test directory
When I invoke use_action with automation profile "full-auto"
Then the use_action CLI should succeed
And the lifecycle service should receive full-auto profile
Scenario: Use action rejects invalid automation profile
Given I have a temporary test directory
When I invoke use_action with automation profile "super_auto"
Then the use_action CLI should abort
And the output should mention invalid automation profile
Scenario: Use action reports error when action is not available
Given I have a temporary test directory
When I invoke use_action and ActionNotAvailableError is raised
Then the use_action CLI should abort
And the output should mention action not available
Scenario: Use action handles validation errors gracefully
Given I have a temporary test directory
When I invoke use_action and ValidationError is raised
Then the use_action CLI should abort with lifecycle validation error
Scenario: Use action handles general CleverAgents errors
Given I have a temporary test directory
When I invoke use_action and CleverAgentsError is raised
Then the use_action CLI should abort with lifecycle general error
# ===================================================================
# V3 Lifecycle - execute_plan command
# ===================================================================
Scenario: Execute plan transitions a strategize-complete plan to execute phase
Given I have a temporary test directory
When I invoke execute_plan with a valid plan ID
Then the execute_plan CLI should succeed
And the execute phase panel should be printed
Scenario: Execute plan auto-selects the only strategize-complete plan when no ID given
Given I have a temporary test directory
When I invoke execute_plan without ID and one strategize-complete plan exists
Then the execute_plan CLI should succeed
Scenario: Execute plan aborts when no plans are ready for execution
Given I have a temporary test directory
When I invoke execute_plan without ID and no strategize plans exist at all
Then the execute_plan CLI should abort
And the output should mention no plans ready for execution
Scenario: Execute plan aborts when multiple plans are ready and no ID given
Given I have a temporary test directory
When I invoke execute_plan without ID and multiple strategize-complete plans exist
Then the execute_plan CLI should abort
And the output should mention multiple plans ready
Scenario: Execute plan reports invalid phase transition error
Given I have a temporary test directory
When I invoke execute_plan and InvalidPhaseTransitionError is raised
Then the execute_plan CLI should abort
And the output should mention invalid transition
Scenario: Execute plan reports plan not ready error
Given I have a temporary test directory
When I invoke execute_plan and PlanNotReadyError is raised
Then the execute_plan CLI should abort
And the output should mention plan not ready
Scenario: Execute plan auto-runs strategize on queued plan
Given I have a temporary test directory
When I invoke execute_plan with a plan in strategize-queued state
Then the execute_plan CLI should succeed
And the PlanExecutor should have run strategize inline
Scenario: Execute plan succeeds when auto-progress already moved plan to execute
Given I have a temporary test directory
When I invoke execute_plan and auto-progress already moved plan to execute
Then the execute_plan CLI should succeed
Scenario: Plan use persists automation profile override
Given I have a temporary test directory
When I invoke use_action with automation profile "full-auto"
Then the use_action CLI should succeed
And the lifecycle service should persist the plan overrides
# ===================================================================
# V3 Lifecycle - apply_plan command
# ===================================================================
Scenario: Lifecycle apply transitions an execute-complete plan to apply phase
Given I have a temporary test directory
When I invoke apply with a valid plan ID
Then the apply CLI should succeed
And the apply phase panel should be printed
Scenario: Lifecycle apply auto-selects the only execute-complete plan
Given I have a temporary test directory
When I invoke apply without ID and one execute-complete plan exists
Then the apply CLI should succeed
Scenario: Lifecycle apply aborts when no plans are ready for apply
Given I have a temporary test directory
When I invoke apply without ID and no execute-complete plans exist
Then the apply CLI should abort
And the output should mention no plans ready for apply
Scenario: Lifecycle apply aborts when multiple plans are ready and no ID given
Given I have a temporary test directory
When I invoke apply without ID and multiple execute-complete plans exist
Then the apply CLI should abort
And the output should mention multiple plans ready for apply
# ===================================================================
# V3 Lifecycle - plan_status command
# ===================================================================
Scenario: Plan status shows details for a specific plan ID
Given I have a temporary test directory
When I invoke plan status with a specific plan ID
Then the plan status CLI should succeed
And the plan status panel should be displayed
Scenario: Plan status lists all active plans when no ID given
Given I have a temporary test directory
When I invoke plan status without ID and active plans exist
Then the plan status CLI should succeed
And the active plans table should be displayed
Scenario: Plan status shows no plans message when empty
Given I have a temporary test directory
When I invoke plan status without ID and no plans exist
Then the plan status CLI should succeed with no plans message
# ===================================================================
# V3 Lifecycle - list_plans command
# ===================================================================
Scenario: Lifecycle list shows all plans without filters
Given I have a temporary test directory
When I invoke list without filters
Then the list CLI should succeed
And the lifecycle plans table should be displayed
Scenario: Lifecycle list filters plans by phase
Given I have a temporary test directory
When I invoke list with phase filter "strategize"
Then the list CLI should succeed
Scenario: Lifecycle list rejects invalid phase filter
Given I have a temporary test directory
When I invoke list with phase filter "bogus_phase"
Then the list CLI should abort
And the output should mention invalid phase
Scenario: Lifecycle list shows no plans message when empty
Given I have a temporary test directory
When I invoke list and no plans match
Then the list CLI should succeed with empty list message
# ===================================================================
# V3 Lifecycle - cancel_plan command
# ===================================================================
Scenario: Cancel plan cancels a plan with a reason
Given I have a temporary test directory
When I invoke cancel with a reason "no longer needed"
Then the cancel CLI should succeed
And the output should show cancellation with reason
Scenario: Cancel plan cancels a plan without a reason
Given I have a temporary test directory
When I invoke cancel without a reason
Then the cancel CLI should succeed
And the output should show cancellation without reason text
Scenario: Cancel plan handles plan errors
Given I have a temporary test directory
When I invoke cancel and PlanError is raised
Then the cancel CLI should abort
And the output should mention cannot cancel
# ===================================================================
# Streaming (_tell_streaming)
# ===================================================================
Scenario: Tell streaming displays real-time progress for plan generation nodes
Given I have a temporary test directory
When I run _tell_streaming with a successful async event stream
Then _tell_streaming should complete without error
And the streaming output should include completion panel
Scenario: Tell streaming handles errors during streaming generation
Given I have a temporary test directory
When I run _tell_streaming with an error during streaming
Then _tell_streaming should raise the streaming error
# ===================================================================
# _print_lifecycle_plan
# ===================================================================
Scenario: Print lifecycle plan displays details for a real LifecyclePlan
Given I have a temporary test directory
When I call _print_lifecycle_plan with a LifecyclePlan instance
Then the lifecycle plan panel should be rendered with plan details
Scenario: Print lifecycle plan falls back for a non-LifecyclePlan object
Given I have a temporary test directory
When I call _print_lifecycle_plan with a non-LifecyclePlan object
Then the fallback plan panel should be rendered
Scenario: Print lifecycle plan shows error message when present
Given I have a temporary test directory
When I call _print_lifecycle_plan with a LifecyclePlan that has an error
Then the lifecycle plan panel should include the error message