Skip to content

test(skill_utils): regression tests for non-dict metadata in extract_skill_conditions - #18213

Merged
teknium1 merged 1 commit into
mainfrom
hermes-salvage/skill-utils-metadata-tests
May 1, 2026
Merged

test(skill_utils): regression tests for non-dict metadata in extract_skill_conditions#18213
teknium1 merged 1 commit into
mainfrom
hermes-salvage/skill-utils-metadata-tests

Conversation

@teknium1

@teknium1 teknium1 commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Locks in the existing isinstance(metadata, dict) guard in extract_skill_conditions() so a future refactor cannot silently regress it back to frontmatter.get("metadata") or {} — which crashes on skills whose frontmatter has metadata: as a plain string or any other non-dict value.

Coverage added

  • metadata as a valid nested dict with hermes: keys
  • metadata as a string (malformed YAML) — the regression case
  • metadata as None
  • metadata key absent

Validation

scripts/run_tests.sh tests/agent/test_skill_utils.py — 4 passed.

Mutation-verified: removing the isinstance(metadata, dict) guard causes test_metadata_as_string_does_not_crash to fail with AttributeError: 'str' object has no attribute 'get'.

Salvaged from #16688 by @sprmn24. The original PR bundled this with two unrelated changes; splitting into separate PRs for clean review.

…act_skill_conditions

The fix for this bug (isinstance guard) was merged via commit 3ff9e01,
but test coverage was not included. Adding 4 tests:
- dict metadata with hermes keys (normal case)
- string metadata (bug case — previously caused AttributeError)
- None metadata
- missing metadata key
@teknium1
teknium1 merged commit adaee2c into main May 1, 2026
10 of 11 checks passed
@teknium1
teknium1 deleted the hermes-salvage/skill-utils-metadata-tests branch May 1, 2026 03:37
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P3 Low — cosmetic, nice to have tool/skills Skills system (list, view, manage) labels May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have tool/skills Skills system (list, view, manage) type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants