test(quality): unit coverage for scripts/generate_skill_index.py - #788
Open
mrbobbytables wants to merge 1 commit into
Open
test(quality): unit coverage for scripts/generate_skill_index.py#788mrbobbytables wants to merge 1 commit into
mrbobbytables wants to merge 1 commit into
Conversation
scripts/generate_skill_index.py (165 lines) is a required merge gate (.github/workflows/docs-validate.yml runs it with --check) but had zero unit tests. Add 36 tests covering: - parse_frontmatter: YAML parsing and its two error paths - collect: all nine front-matter validations (required fields per-field, category/status enums, entry_point self-match, id == name), doc_type extraction, description whitespace normalisation, and id-sorted output - render_json / render_md: payload shape and generated document contents - main: write mode, and every --check failure/success path, including a regression guard pinning that --check reuses the committed generated_at date rather than date.today() (switching to today's date would make the docs gate fail every day after the catalog is committed) - a repository invariant test asserting the committed docs/skills/index.* files are in sync, mirroring the assertion docs-validate.yml makes No production code changed. Fixes projectbluefin#767 Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Approved by @castrojo for Hive auto-merge on green CI.
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.
Summary
scripts/generate_skill_index.py(165 lines) is a required merge gate —.github/workflows/docs-validate.ymlruns it with--check— but had zero unit tests before this PR.Closes #767.
Note:
scripts/update_coverage_snapshot.py, the other script named in #767, already gained coverage in #776 (merged), so this PR only adds tests forgenerate_skill_index.py.What's covered (36 tests)
parse_frontmatter— YAML parsing and both error paths (missing---marker, non-mapping front matter)collect— all nine front-matter validations: each required field individually,category/statusenum membership,entry_pointself-match,id == name; plusdoc_typeextraction frommetadata.type, description whitespace normalisation, multi-skill error aggregation, and id-sorted outputrender_json/render_md— payload shape and generated document contents (including relative table links)main— write mode, and every--checkfailure/success path, including a regression guard pinning that--checkreuses the committedgenerated_atdate rather thandate.today()(switching to today's date would make the docs gate fail every day after the catalog is committed — the same class of failure as dakota-iso#137, called out in the issue)docs/skills/index.json/index.mdare currently in sync, mirroring the assertiondocs-validate.ymlmakesNo production code changed. Since the script has no
--repo-rootseam, tests monkeypatch the module'sROOT/SKILLS_DIR/INDEX_JSON/INDEX_MDpath constants to an isolatedtmp_path.Testing
python3 -m pytest tests/unit/test_generate_skill_index.py -q→ 36 passedpython3 -m pytest tests/unit/ -q→ 1563 passed (full unit suite, no regressions)ruff check tests/unit/test_generate_skill_index.py→ all checks passed— hive: backend=copilot model=claude-sonnet-5
🐝 Hive Agent:
contributor| SHA:9d34091e