Files
cleveragents-core/features/plan_cli_coverage_boost_r2.feature
T
freemo 051ee7c290
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 21s
CI / quality (pull_request) Successful in 31s
CI / typecheck (pull_request) Successful in 47s
CI / security (pull_request) Successful in 52s
CI / build (pull_request) Successful in 56s
CI / e2e_tests (pull_request) Successful in 5m1s
CI / integration_tests (pull_request) Successful in 5m30s
CI / unit_tests (pull_request) Successful in 5m42s
CI / docker (pull_request) Successful in 58s
CI / coverage (pull_request) Successful in 7m35s
CI / build (push) Successful in 21s
CI / docker (push) Has been skipped
CI / benchmark-regression (pull_request) Failing after 49m24s
CI / lint (push) Successful in 22s
CI / quality (push) Successful in 39s
CI / security (push) Successful in 48s
CI / typecheck (push) Successful in 1m26s
CI / benchmark-regression (push) Has been skipped
CI / e2e_tests (push) Successful in 5m53s
CI / coverage (push) Successful in 9m4s
CI / benchmark-publish (push) Successful in 19m10s
CI / integration_tests (push) Failing after 19m18s
CI / unit_tests (push) Failing after 19m20s
test(coverage): add Behave BDD tests to improve coverage across 52 source files
Added 52 new .feature files and corresponding _steps.py files targeting
previously uncovered code paths in the following areas:

- TUI layer: app, commands, persona (state/schema/registry), widgets,
  input (shell_exec, reference_parser)
- Application services: plan lifecycle/service/executor, session,
  project, repo indexing, correction, checkpoint, actor, llm_actors,
  strategy coordinator, resource file watcher, service retry wiring
- CLI commands: session, resource, repl, plan, db, automation_profile
- Domain models: retry_policy, resource_type, cost_budget,
  docker_compose_analyzer, detail_level, _sql_string_aware,
  _postgresql_helpers
- Core: circuit_breaker, retry_service_patterns
- Infrastructure: repositories, transaction_sandbox, strategy_registry,
  plugins/loader, container
- Config: settings
- Agents: plan_generation, context_analysis, auto_debug
- A2A: facade

All new tests follow the Behave/Gherkin BDD standard. Resolved step
definition collisions with unique prefixes. Fixed Alembic fileConfig
logger disabling issue (disable_existing_loggers=False).

ISSUES CLOSED: #1068
2026-03-20 21:22:10 +00:00

179 lines
8.8 KiB
Gherkin

