Files
cleveragents-core/features/skills_registry_coverage_boost.feature
freemo a808c395f9 test(coverage): add Behave BDD tests to improve unit test coverage across 53 source modules
Add 53 new .feature files and corresponding step definition files targeting
uncovered lines identified in build/coverage.xml. Fix AmbiguousStep conflicts
in 7 pre-existing step files by disambiguating step text.

New tests cover: ACP clients/facade, actor CLI/config, application container,
ACMS service/strategies, async worker, automation profile CLI, autonomy
guardrail, bridge, change model, config CLI/service, context service,
cross-plan correction, database models, decision service, decomposition
clustering/service, discovery handler, langchain chat provider, langgraph
nodes, materializers, multi-project service, plan apply/CLI/lifecycle/model/
preflight/resume/service, PostgreSQL analyzer, project CLI/context CLI,
provider registry, reactive application/route, repositories, resolver handler,
resource registry service, resume model, retry patterns, sandbox protocol,
server CLI, skill CLI/service, skills registry, subplan execution/service,
system CLI, UKO loader, UoW, and YAML template engine.

Closes #645
2026-03-09 13:01:58 -04:00

98 lines
5.0 KiB
Gherkin

@skill_registry_coverage
Feature: Skill Registry coverage boost
As a developer improving test coverage
I want to exercise the uncovered code paths in SkillRegistry
So that lines 270-278, 314-315, and 324 are covered
Background:
Given a fresh SkillRegistry instance
# ---------------------------------------------------------------------------
# validate_plan with tool registry configured (lines 270-278)
# ---------------------------------------------------------------------------
@validate_plan_tool_registry
Scenario: validate_plan reports missing tool when tool registry returns None
Given the registry has a tool registry mock configured
And a registered skill "local/web-tools" having tool ref "local/fetch"
And the tool registry mock returns None for tool "local/fetch"
When I validate a plan referencing skill "local/web-tools"
Then the skills validation errors should contain "Tool 'local/fetch' in skill 'local/web-tools' not found in tool registry"
@validate_plan_tool_registry
Scenario: validate_plan passes when all tool refs exist in tool registry
Given the registry has a tool registry mock configured
And a registered skill "local/web-tools" having tool ref "local/fetch"
And the tool registry mock returns a tool for "local/fetch"
When I validate a plan referencing skill "local/web-tools"
Then the validation errors should be empty
@validate_plan_tool_registry
Scenario: validate_plan skips inline entries during tool registry validation
Given the registry has a tool registry mock configured
And a registered skill "local/inline-skill" having only an inline tool
When I validate a plan referencing skill "local/inline-skill"
Then the validation errors should be empty
And the tool registry mock get_tool should not have been called
@validate_plan_tool_registry
Scenario: validate_plan skips mcp-prefixed entries during tool registry validation
Given the registry has a tool registry mock configured
And a registered skill "local/mcp-skill" having only MCP tools
When I validate a plan referencing skill "local/mcp-skill"
Then the validation errors should be empty
@validate_plan_tool_registry
Scenario: validate_plan skips agent_skill-prefixed entries during tool registry validation
Given the registry has a tool registry mock configured
And a registered skill "local/agent-skill" having only agent skill sources
When I validate a plan referencing skill "local/agent-skill"
Then the validation errors should be empty
# ---------------------------------------------------------------------------
# refresh exception handling (lines 314-315)
# ---------------------------------------------------------------------------
@refresh_failure
Scenario: refresh returns failed result when resolve_tools raises ValueError
Given a registered skill "local/cyclic-a" including "local/cyclic-b"
And a registered skill "local/cyclic-b" including "local/cyclic-a"
When I refresh the coverage boost skill "local/cyclic-a"
Then the refresh result should have "local/cyclic-a" in failed
And the refresh result should have zero refreshed
@refresh_failure
Scenario: refresh returns failed result when resolve_tools raises RuntimeError
Given a registered skill "local/broken" that will cause RuntimeError on resolve
When I refresh the coverage boost skill "local/broken"
Then the refresh result should have "local/broken" in failed
And the refresh failed message for "local/broken" should contain "resolver broke"
# ---------------------------------------------------------------------------
# refresh skips inline / mcp / agent_skill entries (line 324)
# ---------------------------------------------------------------------------
@refresh_skip_inline
Scenario: refresh skips inline tools when checking tool registry
Given the registry has a tool registry mock configured
And a registered skill "local/mixed" having inline tool plus tool ref "local/lint"
And the tool registry mock returns a tool for "local/lint"
When I refresh the coverage boost skill "local/mixed"
Then the refresh result should have "local/mixed" in refreshed
@refresh_skip_inline
Scenario: refresh skips mcp-prefixed tools when checking tool registry
Given the registry has a tool registry mock configured
And a registered skill "local/mcp-check" having MCP tools plus tool ref "local/lint"
And the tool registry mock returns a tool for "local/lint"
When I refresh the coverage boost skill "local/mcp-check"
Then the refresh result should have "local/mcp-check" in refreshed
@refresh_skip_inline
Scenario: refresh skips agent_skill-prefixed tools when checking tool registry
Given the registry has a tool registry mock configured
And a registered skill "local/agent-check" having agent skill plus tool ref "local/lint"
And the tool registry mock returns a tool for "local/lint"
When I refresh the coverage boost skill "local/agent-check"
Then the refresh result should have "local/agent-check" in refreshed