Files
cleveragents-core/features/mcp_adapter_coverage_r3.feature
freemo 31472b5413
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 22s
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 3m58s
CI / security (pull_request) Successful in 4m8s
CI / integration_tests (pull_request) Successful in 9m33s
CI / unit_tests (pull_request) Successful in 10m12s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 12m18s
CI / e2e_tests (pull_request) Successful in 19m51s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 15s
CI / helm (push) Successful in 22s
CI / lint (push) Successful in 3m18s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 3m57s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m10s
CI / unit_tests (push) Failing after 6m58s
CI / docker (push) Has been skipped
CI / integration_tests (push) Successful in 9m15s
CI / coverage (push) Successful in 12m26s
CI / e2e_tests (push) Successful in 23m11s
CI / status-check (push) Failing after 1s
CI / benchmark-publish (push) Successful in 28m31s
CI / benchmark-regression (pull_request) Successful in 54m53s
test(coverage): add Behave scenarios for 39 under-covered modules
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate.

ISSUES CLOSED: #1232
2026-03-31 21:47:12 +00:00

72 lines
3.9 KiB
Gherkin
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Feature: MCP Adapter coverage round 3
Exercise uncovered lines in src/cleveragents/mcp/adapter.py:
- L25 TYPE_CHECKING import (runtime-untestable, skipped)
- L131 MCPTransport.connect() raises NotImplementedError
- L135-136 MCPTransport.call() raises NotImplementedError
- L348-352 dispatch_notification catches listener exceptions
- L531-535 register_tools builds slot_dicts from inferred resource slots
# -----------------------------------------------------------------
# Base MCPTransport abstract methods (lines 131, 135-136)
# -----------------------------------------------------------------
Scenario: Base MCPTransport connect raises NotImplementedError
Given mcpcov3 a bare MCPTransport instance
When mcpcov3 I call connect on the base transport
Then mcpcov3 the error should be a NotImplementedError
Scenario: Base MCPTransport call raises NotImplementedError
Given mcpcov3 a bare MCPTransport instance
When mcpcov3 I call call on the base transport with method "tools/list" and params
Then mcpcov3 the error should be a NotImplementedError
# -----------------------------------------------------------------
# Notification listener exception handling (lines 348-352)
# -----------------------------------------------------------------
Scenario: Dispatch notification swallows listener exception
Given mcpcov3 a connected adapter with a notification listener that raises
When mcpcov3 I dispatch notification "tools/list_changed" with no params
Then mcpcov3 no error should propagate
And mcpcov3 the healthy listener should have received the notification
Scenario: Dispatch notification with all listeners failing
Given mcpcov3 a connected adapter with only failing notification listeners
When mcpcov3 I dispatch notification "tools/list_changed" with no params
Then mcpcov3 no error should propagate
# -----------------------------------------------------------------
# Resource slot inference in register_tools (lines 531-535)
# -----------------------------------------------------------------
Scenario: Register tools with file_path param infers file resource slot
Given mcpcov3 a connected adapter with a tool having file_path in its schema
And mcpcov3 an empty tool registry
When mcpcov3 I register tools with namespace "mcp-fs"
Then mcpcov3 the registry should contain tool "mcp-fs/write_file"
And mcpcov3 tool "mcp-fs/write_file" source_metadata should have resource_slots
And mcpcov3 resource slot 0 should have name "file" and type "file"
Scenario: Register tools with directory param infers directory resource slot
Given mcpcov3 a connected adapter with a tool having directory in its schema
And mcpcov3 an empty tool registry
When mcpcov3 I register tools with namespace "mcp-fs"
Then mcpcov3 the registry should contain tool "mcp-fs/list_dir"
And mcpcov3 tool "mcp-fs/list_dir" source_metadata should have resource_slots
And mcpcov3 resource slot 0 should have name "directory" and type "directory"
Scenario: Register tools with repo_path param infers repository resource slot
Given mcpcov3 a connected adapter with a tool having repo_path in its schema
And mcpcov3 an empty tool registry
When mcpcov3 I register tools with namespace "mcp-git"
Then mcpcov3 the registry should contain tool "mcp-git/git_status"
And mcpcov3 tool "mcp-git/git_status" source_metadata should have resource_slots
And mcpcov3 resource slot 0 should have name "repository" and type "git-checkout"
Scenario: Register tools with multiple resource params infers multiple slots
Given mcpcov3 a connected adapter with a tool having file_path and directory in its schema
And mcpcov3 an empty tool registry
When mcpcov3 I register tools with namespace "mcp-multi"
Then mcpcov3 the registry should contain tool "mcp-multi/copy_file"
And mcpcov3 tool "mcp-multi/copy_file" source_metadata should have resource_slots with count 2