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
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>
156 lines
7.1 KiB
Gherkin
156 lines
7.1 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"
|
|
|
|
# ---- 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"
|
|
|
|
# ---- apply_plan non-rich format ----
|
|
|
|
Scenario: 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 apply with "--format" "json" and plan id
|
|
Then the plan coverage command should succeed
|
|
And the plan coverage output should contain "plan_id"
|
|
|
|
# ---- list_plans regex and state/processing_state filtering ----
|
|
|
|
Scenario: 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 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: 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 list with "--state" "processing"
|
|
Then the plan coverage command should succeed
|
|
|
|
Scenario: 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 list with "--processing-state" "complete"
|
|
Then the plan coverage command should succeed
|
|
|
|
Scenario: 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 list with regex "[invalid"
|
|
Then the plan coverage command should abort
|
|
And the plan coverage output should contain "Invalid regex"
|
|
|
|
Scenario: 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 list with "--action" "local/test-action"
|
|
Then the plan coverage command should succeed
|
|
|
|
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 service has multiple plans for lifecycle list
|
|
When I invoke 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"
|