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>
229 lines
10 KiB
Gherkin
229 lines
10 KiB
Gherkin
Feature: Plan CLI commands branch coverage (round 2)
|
||
As a developer
|
||
I want to exercise uncovered branches in CLI command functions
|
||
So that branch coverage for use_action, execute, apply, list, revert, status, correct, and diff rises
|
||
|
||
# ===================================================================
|
||
# use_action argument parsing – int / float / bool / string
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan use_action parses integer argument
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and arg "count=42"
|
||
Then r2plan-the parsed arguments should have "count" as int 42
|
||
|
||
Scenario: r2plan use_action parses float argument
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and arg "ratio=3.14"
|
||
Then r2plan-the parsed arguments should have "ratio" as float 3.14
|
||
|
||
Scenario: r2plan use_action parses bool true argument
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and arg "verbose=true"
|
||
Then r2plan-the parsed arguments should have "verbose" as bool true
|
||
|
||
Scenario: r2plan use_action parses bool false argument
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and arg "verbose=false"
|
||
Then r2plan-the parsed arguments should have "verbose" as bool false
|
||
|
||
Scenario: r2plan use_action parses string argument
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and arg "name=hello"
|
||
Then r2plan-the parsed arguments should have "name" as string "hello"
|
||
|
||
Scenario: r2plan use_action rejects argument missing equals sign
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and arg "badarg"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Invalid argument format"
|
||
|
||
# ===================================================================
|
||
# use_action – invalid automation profile
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan use_action rejects invalid automation profile
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and automation profile "bogus"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Invalid automation profile"
|
||
|
||
# ===================================================================
|
||
# use_action – actor overrides with invalid names
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan use_action rejects invalid strategy actor
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and strategy actor "INVALID"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Validation Error"
|
||
|
||
Scenario: r2plan use_action rejects invalid execution actor
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke use with action "local/test" and execution actor "bad-name"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Validation Error"
|
||
|
||
# ===================================================================
|
||
# execute_plan – auto-resolve: no plans / multiple plans
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan execute_plan aborts when no plans ready
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists no complete strategize plans
|
||
When r2plan-I invoke execute without plan_id
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "No plans ready for execution"
|
||
|
||
Scenario: r2plan execute_plan aborts when multiple plans ready
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists multiple complete strategize plans
|
||
When r2plan-I invoke execute without plan_id
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Multiple plans ready"
|
||
|
||
# ===================================================================
|
||
# apply_plan – auto-resolve: no plans / multiple plans
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan apply aborts when no plans ready
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists no complete execute plans
|
||
When r2plan-I invoke apply without plan_id
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "No plans ready for apply"
|
||
|
||
Scenario: r2plan apply aborts when multiple plans ready
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists multiple complete execute plans
|
||
When r2plan-I invoke apply without plan_id
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Multiple plans ready"
|
||
|
||
# ===================================================================
|
||
# list_plans – invalid phase / invalid state
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan list rejects invalid phase
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke list with phase "nonexistent"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Invalid phase"
|
||
|
||
Scenario: r2plan list rejects invalid state
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke list with state "nonexistent"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Invalid state"
|
||
|
||
# ===================================================================
|
||
# list_plans – empty result
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan list shows no-plans message when empty
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists no plans
|
||
When r2plan-I invoke list
|
||
Then r2plan-the command should succeed
|
||
And r2plan-the output should contain "No plans found"
|
||
|
||
# ===================================================================
|
||
# revert_plan – invalid --to-phase
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan revert_plan rejects invalid to-phase
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke revert with plan "PLAN123" and invalid phase "badphase"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Invalid phase"
|
||
|
||
Scenario: r2plan revert_plan non-rich format
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service can revert a plan
|
||
When r2plan-I invoke revert with plan "PLAN123" and format "json"
|
||
Then r2plan-the command should succeed
|
||
And r2plan-the output should contain "plan_id"
|
||
|
||
# ===================================================================
|
||
# plan_status – without plan_id: no plans, plans in non-rich, rich
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan status shows no-plans message
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists no plans
|
||
When r2plan-I invoke status without plan_id
|
||
Then r2plan-the command should succeed
|
||
And r2plan-the output should contain "No v3 lifecycle plans found"
|
||
|
||
Scenario: r2plan status without plan_id lists plans in non-rich
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists some plans
|
||
When r2plan-I invoke status without plan_id and format "json"
|
||
Then r2plan-the command should succeed
|
||
And r2plan-the output should contain "plan_id"
|
||
|
||
Scenario: r2plan status with plan_id in non-rich format
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service can get a plan by id
|
||
When r2plan-I invoke status with plan_id and format "json"
|
||
Then r2plan-the command should succeed
|
||
And r2plan-the output should contain "plan_id"
|
||
|
||
# ===================================================================
|
||
# correct_decision – invalid mode / empty guidance
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan correct rejects invalid mode
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke correct with mode "badmode"
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "Invalid mode"
|
||
|
||
Scenario: r2plan correct rejects empty guidance
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke correct with empty guidance
|
||
Then r2plan-the command should abort
|
||
And r2plan-the output should contain "guidance"
|
||
|
||
# ===================================================================
|
||
# plan_diff – correction flag present
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan diff shows correction stub when correction flag set
|
||
Given r2plan-a mocked lifecycle service
|
||
When r2plan-I invoke diff with plan "P1" and correction "CORR1"
|
||
Then r2plan-the command should succeed
|
||
And r2plan-the output should contain "Correction Attempt"
|
||
And r2plan-the output should contain "CORR1"
|
||
|
||
# ===================================================================
|
||
# execute_plan – auto-resolve with exactly one plan
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan execute_plan auto-resolves single plan
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists exactly one complete strategize plan
|
||
When r2plan-I invoke execute without plan_id
|
||
Then r2plan-the command should succeed
|
||
|
||
# ===================================================================
|
||
# apply – auto-resolve with exactly one plan
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan apply auto-resolves single plan
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists exactly one complete execute plan
|
||
When r2plan-I invoke apply without plan_id
|
||
Then r2plan-the command should succeed
|
||
|
||
# ===================================================================
|
||
# list_plans – projects > 2 truncation
|
||
# ===================================================================
|
||
|
||
Scenario: r2plan list truncates projects over 2
|
||
Given r2plan-a mocked lifecycle service
|
||
And r2plan-the service lists a plan with 4 project links
|
||
When r2plan-I invoke list
|
||
Then r2plan-the command should succeed
|
||
And r2plan-the output should contain "+2 more"
|