Files
cleveragents-core/features/models_skill_coverage_r2.feature

109 lines
5.6 KiB
Gherkin

Feature: SkillModel to_domain/from_domain branch coverage (round 2)
As a developer maintaining the ORM layer
I want every branch in the domain-conversion helpers tested
So that models.py achieves near-100 % branch coverage
# ===================================================================
# SkillModel.to_domain() lines 2185-2224
# Targets: uncovered lines 2188-2189, branch partials on item_type
# checks, item_config_str checks, metadata_str check
# ===================================================================
Scenario: r2mod- SkillModel.to_domain with None items_rel returns empty lists
Given a r2mod-SkillModel with no items and no metadata
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill tool_refs should be empty
And the r2mod-skill includes should be empty
And the r2mod-skill anonymous_tools should be empty
And the r2mod-skill mcp_servers should be empty
And the r2mod-skill agent_skills should be empty
And the r2mod-skill overrides should be empty
Scenario: r2mod- SkillModel.to_domain with tool_ref items
Given a r2mod-SkillModel with a tool_ref item named "local/my-tool"
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill tool_refs should contain "local/my-tool"
Scenario: r2mod- SkillModel.to_domain with include item with config overrides
Given a r2mod-SkillModel with an include item "local/inc" with config overrides
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill includes should have 1 entry
And the r2mod-skill first include name should be "local/inc"
And the r2mod-skill first include overrides should not be None
Scenario: r2mod- SkillModel.to_domain with include item without config
Given a r2mod-SkillModel with an include item "local/inc" without config
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill includes should have 1 entry
And the r2mod-skill first include overrides should be None
Scenario: r2mod- SkillModel.to_domain with inline_tool item without config (skipped)
Given a r2mod-SkillModel with an inline_tool item without config
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill anonymous_tools should be empty
Scenario: r2mod- SkillModel.to_domain with mcp_source item without config (skipped)
Given a r2mod-SkillModel with an mcp_source item without config
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill mcp_servers should be empty
Scenario: r2mod- SkillModel.to_domain with agent_source item
Given a r2mod-SkillModel with an agent_source item "path/to/agent"
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill agent_skills should have 1 entry
And the r2mod-skill first agent_skill path should be "path/to/agent"
Scenario: r2mod- SkillModel.to_domain with metadata_json containing overrides
Given a r2mod-SkillModel with metadata_json containing overrides
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill overrides should not be empty
Scenario: r2mod- SkillModel.to_domain with inline_tool and mcp_source with config
Given a r2mod-SkillModel with inline_tool and mcp_source items with config
When I r2mod-convert the SkillModel to domain
Then the r2mod-skill anonymous_tools should have 1 entry
And the r2mod-skill mcp_servers should have 1 entry
# ===================================================================
# SkillModel.from_domain() — lines 2227-2366
# Targets: ValueError branch, overrides branch, include-as-string,
# anonymous_tools-as-dict, mcp_servers-as-dict,
# agent_skills-as-string
# ===================================================================
Scenario: r2mod- SkillModel.from_domain raises ValueError for invalid name
When I r2mod-attempt from_domain on SkillModel with name "badname"
Then a r2mod-ValueError should have been raised
Scenario: r2mod- SkillModel.from_domain with no overrides
When I r2mod-create SkillModel from domain with name "ns/sk" and no overrides
Then the r2mod-created SkillModel metadata_json should be None
Scenario: r2mod- SkillModel.from_domain with overrides
When I r2mod-create SkillModel from domain with name "ns/sk" and overrides
Then the r2mod-created SkillModel metadata_json should contain "overrides"
Scenario: r2mod- SkillModel.from_domain with include as string
When I r2mod-create SkillModel from domain with includes as strings
Then the r2mod-created SkillModel should have include items
Scenario: r2mod- SkillModel.from_domain with anonymous_tools as dict
When I r2mod-create SkillModel from domain with anonymous_tools as dicts
Then the r2mod-created SkillModel should have inline_tool items
Scenario: r2mod- SkillModel.from_domain with mcp_servers as dict
When I r2mod-create SkillModel from domain with mcp_servers as dicts
Then the r2mod-created SkillModel should have mcp_source items
Scenario: r2mod- SkillModel.from_domain with agent_skills as string
When I r2mod-create SkillModel from domain with agent_skills as strings
Then the r2mod-created SkillModel should have agent_source items
Scenario: r2mod- SkillModel.from_domain with anonymous_tools fallback branch
When I r2mod-create SkillModel from domain with anonymous_tools as plain objects
Then the r2mod-created SkillModel should have inline_tool items
Scenario: r2mod- SkillModel.from_domain with mcp_servers fallback branch
When I r2mod-create SkillModel from domain with mcp_servers as plain objects
Then the r2mod-created SkillModel should have mcp_source items