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

81 lines
3.8 KiB
Gherkin

Feature: Session CLI MCP logger suppression execution coverage
As a developer
I want to ensure the MCP logger suppression code is actually executed
So that coverage includes lines 190-200, 266-272, 294-307
Background:
Given a clean test database for session cli execution tests
And a mock A2A facade for session cli execution tests
# --- Session create command execution ---
Scenario: Session create with JSON format executes MCP logger suppression
Given the database is initialized for session cli execution tests
When I execute session create with format json
Then the MCP logger should be set to CRITICAL during execution
And the MCP logger should be restored after execution
Scenario: Session create with YAML format executes MCP logger suppression
Given the database is initialized for session cli execution tests
When I execute session create with format yaml
Then the MCP logger should be set to CRITICAL during execution
And the MCP logger should be restored after execution
Scenario: Session create with plain format executes MCP logger suppression
Given the database is initialized for session cli execution tests
When I execute session create with format plain
Then the MCP logger should be set to CRITICAL during execution
Scenario: Session create with rich format does NOT suppress MCP logger
Given the database is initialized for session cli execution tests
When I execute session create with format rich
Then the MCP logger should NOT be set to CRITICAL
Scenario: Session create with color format does NOT suppress MCP logger
Given the database is initialized for session cli execution tests
When I execute session create with format color
Then the MCP logger should NOT be set to CRITICAL
# --- Session list command execution ---
Scenario: Session list with JSON format executes MCP logger suppression
Given the database is initialized for session cli execution tests
When I execute session list with format json
Then the MCP logger should be set to CRITICAL during execution
And the MCP logger should be restored after execution
Scenario: Session list with YAML format executes MCP logger suppression
Given the database is initialized for session cli execution tests
When I execute session list with format yaml
Then the MCP logger should be set to CRITICAL during execution
And the MCP logger should be restored after execution
Scenario: Session list with table format executes MCP logger suppression
Given the database is initialized for session cli execution tests
When I execute session list with format table
Then the MCP logger should be set to CRITICAL during execution
Scenario: Session list with rich format does NOT suppress MCP logger
Given the database is initialized for session cli execution tests
When I execute session list with format rich
Then the MCP logger should NOT be set to CRITICAL
Scenario: Session list with color format does NOT suppress MCP logger
Given the database is initialized for session cli execution tests
When I execute session list with format color
Then the MCP logger should NOT be set to CRITICAL
# --- Exception handling ---
Scenario: Session create restores MCP logger even on exception
Given the database is initialized for session cli execution tests
And the session service raises an exception on create
When I execute session create with format json catching exception
Then the MCP logger should be restored in the finally block
Scenario: Session list restores MCP logger even on exception
Given the database is initialized for session cli execution tests
And the session service raises an exception on list
When I execute session list with format json catching exception
Then the MCP logger should be restored in the finally block