Files
cleveragents-core/features/cli_legacy_removal_coverage.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

131 lines
5.9 KiB
Gherkin

Feature: CLI Legacy Removal Coverage Boost
As a developer working on CLI legacy removal
I want comprehensive coverage of safe initialization and cleanup paths
So that code coverage meets the 97% threshold
Background:
Given a clean test environment for CLI plan coverage
# =============================================================================
# Safe Initialization and Cleanup - Plan Envelope Building
# =============================================================================
Scenario: Build execute envelope with estimation result
Given CLI plan command module is available for testing
And a mock plan with estimation result for envelope testing
When I build execute envelope for the mock plan
Then the envelope contains estimation data
And all test objects are properly cleaned up
Scenario: Build execute envelope without estimation result
Given CLI plan command module is available for testing
And a mock plan without estimation result
When I build execute envelope for plan without estimation
Then the envelope contains default strategy summary
And all test objects are properly cleaned up
Scenario: Build execute envelope for legacy plan
Given CLI plan command module is available for testing
And a legacy plan object (not LifecyclePlan)
When I build execute envelope for legacy plan
Then the envelope contains legacy fallback data
And all test objects are properly cleaned up
# =============================================================================
# Safe Initialization and Cleanup - Sandbox Cleanup
# =============================================================================
Scenario: Cleanup sandbox with empty plan ID
Given CLI plan command module is available for testing
And a mock PlanLifecycleService for cleanup testing
When I call cleanup sandbox with empty plan ID
Then cleanup completes without error for empty plan ID
And all test objects are properly cleaned up
Scenario: Cleanup sandbox with whitespace-only plan ID
Given CLI plan command module is available for testing
And a mock PlanLifecycleService for cleanup testing
When I call cleanup sandbox with whitespace-only plan ID
Then cleanup completes without error for whitespace plan ID
And all test objects are properly cleaned up
Scenario: Cleanup sandbox for non-existent plan
Given CLI plan command module is available for testing
And a mock PlanLifecycleService for cleanup testing
When I call cleanup sandbox for non-existent plan
Then cleanup completes without error for non-existent plan
And all test objects are properly cleaned up
# =============================================================================
# Safe Initialization and Cleanup - Project Retrieval
# =============================================================================
Scenario: Get current project when no project exists
Given CLI plan command module is available for testing
And the container returns no current project
When I attempt to get current project
Then typer Abort is raised
And all test objects are properly cleaned up
# =============================================================================
# Safe Initialization and Cleanup - Status Building
# =============================================================================
Scenario: Build status result with validation summary
Given CLI plan command module is available for testing
And a mock plan with validation summary
When I build status result for plan with validation
Then the status contains DoD evaluation data
And all test objects are properly cleaned up
Scenario: Build status result with error message
Given CLI plan command module is available for testing
And a mock plan with error message
When I build status result for plan with error
Then the status contains error message
And all test objects are properly cleaned up
Scenario: Build status result with step information
Given CLI plan command module is available for testing
And a mock plan with last completed step
When I build status result for plan with step info
Then the status contains last completed step
And all test objects are properly cleaned up
# =============================================================================
# Safe Initialization and Cleanup - Plan Display
# =============================================================================
Scenario: Print lifecycle plan with project links
Given CLI plan command module is available for testing
And a mock lifecycle plan with project links
When I print lifecycle plan with project links
Then the output contains project link with alias
And the output contains read-only indicator
And all test objects are properly cleaned up
Scenario: Print lifecycle plan for legacy plan
Given CLI plan command module is available for testing
And a legacy plan object (not LifecyclePlan)
When I print lifecycle plan details for legacy plan
Then the legacy plan is displayed in a panel
And all test objects are properly cleaned up
# =============================================================================
# Safe Initialization and Cleanup - Progress Status
# =============================================================================
Scenario: Progress steps show error for errored plan
Given CLI plan command module is available for testing
And a mock plan in errored state
When I build execute envelope for errored plan
Then the progress shows error status for first step
And all test objects are properly cleaned up
Scenario: Progress steps show complete for applied plan
Given CLI plan command module is available for testing
And a mock plan in completed state
When I build execute envelope for completed plan
Then all progress steps show complete status
And all test objects are properly cleaned up