Feature: Plan CLI coverage boost round 2 - remaining uncovered lines
As a developer
I want to exercise the remaining uncovered code paths in plan.py
So that code coverage improves for the plan CLI module
# ===================================================================
# _plan_spec_dict: execution_env_priority fallback (line 153)
# ===================================================================
Scenario: _plan_spec_dict uses FALLBACK when execution_env_priority is None
Given a v3 plan with execution_environment "host" and execution_env_priority None
When I call _plan_spec_dict for r2 coverage
Then the r2 spec dict should contain "execution_environment" with value "host"
And the r2 spec dict should contain "execution_env_priority" with value "fallback"
# ===================================================================
# apply command v3 lifecycle path: plan_id provided (lines 785-786)
# _lifecycle_apply_with_id happy path (lines 876-925)
# ===================================================================
Scenario: apply command delegates to _lifecycle_apply_with_id when plan_id is given
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply happy path
When I invoke r2boost apply with plan_id in rich format
Then the r2boost command should exit normally
And the r2boost output should contain "Plan Applied"
Scenario: apply command with plan_id outputs JSON format
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply happy path
When I invoke r2boost apply with plan_id and format json
Then the r2boost command should exit normally
And the r2boost output should contain "plan_id"
# ===================================================================
# _lifecycle_apply_with_id: plan not found (lines 886-888)
# ===================================================================
Scenario: _lifecycle_apply_with_id aborts when plan is not found
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply where plan is not found
When I invoke r2boost apply with plan_id in rich format
Then the r2boost command should abort
And the r2boost output should contain "not found"
# ===================================================================
# _lifecycle_apply_with_id: plan is read-only (lines 889-893)
# ===================================================================
Scenario: _lifecycle_apply_with_id aborts when plan is read-only
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply where plan is read-only
When I invoke r2boost apply with plan_id in rich format
Then the r2boost command should abort
And the r2boost output should contain "read-only"
# ===================================================================
# _lifecycle_apply_with_id: InvalidPhaseTransitionError (lines 927-929)
# ===================================================================
Scenario: _lifecycle_apply_with_id handles InvalidPhaseTransitionError
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply that raises InvalidPhaseTransitionError
When I invoke r2boost apply with plan_id in rich format
Then the r2boost command should abort
And the r2boost output should contain "Invalid transition"
# ===================================================================
# _lifecycle_apply_with_id: PlanNotReadyError (lines 930-932)
# ===================================================================
Scenario: _lifecycle_apply_with_id handles PlanNotReadyError
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply that raises PlanNotReadyError
When I invoke r2boost apply with plan_id in rich format
Then the r2boost command should abort
And the r2boost output should contain "Plan not ready"
# ===================================================================
# _lifecycle_apply_with_id: ValueError (lines 933-937)
# ===================================================================
Scenario: _lifecycle_apply_with_id handles ValueError
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply that raises ValueError
When I invoke r2boost apply with plan_id in rich format
Then the r2boost command should abort
And the r2boost output should contain "Execution Error"
# ===================================================================
# _lifecycle_apply_with_id: CleverAgentsError (lines 938-940)
# ===================================================================
Scenario: _lifecycle_apply_with_id handles CleverAgentsError
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost apply that raises CleverAgentsError
When I invoke r2boost apply with plan_id in rich format
Then the r2boost command should abort
And the r2boost output should contain "Error"
# ===================================================================
# _get_plan_executor: lifecycle_service=None fallback (line 1249)
# ===================================================================
Scenario: _get_plan_executor calls _get_lifecycle_service when not provided
Given a mocked container for r2boost plan executor
When I call _get_plan_executor without lifecycle_service
Then the r2boost plan executor should be returned
# ===================================================================
# execute_plan: plan not found after phase checking (lines 1838-1839)
# ===================================================================
Scenario: execute_plan aborts when plan not found after phase check
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost execute where plan vanishes
When I invoke r2boost execute with plan_id
Then the r2boost command should abort
And the r2boost output should contain "not found"
# ===================================================================
# execute_plan: PreflightRejection handler (lines 1898-1899)
# ===================================================================
Scenario: execute_plan handles PreflightRejection
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost execute that raises PreflightRejection
When I invoke r2boost execute with plan_id
Then the r2boost command should abort
And the r2boost output should contain "Pre-flight check failed"
# ===================================================================
# execute_plan: ValueError handler (lines 1910-1911)
# ===================================================================
Scenario: execute_plan handles ValueError from provider resolution
Given a r2boost CLI runner
And a mocked lifecycle service for r2boost execute that raises ValueError
When I invoke r2boost execute with plan_id
Then the r2boost command should abort
And the r2boost output should contain "Execution Error"
# ===================================================================
# resume_plan: rich output with no decision_id, no checkpoint, no sandbox
# (lines 2904, 2909, 2914 - the else "" branches)
# ===================================================================
Scenario: resume_plan rich output with all optional fields as None
Given a r2boost CLI runner
And a mocked resume service for r2boost with no optional fields
When I invoke r2boost plan resume in rich format
Then the r2boost command should exit normally
And the r2boost output should contain "Resume Summary"
And the r2boost output should not contain "Decision ID"
And the r2boost output should not contain "Checkpoint"
And the r2boost output should not contain "Sandbox"
# ===================================================================
# tree_decisions_cmd: TABLE format with show_superseded (line 3299)
# ===================================================================
Scenario: tree command in table format shows all decisions including superseded
Given a r2boost CLI runner
And a mocked decision service for r2boost tree with superseded decisions
When I invoke r2boost tree in table format with show-superseded
Then the r2boost command should exit normally
And the r2boost output should contain "Decision Tree"
# ===================================================================
# tree_decisions_cmd: TABLE format long chosen_option truncation (line 3331)
# ===================================================================
Scenario: tree command in table format truncates long chosen_option
Given a r2boost CLI runner
And a mocked decision service for r2boost tree with long chosen option
When I invoke r2boost tree in table format
Then the r2boost command should exit normally
And the r2boost output should contain "Decision Tree"