@phase2 @a2a @server-cli-coverage Feature: Server CLI command coverage boost As a developer I want full test coverage for server.py CLI commands So that the server_connect (rich format), server_status, and resolve_server_mode error paths are all exercised # ----------------------------------------------------------------------- # resolve_server_mode — exception paths (lines 58-59) # ----------------------------------------------------------------------- Scenario: resolve_server_mode returns disabled when resolve raises ValueError Given a mock config service that raises ValueError on resolve When I call resolve_server_mode with the mock Then the server mode should be "disabled" Scenario: resolve_server_mode returns disabled when resolve raises KeyError Given a mock config service that raises KeyError on resolve When I call resolve_server_mode with the mock Then the server mode should be "disabled" # ----------------------------------------------------------------------- # server_connect — rich format output (lines 132-142) # ----------------------------------------------------------------------- Scenario: server_connect renders Rich Panel when format is rich Given a mock config service that accepts writes When I call server_connect with url "https://rich.example.com" and rich format Then the captured console output should contain "Server Connection (Stub)" And the captured console output should contain "https://rich.example.com" And the captured console output should contain "stubbed" And the captured console output should contain "not yet implemented" Scenario: server_connect rich output includes namespace and TLS verify Given a mock config service that accepts writes When I call server_connect with url "https://ns.example.com" namespace "my-team" tls_verify false and rich format Then the captured console output should contain "my-team" And the captured console output should contain "False" # ----------------------------------------------------------------------- # server_status — full function, no URL configured (lines 157-204) # ----------------------------------------------------------------------- Scenario: server_status with json format when no URL is configured Given a mock config service that resolves with no server config When I call server_status with format "json" Then the echoed output should contain "disabled" And the echoed output should contain "server_mode" Scenario: server_status with plain format when no URL is configured Given a mock config service that resolves with no server config When I call server_status with format "plain" Then the echoed output should contain "disabled" # ----------------------------------------------------------------------- # server_status — URL is configured (stubbed mode) # ----------------------------------------------------------------------- Scenario: server_status with json format when URL is configured Given a mock config service that resolves with full server config When I call server_status with format "json" Then the echoed output should contain "stubbed" And the echoed output should contain "https://configured.example.com" And the echoed output should contain "production" # ----------------------------------------------------------------------- # server_status — rich format rendering (lines 196-206) # ----------------------------------------------------------------------- Scenario: server_status renders Rich Panel when format is rich and no URL Given a mock config service that resolves with no server config When I call server_status with format "rich" Then the captured console output should contain "Server Status" And the captured console output should contain "disabled" And the captured console output should contain "(not configured)" Scenario: server_status renders Rich Panel when format is rich and URL is configured Given a mock config service that resolves with full server config When I call server_status with format "rich" Then the captured console output should contain "Server Status" And the captured console output should contain "stubbed" And the captured console output should contain "https://configured.example.com" # ----------------------------------------------------------------------- # server_status — exception paths for namespace / tls-verify (lines 168-183) # ----------------------------------------------------------------------- Scenario: server_status defaults namespace when resolve raises ValueError Given a mock config service where namespace resolve raises ValueError When I call server_status with format "json" Then the echoed output should contain "default" Scenario: server_status defaults tls_verify when resolve raises KeyError Given a mock config service where tls-verify resolve raises KeyError When I call server_status with format "json" Then the echoed output should contain "true" Scenario: server_status defaults all fields when all resolves raise exceptions Given a mock config service where all resolves raise exceptions When I call server_status with format "json" Then the echoed output should contain "disabled" And the echoed output should contain "null" And the echoed output should contain "default" # ----------------------------------------------------------------------- # server_serve — uvicorn.run argument mapping # ----------------------------------------------------------------------- Scenario: server_serve maps explicit CLI arguments to uvicorn.run Given uvicorn run is patched for server serve assertions When I call server_serve with app "cleveragents.a2a.asgi:app" host "127.0.0.1" port 9001 workers 3 and log level "warning" Then uvicorn run should be called with app "cleveragents.a2a.asgi:app" host "127.0.0.1" port 9001 workers 3 and log level "warning" Scenario: server_serve uses documented defaults for uvicorn.run Given uvicorn run is patched for server serve assertions When I call server_serve with default arguments Then uvicorn run should be called with app "cleveragents.a2a.asgi:app" host "0.0.0.0" port 8000 workers 1 and log level "info" Scenario: server_serve exits cleanly when uvicorn is unavailable Given uvicorn run is unavailable for server serve assertions When I call server_serve with default arguments and capture failure Then server_serve should exit with code 1 And the captured console output should contain "optional dependency 'uvicorn' is not installed" Scenario: server_serve normalizes log level via Typer option parsing Given uvicorn run is patched for server serve assertions When I invoke server_serve through the CLI with log level "WARNING" Then uvicorn run should be called with app "cleveragents.a2a.asgi:app" host "0.0.0.0" port 8000 workers 1 and log level "warning" Scenario: server_serve rejects invalid log level via Typer option parsing Given uvicorn run is patched for server serve assertions When I invoke server_serve through the CLI with invalid log level "LOUD" Then the CLI invocation should fail with exit code 2 And the server CLI invocation output should contain "Invalid value for '--log-level'"