Skip to content

test: expand validate-pack test coverage from 3 to 20 cases#751

Open
BBridgeers wants to merge 1 commit into
aeonfun:mainfrom
BBridgeers:hermes/expand-validate-pack-tests
Open

test: expand validate-pack test coverage from 3 to 20 cases#751
BBridgeers wants to merge 1 commit into
aeonfun:mainfrom
BBridgeers:hermes/expand-validate-pack-tests

Conversation

@BBridgeers

Copy link
Copy Markdown
Contributor

What

Expands scripts/tests/test_validate_pack.sh from 3 test cases to 20, covering every ERROR and WARNING path in scripts/validate-pack.sh that was previously untested.

Why

The existing test suite only verified duplicate slug detection (2 cases) and clean pack validation (1 case). The validator enforces many more structural invariants — invalid slugs, path traversal, missing SKILL.md, invalid JSON, empty skills arrays, missing manifests, unknown capabilities, non-array capabilities, unknown categories, missing frontmatter fields, orphan on-disk skills, missing license files, dot slugs, and the --path subdirectory flag. Without test coverage, regressions in any of these paths would go undetected.

New test cases

# Path tested Expected result
4 Invalid slug (special chars) ERROR
5 Path traversal (..) ERROR
6 Missing SKILL.md for declared skill ERROR
7 Invalid JSON manifest ERROR
8 Empty skills array ERROR
9 Missing manifest file ERROR
10 Missing recommended fields (name/version/etc.) WARNING
11 Unknown capability value ERROR
12 Non-array capabilities type ERROR
13 Unknown category WARNING
14 Skill with no slug ERROR
15 SKILL.md missing name/description frontmatter WARNING
16 On-disk skill not in manifest WARNING
17 Missing LICENSE file and field WARNING
18 Dot slug (.) ERROR
19 Valid capabilities pass OK
20 --path flag for subdirectory manifest OK

Tests 1–3 (duplicate slug, clean pack, triple duplicate) are preserved unchanged.

Each test creates an isolated temp directory, writes a targeted manifest or skill dir, runs the validator, and checks both the exit code and the expected error/warning message.

Testing

bash scripts/tests/test_validate_pack.sh
# All 20 validate-pack tests passed.

The existing test suite only covered duplicate slug detection (2 cases)
and clean pack validation (1 case). The validator checks many more
structural invariants — invalid slugs, path traversal, missing SKILL.md,
invalid JSON, empty skills, missing manifest, unknown capabilities,
non-array capabilities, unknown categories, missing frontmatter fields,
orphan on-disk skills, missing license, dot slugs, and the --path flag.

This adds 17 new test cases covering every ERROR and WARNING path in
validate-pack.sh that was previously untested, plus a --path subdirectory
test.

Each test creates an isolated temp directory, writes a targeted manifest
or skill dir, runs the validator, and checks both the exit code and
the expected error/warning message.
@imancipate

Copy link
Copy Markdown

Triage: DEFER — size (595 lines added+deleted) exceeds the 500-line threshold for first-touch triage.
This PR is sound but needs maintainer attention before it can move (reason above). Leaving open and labelled triage:deferred; @aaronjmars will pick it up on the next review pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants