Files
cleveragents-core/features/plan_cli_coverage.feature
freemo c9abb45adf
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 18s
CI / security (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 55s
CI / integration_tests (pull_request) Successful in 3m28s
CI / unit_tests (pull_request) Successful in 10m38s
CI / docker (pull_request) Successful in 16s
CI / benchmark-regression (pull_request) Successful in 20m39s
CI / coverage (pull_request) Successful in 41m22s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 17s
CI / build (push) Successful in 22s
CI / typecheck (push) Successful in 29s
CI / security (push) Successful in 29s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 2m40s
CI / unit_tests (push) Successful in 11m4s
CI / docker (push) Successful in 1m5s
CI / benchmark-publish (push) Successful in 12m10s
CI / coverage (push) Successful in 1h7m46s
test(coverage): add Behave BDD scenarios for 9 under-covered modules
Added 246 new BDD scenarios across 9 feature files to improve unit test
coverage for modules that were either entirely untested or had significant
coverage gaps:

- lock_service_coverage.feature (27 scenarios): validation branches,
  TTL boundaries, re-entrant acquisition, rollback on exceptions
- plan_apply_service_coverage.feature (54 scenarios): operation labels,
  diff rendering (plain/rich/json), artifact building, validation gate,
  changeset resolution and cleanup
- plan_executor_coverage.feature (51 scenarios): step parsing, execute
  actor integration, strategize/execute guards, stub retry/recovery,
  decision tree construction
- skill_cli_coverage_r3.feature (22 scenarios): tools refresh, list/show
  JSON fallback, capability summary errors, remove confirmation
- changeset_repository_coverage.feature (39 scenarios): entry/tool repos
  validation, database error wrapping, domain conversion, SQLite store
  CRUD operations
- repositories_coverage.feature (20 scenarios): get_by_name/namespace
  errors, list_available filters, delete with ActionInUseError, plan
  update with invariants/processing_state/error_details
- sandbox_copy_on_write_coverage.feature (12 scenarios): create OSError
  wrapping, get_path state transitions, commit edge cases, rollback
  errors, cleanup with missing paths
- bridge_coverage.feature (8 scenarios): __del__ suppression, async task
  cancellation, execute_graph message type handling, stream config,
  state checkpointer
- plan_cli_coverage.feature (13 scenarios): legacy apply/list/cd paths,
  use-action with estimation/invariant actors, lifecycle-apply guards,
  status errors, error recovery display

All 246 scenarios (1105 steps) pass. Step definitions use unique prefixes
to prevent ambiguous step conflicts with existing tests.

ISSUES CLOSED: #467
2026-02-27 13:47:42 -05:00

124 lines
5.9 KiB
Gherkin

Feature: Plan CLI uncovered lines and branches coverage
As a developer
I want to exercise the uncovered lines and branches in plan.py
So that code coverage gaps at lines 80, 818, 827-828, 999, 1017-1035,
1314-1315, 1391-1392, 1573-1578, 1594-1596, 1700-1701, 1739 are closed
# ===================================================================
# Legacy apply command Progress block and PlanError handler
# ===================================================================
Scenario: Legacy apply succeeds through Progress spinner block
Given a plan-cov CLI runner
And a mocked legacy container for plan-cov apply that succeeds
When I invoke plan-cov legacy apply with --yes
Then the plan-cov command should exit normally
And the plan-cov output should contain "Successfully applied"
Scenario: Legacy apply raises PlanError
Given a plan-cov CLI runner
And a mocked legacy container for plan-cov apply that raises PlanError
When I invoke plan-cov legacy apply with --yes
Then the plan-cov command should abort
And the plan-cov output should contain "Apply Error"
# ===================================================================
# Legacy list command — plan.current=False branch
# ===================================================================
Scenario: Legacy list shows plans with current=False
Given a plan-cov CLI runner
And a mocked legacy container for plan-cov list with non-current plans
When I invoke plan-cov legacy list
Then the plan-cov command should exit normally
And the plan-cov output should contain "Plans"
# ===================================================================
# Legacy cd command — full body coverage
# ===================================================================
Scenario: Legacy cd switches to an existing plan
Given a plan-cov CLI runner
And a mocked legacy container for plan-cov cd that succeeds
When I invoke plan-cov legacy cd "my-plan"
Then the plan-cov command should exit normally
And the plan-cov output should contain "Switched to plan"
Scenario: Legacy cd raises CleverAgentsError
Given a plan-cov CLI runner
And a mocked legacy container for plan-cov cd that raises CleverAgentsError
When I invoke plan-cov legacy cd "bad-plan"
Then the plan-cov command should abort
And the plan-cov output should contain "Error"
# ===================================================================
# use command — invariant_actor and invariants
# ===================================================================
Scenario: Use action with estimation-actor and invariant-actor overrides
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov use action
When I invoke plan-cov use with estimation-actor "openai/gpt-4" and invariant-actor "openai/gpt-4"
Then the plan-cov command should exit normally
And the plan-cov created plan should have estimation_actor set
Scenario: Use action with --invariant flags builds plan invariants
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov use action
When I invoke plan-cov use with invariant "No new warnings"
Then the plan-cov command should exit normally
# ===================================================================
# lifecycle-apply — no plan_id auto-discovery branches
# ===================================================================
Scenario: lifecycle-apply without plan_id when no plans are ready
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov that returns no execute-complete plans
When I invoke plan-cov lifecycle-apply without plan_id
Then the plan-cov command should abort
And the plan-cov output should contain "No plans ready for apply"
Scenario: lifecycle-apply without plan_id when multiple plans are ready
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov that returns multiple execute-complete plans
When I invoke plan-cov lifecycle-apply without plan_id
Then the plan-cov command should abort
And the plan-cov output should contain "Multiple plans ready"
Scenario: lifecycle-apply rejects a read-only plan
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov that returns a read-only plan
When I invoke plan-cov lifecycle-apply with plan_id "01ARZ3NDEKTSV4RRFFQ69G5FAA"
Then the plan-cov command should abort
And the plan-cov output should contain "read-only"
# ===================================================================
# status command — CleverAgentsError handler
# ===================================================================
Scenario: status command raises CleverAgentsError
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov status that raises CleverAgentsError
When I invoke plan-cov status "01ARZ3NDEKTSV4RRFFQ69G5FAA"
Then the plan-cov command should abort
And the plan-cov output should contain "Error"
# ===================================================================
# errors command — no error_category branch
# ===================================================================
Scenario: errors command on plan with no error recovery data
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov errors with no error_category
When I invoke plan-cov errors "01ARZ3NDEKTSV4RRFFQ69G5FAA" with format "json"
Then the plan-cov command should exit normally
And the plan-cov output should contain "plan_id"
Scenario: errors command on plan with empty error_details in rich format
Given a plan-cov CLI runner
And a mocked lifecycle service for plan-cov errors with empty details
When I invoke plan-cov errors "01ARZ3NDEKTSV4RRFFQ69G5FAA"
Then the plan-cov command should exit normally
And the plan-cov output should contain "No error recovery records"