Files
cleveragents-core/features/plan_cli_coverage_r3.feature
CoreRasurae cc24d8c8ac fix(cli): remove legacy plan commands from help output
Completely removed all legacy plan commands from the CLI:
    - Removed tell, build, new, current, cd, continue CLI commands
    - Removed programmatic wrapper functions (tell_command, build_command, etc.)
    - Removed legacy deprecation message
    - Updated help text to indicate V3 Plan Lifecycle exclusively
    - Removed stale references to tell/build in help output and command validation

    Removes the legacy 'tell' and 'build' CLI shortcuts from main.py:
    - Removed echo lines advertising tell/build commands
    - Removed tell/build from valid_cmds list
    - Removed tell/build from _LIGHTWEIGHT_COMMANDS frozenset
    - These dead entries were preventing helpful error messages

    Test infrastructure improvements:
    - Event bus exception test: Patch the module-level logger during emit() so that
      structlog.testing.capture_logs() can capture the logs. Without patching, the
      module-level logger created at import time is not captured by the context manager.
    - Session create/list commands: Suppress cleveragents.mcp logger to CRITICAL level
      during JSON/YAML output formatting to prevent health check warnings with ANSI codes
      from being written to stdout before JSON output, which breaks JSON parsing.
    - Extended plan_cli_coverage_boost with scenarios for estimation_result,
      invariants, execution_environment, validation_summary, and checkpoint
      coverage in _plan_spec_dict

    Documentation:
    - Created docs/Legacy_to_V3_Guide.md with comprehensive migration instructions
    - Updated CONTRIBUTING.md to document removal of legacy workflow
    - Updated CHANGELOG.md to reference issue #4181 instead of PR #10800

ISSUES CLOSED: #4181
2026-05-05 02:01:49 +00:00

96 lines
4.5 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"
# ── 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 "01ARZ3NDEKTSV4RRFFQ69G5FAA"
Then the plcov3 CLI exit code should be 0
# ── apply command no eligible plans path ─────────────────────────
Scenario: apply command legacy path with pending changes
Given a plcov3 CLI runner
And a plcov3 mocked lifecycle service with no eligible apply plans
When I plcov3 invoke apply without plan_id
Then the plcov3 CLI output should contain "No plans ready for apply"
Scenario: apply command legacy path with no pending changes
Given a plcov3 CLI runner
And a plcov3 mocked lifecycle service with no eligible apply plans
When I plcov3 invoke apply without plan_id
Then the plcov3 CLI output should contain "No plans ready for apply"
# ── 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"