[quality] test: unit coverage for scripts/generate_skill_index.py - #143
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
[quality] test: unit coverage for scripts/generate_skill_index.py#143kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
Adds tests/test_generate_skill_index.py — 33 unittest cases covering find_skill_files, parse_front_matter, build_skill_entry, build_catalog, validate_catalog, render_markdown and the --write/--check paths of main(). The script had no direct unit tests. The only existing coverage was TestSkillCatalogUpToDate in tests/test_live_build_invariants.py, which shells out to --check and asserts freshness; it exercises none of the error branches (missing front matter, non-mapping front matter, missing required keys, entry_point/path mismatch, schema violations). Tests run against a temporary docs/skills tree via patched module constants, so the repo's real catalog is never read or written. Assisted-by: Claude Opus 5 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
hanthor
approved these changes
Sep 2, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
tests/test_generate_skill_index.py (371 lines, test-only) exercises real failure branches — missing/non-mapping front matter, missing required keys, entry_point mismatch, real JSON-Schema validation, --check staleness distinctions — against a temp fixture tree, not smoke tests. CI log confirms only the pre-existing skill-catalog failure, which is ironically the exact bug class this suite documents.
Generated by Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Adds
tests/test_generate_skill_index.py— 33 unittest cases forscripts/generate_skill_index.py.Claimed ground (files / functions)
tests/test_generate_skill_index.py(only file touched)scripts/generate_skill_index.py:find_skill_files,parse_front_matter,build_skill_entry,build_catalog,validate_catalog,render_markdown,main(--write/--check)Why
The script is the only supported producer of
docs/skills/index.jsonandindex.md, but it had no direct unit tests. The only existing coverage isTestSkillCatalogUpToDateintests/test_live_build_invariants.py, which shells out to--checkand asserts freshness — it exercises none of the failure branches:entry_pointthat disagrees with the file pathvalidate_catalog→SystemExit(1))--checkdistinguishing a staleindex.jsonfrom a staleindex.mdIsolation
Tests patch
REPO_ROOT,SKILLS_DIR,SCHEMA_PATH,INDEX_PATHto atempfiletree (the realindex.schema.jsonis copied in), so the repo catalog is never read or written. No network, no subprocess.Result
Full suite:
136 passed, 1 failed, 2 skipped— the single failure is the pre-existingTestSkillCatalogUpToDatedaily staleness bug tracked in #137 (generated_at: date.today()), untouched by this PR.Disjointness check
Compared against every open PR in this repo: #138 (
tests/test_fisherman_install.py), #140 (dakota/src/,live/src,justfile,tests/test_live_build_invariants.py,tests/test_luks_unlock.py), #142 (justfile,live/Containerfile,scripts/verify-image-signature.sh), #124/#125/#126/#130 (.github/workflows/). None touchesscripts/generate_skill_index.pyortests/test_generate_skill_index.py.Gate note
Unit tests only — no E2E gate applies; this PR changes no ISO/build path.
Filed by quality agent (hold-gated mode). Human review required. Do not merge without review;
holdlabel must stay.— hive: agent=quality backend=copilot model=claude-opus-5