Files
cleveragents-core/features/plan_cli_coverage_boost.feature
T
Jeffrey Phillips Freeman 36c571db83
CI / lint (pull_request) Successful in 15s
CI / typecheck (pull_request) Successful in 30s
CI / security (pull_request) Successful in 22s
CI / quality (pull_request) Successful in 16s
CI / integration_tests (pull_request) Successful in 5m12s
CI / build (pull_request) Successful in 16s
CI / lint (push) Successful in 13s
CI / typecheck (push) Successful in 29s
CI / security (push) Successful in 23s
CI / quality (push) Successful in 16s
CI / unit_tests (pull_request) Successful in 13m42s
CI / integration_tests (push) Successful in 4m53s
CI / build (push) Successful in 16s
CI / unit_tests (push) Successful in 15m9s
CI / coverage (pull_request) Successful in 7m58s
CI / coverage (push) Successful in 8m14s
CI / docker (pull_request) Successful in 9s
CI / docker (push) Successful in 8s
feat(repo): add resource repositories
2026-02-16 21:35:54 +00:00

166 lines
7.7 KiB
Gherkin

Feature: Plan CLI coverage boost
As a developer
I want to exercise uncovered branches in plan.py
So that code coverage is improved for the plan CLI module
# ---- _plan_spec_dict helper ----
Scenario: _plan_spec_dict returns error_message when truthy
Given a v3 Plan with error_message set to "Strategy failed"
When I call _plan_spec_dict on the plan
Then the spec dict should contain key "error_message" with value "Strategy failed"
Scenario: _plan_spec_dict falls back to legacy format for non-Plan objects
Given a non-Plan object with string value "legacy plan data"
When I call _plan_spec_dict on the object
Then the spec dict should equal {"plan": "legacy plan data"}
Scenario: _plan_spec_dict omits error_message when it is None
Given a v3 Plan with error_message set to None
When I call _plan_spec_dict on the plan
Then the spec dict should not contain key "error_message"
# ---- _print_lifecycle_plan helper ----
Scenario: _print_lifecycle_plan prints all optional timestamps
Given a v3 Plan with all timestamps populated
When I call _print_lifecycle_plan on the plan
Then the printed output should contain "Strategize Started"
And the printed output should contain "Strategize Completed"
And the printed output should contain "Execute Started"
And the printed output should contain "Execute Completed"
And the printed output should contain "Applied At"
Scenario: _print_lifecycle_plan prints estimation_actor when set
Given a v3 Plan with estimation_actor set to "local/cost-estimator"
When I call _print_lifecycle_plan on the plan
Then the printed output should contain "Estimation Actor"
And the printed output should contain "local/cost-estimator"
Scenario: _print_lifecycle_plan prints invariant_actor when set
Given a v3 Plan with invariant_actor set to "local/invariant-checker"
When I call _print_lifecycle_plan on the plan
Then the printed output should contain "Invariant Actor"
And the printed output should contain "local/invariant-checker"
Scenario: _print_lifecycle_plan falls back for non-Plan objects
Given a non-Plan object with string value "legacy-plan-object"
When I call _print_lifecycle_plan on the object
Then the printed output should contain "legacy-plan-object"
# ---- list_plans non-rich format ----
Scenario: list_plans outputs JSON when format is json
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the mocked plan service returns legacy plans
When I invoke list_plans with "--format" "json"
Then the plan coverage command should succeed
And the plan coverage output should contain "plan_id"
# ---- execute_plan non-rich format ----
Scenario: execute_plan outputs JSON when format is json
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has a complete strategize plan for execute
When I invoke execute with "--format" "json" and plan id
Then the plan coverage command should succeed
And the plan coverage output should contain "plan_id"
And the plan coverage output should contain "namespaced_name"
# ---- lifecycle_apply_plan non-rich format ----
Scenario: lifecycle_apply_plan outputs JSON when format is json
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has a complete execute plan for apply
When I invoke lifecycle-apply with "--format" "json" and plan id
Then the plan coverage command should succeed
And the plan coverage output should contain "plan_id"
# ---- lifecycle_list_plans regex and state/processing_state filtering ----
Scenario: lifecycle_list_plans filters by regex pattern
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has multiple plans for lifecycle list
When I invoke lifecycle-list with regex "alpha"
Then the plan coverage command should succeed
And the plan coverage output should contain "alpha"
And the plan coverage output should not contain "beta"
Scenario: lifecycle_list_plans filters by state
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has plans in different processing states
When I invoke lifecycle-list with "--state" "processing"
Then the plan coverage command should succeed
Scenario: lifecycle_list_plans filters by processing_state alias
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has plans in different processing states
When I invoke lifecycle-list with "--processing-state" "complete"
Then the plan coverage command should succeed
Scenario: lifecycle_list_plans rejects invalid regex
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has multiple plans for lifecycle list
When I invoke lifecycle-list with regex "[invalid"
Then the plan coverage command should abort
And the plan coverage output should contain "Invalid regex"
Scenario: lifecycle_list_plans filters by action name
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has multiple plans for lifecycle list
When I invoke lifecycle-list with "--action" "local/test-action"
Then the plan coverage command should succeed
Scenario: lifecycle_list_plans outputs JSON when format is json
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service has multiple plans for lifecycle list
When I invoke lifecycle-list with "--format" "json"
Then the plan coverage command should succeed
And the plan coverage output should contain "plan_id"
# ---- cancel_plan ----
Scenario: cancel_plan in non-rich format without reason
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service can cancel a plan
When I invoke cancel with "--format" "json" and no reason
Then the plan coverage command should succeed
And the plan coverage output should contain "plan_id"
And the plan coverage output should not contain "cancel_reason"
Scenario: cancel_plan in non-rich format with reason
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service can cancel a plan
When I invoke cancel with "--format" "json" and reason "not needed"
Then the plan coverage command should succeed
And the plan coverage output should contain "cancel_reason"
And the plan coverage output should contain "not needed"
Scenario: cancel_plan in rich format with reason
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service can cancel a plan
When I invoke cancel in rich format with reason "obsolete"
Then the plan coverage command should succeed
And the plan coverage output should contain "Plan cancelled"
And the plan coverage output should contain "Reason: obsolete"
Scenario: cancel_plan in rich format without reason
Given a plan lifecycle CLI runner for coverage
And a mocked lifecycle service for plan coverage commands
And the service can cancel a plan
When I invoke cancel in rich format without reason
Then the plan coverage command should succeed
And the plan coverage output should contain "Plan cancelled"