diff --git a/features/skill_schema.feature b/features/skill_schema.feature index f800b3160..ae3cbf2ef 100644 --- a/features/skill_schema.feature +++ b/features/skill_schema.feature @@ -316,7 +316,6 @@ Feature: Skill YAML schema validation # ──────────────────────────────────────────────────────────── @tdd_issue @tdd_issue_1472 - Scenario: Load spec-compliant YAML with skill: wrapper key Given a spec-compliant skill YAML with skill: wrapper key When I validate the skill schema @@ -324,36 +323,48 @@ Feature: Skill YAML schema validation And the skill config name should be "local/wrapped-skill" And the skill config should have 1 tools + @tdd_issue + @tdd_issue_1472 Scenario: Load spec-compliant YAML with cleveragents: header and skill: wrapper Given a spec-compliant skill YAML with cleveragents: header and skill: wrapper When I validate the skill schema Then the skill schema validation should succeed And the skill config name should be "local/wrapped-with-meta" + @tdd_issue + @tdd_issue_1472 Scenario: skill: wrapper key with None value raises ValueError Given a skill YAML with skill: wrapper key with None value When I validate the skill schema expecting failure Then the skill schema validation should fail And the skill schema error should mention "empty" + @tdd_issue + @tdd_issue_1472 Scenario: skill: wrapper key with non-dict value raises ValueError Given a skill YAML with skill: wrapper key and string value When I validate the skill schema expecting failure Then the skill schema validation should fail And the skill schema error should mention "mapping" + @tdd_issue + @tdd_issue_1472 Scenario: skill: wrapper key with list value raises ValueError Given a skill YAML with skill: wrapper key and list value When I validate the skill schema expecting failure Then the skill schema validation should fail And the skill schema error should mention "mapping" + @tdd_issue + @tdd_issue_1472 Scenario: Flat YAML without wrapper key still works (backward compatibility) Given a skill YAML string with only the name field When I validate the skill schema Then the skill schema validation should succeed And the skill config name should be "local/empty-skill" + @tdd_issue + @tdd_issue_1472 Scenario: cleveragents: header alone (flat format with metadata, no skill: wrapper) Given a skill YAML with cleveragents: header and flat format When I validate the skill schema diff --git a/robot/skill_schema.robot b/robot/skill_schema.robot index 0e4d7457c..0d0018ec8 100644 --- a/robot/skill_schema.robot +++ b/robot/skill_schema.robot @@ -49,3 +49,15 @@ Reject Invalid Skill YAML Should Be Equal As Integers ${result.rc} 0 Should Contain ${result.stdout} skill-schema-expected-fail +Validate Spec-Compliant Skill YAML With skill: Wrapper Key + [Tags] tdd_issue tdd_issue_1472 + [Documentation] Parse a spec-compliant YAML with cleveragents: header and skill: wrapper key + ${wrapped_yaml}= Set Variable ${TEMPDIR}${/}wrapped_skill.yaml + ${yaml_content}= Set Variable cleveragents:\n version: "1.0"\nskill:\n name: local/wrapped-skill\n description: "A wrapped skill"\n + Create File ${wrapped_yaml} ${yaml_content} + ${result}= Run Process ${PYTHON} ${HELPER} validate ${wrapped_yaml} cwd=${WORKSPACE} + Log ${result.stdout} + Log ${result.stderr} + Should Be Equal As Integers ${result.rc} 0 + Should Contain ${result.stdout} skill-schema-ok + diff --git a/src/cleveragents/skills/schema.py b/src/cleveragents/skills/schema.py index d54a6f65f..8bf107c17 100644 --- a/src/cleveragents/skills/schema.py +++ b/src/cleveragents/skills/schema.py @@ -465,7 +465,8 @@ class SkillConfigSchema(BaseModel): # Merge wrapper content with normalized keys. # Wrapper values take precedence so the spec-compliant # format works reliably even if both formats overlap. - for key, value in wrapper.items(): + wrapper_dict: dict[str, Any] = wrapper + for key, value in wrapper_dict.items(): snake_key = _CAMEL_TO_SNAKE.get(key, key) normalized[snake_key] = value