Files
cleveragents-core/features/plan_cli_coverage_r3.feature
T
freemo 31472b5413
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 22s
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 3m58s
CI / security (pull_request) Successful in 4m8s
CI / integration_tests (pull_request) Successful in 9m33s
CI / unit_tests (pull_request) Successful in 10m12s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 12m18s
CI / e2e_tests (pull_request) Successful in 19m51s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 15s
CI / helm (push) Successful in 22s
CI / lint (push) Successful in 3m18s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 3m57s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m10s
CI / unit_tests (push) Failing after 6m58s
CI / docker (push) Has been skipped
CI / integration_tests (push) Successful in 9m15s
CI / coverage (push) Successful in 12m26s
CI / e2e_tests (push) Successful in 23m11s
CI / status-check (push) Failing after 1s
CI / benchmark-publish (push) Successful in 28m31s
CI / benchmark-regression (pull_request) Successful in 54m53s
test(coverage): add Behave scenarios for 39 under-covered modules
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate.

ISSUES CLOSED: #1232
2026-03-31 21:47:12 +00:00

118 lines
5.4 KiB
Gherkin

@mock_only
Feature: Plan CLI coverage round 3
Exercise uncovered lines in cleveragents/cli/commands/plan.py that are
not yet hit by existing test suites. Each scenario uses the "plcov3"
step prefix to avoid Behave AmbiguousStep collisions.
# validate_namespaced_actor (lines 104, 107-108)
Scenario: validate_namespaced_actor rejects invalid actor name
Given a plcov3 CLI runner
When I plcov3 call validate_namespaced_actor with value "BAD_NAME" and flag "--strategy-actor"
Then the plcov3 error should be a ValidationError with message containing "namespace/name"
Scenario: validate_namespaced_actor accepts valid actor name
Given a plcov3 CLI runner
When I plcov3 call validate_namespaced_actor with value "openai/gpt-4" and flag "--strategy-actor"
Then the plcov3 result should equal "openai/gpt-4"
# ── _plan_spec_dict with execution_environment (line 184) ───────
Scenario: _plan_spec_dict includes execution_environment when set
Given a plcov3 CLI runner
And a plcov3 v3 plan with execution_environment "container"
When I plcov3 call _plan_spec_dict
Then the plcov3 spec dict should contain key "execution_environment" with value "container"
# ── build command PlanError handler (line 790) ──────────────────
Scenario: build command handles PlanError
Given a plcov3 CLI runner
And a plcov3 mocked build environment that raises PlanError
When I plcov3 invoke the build command
Then the plcov3 CLI output should contain "Build Error"
# ── apply command v3 path with plan_id (lines 799-824) ─────────
Scenario: apply command with plan_id delegates to v3 lifecycle
Given a plcov3 CLI runner
And a plcov3 mocked lifecycle service for apply happy path
When I plcov3 invoke apply with plan_id "PLAN-001"
Then the plcov3 CLI exit code should be 0
# ── apply command legacy path with changes (lines 826-858) ──────
Scenario: apply command legacy path with pending changes
Given a plcov3 CLI runner
And a plcov3 mocked legacy apply environment with pending changes
When I plcov3 invoke apply without plan_id
Then the plcov3 CLI output should contain "Successfully applied"
Scenario: apply command legacy path with no pending changes
Given a plcov3 CLI runner
And a plcov3 mocked legacy apply environment with no pending changes
When I plcov3 invoke apply without plan_id
Then the plcov3 CLI output should contain "No changes to apply"
# ── continue_plan command (lines 1205-1224) ─────────────────────
Scenario: continue command with prompt
Given a plcov3 CLI runner
And a plcov3 mocked continue environment
When I plcov3 invoke continue with prompt "add caching"
Then the plcov3 CLI output should contain "Added instructions"
Scenario: continue command without prompt shows current plan
Given a plcov3 CLI runner
And a plcov3 mocked continue environment with current plan
When I plcov3 invoke continue without prompt
Then the plcov3 CLI output should contain "Continuing with plan"
# ── use_action with strategy_actor (lines 1529-1542, 1631-1633, 1751-1752) ─
Scenario: use command with strategy-actor override
Given a plcov3 CLI runner
And a plcov3 mocked use_action environment
When I plcov3 invoke use with action "local/test" and strategy-actor "openai/gpt-4"
Then the plcov3 CLI exit code should be 0
# ── use_action with execution_env_priority valid (lines 1789-1792) ──
Scenario: use command with valid execution-env-priority
Given a plcov3 CLI runner
And a plcov3 mocked use_action environment
When I plcov3 invoke use with action "local/test" and execution-environment "host" and priority "fallback"
Then the plcov3 CLI exit code should be 0
# ── use_action with invalid execution_env_priority (line 1794) ──
Scenario: use command with invalid execution-env-priority
Given a plcov3 CLI runner
And a plcov3 mocked use_action environment
When I plcov3 invoke use with action "local/test" and execution-environment "host" and priority "INVALID"
Then the plcov3 CLI output should contain "Invalid execution env priority"
# ── plan diff command (lines 2740-2741, 2743) ──────────────────
Scenario: diff command invokes apply service
Given a plcov3 CLI runner
And a plcov3 mocked apply service for diff
When I plcov3 invoke diff with plan_id "PLAN-001"
Then the plcov3 CLI exit code should be 0
# ── correct_decision ValidationError handler (lines 3047-3048) ──
Scenario: correct command handles ValidationError
Given a plcov3 CLI runner
And a plcov3 mocked correction environment that raises ValidationError
When I plcov3 invoke correct with identifier "DEC-001" mode "revert" guidance "fix it"
Then the plcov3 CLI output should contain "Validation Error"
# ── correct_decision CleverAgentsError handler (line 3051) ──────
Scenario: correct command handles CleverAgentsError
Given a plcov3 CLI runner
And a plcov3 mocked correction environment that raises CleverAgentsError
When I plcov3 invoke correct with identifier "DEC-001" mode "revert" guidance "fix it"
Then the plcov3 CLI output should contain "Error"