Files
cleveragents-core/features/plan_lifecycle_cli_coverage.feature
T
CoreRasurae f2f7aa5dc9 feat(core): add v3 lifecycle models, automation levels, subplan support, and security hardening
Implement multiple Stage A/B/E/SEC milestones for the v3 lifecycle system:
- Stage A5.3+A5.4: Add LifecycleActionModel and LifecyclePlanModel SQLAlchemy
  models with to_domain()/from_domain() conversion methods
- Stage A5.6: Implement ActionRepository with full CRUD, namespace/state
  queries, referential integrity checks, and retry decorator
- Stage E1: Add subplan domain models (ExecutionMode, SubplanMergeStrategy,
  SubplanConfig, SubplanStatus, SubplanAttempt, SubplanFailureHandler) with
  computed properties on Plan (is_subplan, is_root_plan, depth, has_subplans)
- Stage A6: Add AutomationLevel enum (MANUAL, REVIEW_BEFORE_APPLY,
  FULL_AUTOMATION), settings integration, PlanLifecycleService auto-progression,
  pause/resume, and CLI commands (--automation-level, set-automation-level)
- Stage SEC1: Remove eval()/exec() from stream_router.py, replace with named
  operation and transform registries; code blocks and unregistered transforms
  now raise StreamRoutingError
- Add langchain-anthropic dependency
- Update BDD tests for security changes and relax ADR directory requirement
2026-02-12 20:19:42 +00:00

161 lines
7.7 KiB
Gherkin

Feature: Plan lifecycle CLI coverage
As a developer
I want to exercise v3 plan lifecycle CLI commands
So that plan lifecycle branches in plan.py are covered
Background:
Given a plan lifecycle CLI runner
And a mocked lifecycle service for plan commands
Scenario: Plan use parses typed arguments
When I run plan lifecycle use with parsed arguments
Then the plan lifecycle command should succeed
And the plan lifecycle use should pass parsed arguments
And the plan lifecycle output should contain "Strategize phase"
Scenario: Plan use rejects invalid argument format
When I run plan lifecycle use with invalid argument "badarg"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Invalid argument format"
Scenario: Plan use handles action not available errors
When I run plan lifecycle use causing "action not available"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Action not available"
Scenario: Plan use handles validation errors
When I run plan lifecycle use causing "validation error"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Validation Error"
Scenario: Plan use handles general errors
When I run plan lifecycle use causing "general error"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Error"
Scenario: Plan execute aborts when no plans are ready
When I run plan execute without a plan id with 0 complete plans
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "No plans ready for execution"
Scenario: Plan execute aborts when multiple plans are ready
When I run plan execute without a plan id with 2 complete plans
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Multiple plans ready for execution"
Scenario: Plan execute runs when one plan is ready
When I run plan execute without a plan id with 1 complete plans
Then the plan lifecycle command should succeed
And the execute command should run the single ready plan
And the plan lifecycle output should contain "Execute phase"
Scenario: Plan execute handles invalid phase transition
When I run plan execute for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAV" causing "invalid transition"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Invalid transition"
Scenario: Plan execute handles plan not ready
When I run plan execute for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAW" causing "plan not ready"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Plan not ready"
Scenario: Plan execute handles general errors
When I run plan execute for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAX" causing "general error"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Error"
Scenario: Plan lifecycle apply aborts when no plans are ready
When I run plan lifecycle apply without a plan id with 0 complete plans
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "No plans ready for apply"
Scenario: Plan lifecycle apply aborts when multiple plans are ready
When I run plan lifecycle apply without a plan id with 2 complete plans
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Multiple plans ready for apply"
Scenario: Plan lifecycle apply runs when one plan is ready
When I run plan lifecycle apply without a plan id with 1 complete plans
Then the plan lifecycle command should succeed
And the lifecycle apply command should run the single ready plan
And the plan lifecycle output should contain "Apply phase"
Scenario: Plan lifecycle apply handles invalid phase transition
When I run plan lifecycle apply for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAY" causing "invalid transition"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Invalid transition"
Scenario: Plan lifecycle apply handles plan not ready
When I run plan lifecycle apply for plan id "01ARZ3NDEKTSV4RRFFQ69G5FAZ" causing "plan not ready"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Plan not ready"
Scenario: Plan lifecycle apply handles general errors
When I run plan lifecycle apply for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB0" causing "general error"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Error"
Scenario: Plan status shows no plans
When I run plan status without a plan id and 0 plans exist
Then the plan lifecycle command should succeed
And the plan lifecycle output should contain "No v3 lifecycle plans found"
Scenario: Plan status lists active plans
When I run plan status without a plan id and 2 plans exist
Then the plan lifecycle command should succeed
And the plan lifecycle output should contain "Active Plans"
Scenario: Plan status falls back for legacy plan
When I run plan status for legacy plan id "01ARZ3NDEKTSV4RRFFQ69G5FB1"
Then the plan lifecycle command should succeed
And the plan lifecycle output should contain "Plan: legacy-plan"
Scenario: Plan status handles general errors
When I run plan status causing a general error
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Error"
Scenario: Plan lifecycle list rejects invalid phase
When I run plan lifecycle list with invalid phase "notaphase"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Invalid phase"
Scenario: Plan lifecycle list shows no plans
When I run plan lifecycle list with no plans
Then the plan lifecycle command should succeed
And the plan lifecycle output should contain "No plans found"
Scenario: Plan lifecycle list shows project summaries
When I run plan lifecycle list with plans and phase "execute"
Then the plan lifecycle command should succeed
And the plan lifecycle output should contain "V3 Lifecycle Plans"
And the plan lifecycle output should contain "proj-2"
And the plan lifecycle output should contain "more"
Scenario: Plan lifecycle list handles general errors
When I run plan lifecycle list causing a general error
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Error"
Scenario: Plan cancel reports cancellation with reason
When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB2" with reason "User requested"
Then the plan lifecycle command should succeed
And the plan lifecycle output should contain "Plan cancelled"
And the plan lifecycle output should contain "Reason: User requested"
Scenario: Plan cancel reports cancellation without reason
When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB3" without reason
Then the plan lifecycle command should succeed
And the plan lifecycle output should contain "Plan cancelled"
And the plan lifecycle output should not contain "Reason:"
Scenario: Plan cancel handles plan errors
When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB4" causing "plan error"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Cannot cancel"
Scenario: Plan cancel handles general errors
When I run plan cancel for plan id "01ARZ3NDEKTSV4RRFFQ69G5FB5" causing "general error"
Then the plan lifecycle command should abort
And the plan lifecycle output should contain "Error"