Skip to content

test: smoke tests for update.py — last uncovered module#12

Open
bipinhcs11 wants to merge 1 commit into
mainfrom
test/update-module-smoke-tests
Open

test: smoke tests for update.py — last uncovered module#12
bipinhcs11 wants to merge 1 commit into
mainfrom
test/update-module-smoke-tests

Conversation

@bipinhcs11
Copy link
Copy Markdown
Owner

What

Adds tests/test_update.py — 29 stdlib-only smoke tests for tools/skill_generator/update.py, which was the only module in the package with zero test coverage.

Why

update.py is the Phase-2 hot path: it maps changed files to features, bumps versions, rewrites last_updated, and writes refreshed SKILL.mds. Silent bugs here corrupt the skills that every AI session depends on. The existing suite covered crawler, plan, generate, link, validate, and doctorupdate was the gap.

What is tested

Class Coverage
TestBumpVersion (5 tests) Version field present; version 1→2; field absent (fallback to 1); version 0→1; first frontmatter occurrence wins over later body mention
TestDomainFromSkill (8 tests) feature_id used as id and name; description always ""; Java class names extracted; XML/SQL/shell sources extracted with ": from prior skill" suffix; empty text → empty classes; duplicate class names deduplicated
TestResolveSkillsDir (3 tests) .github/skills/ preferred over skills/; skills/ used when .github/skills/ absent; None when neither exists
TestMapFilesToFeatures (6 tests) Empty changed-files list; basename match across deep path; unmatched file absent from result; shared file maps to multiple features; XML file matched; missing skills dir returns {}
TestIngestResponses (7 tests) Version bumped to existing+1; last_updated rewritten to today; missing response → failed[]; missing existing SKILL.md → failed[]; empty/whitespace response → failed[]; markdown fence stripped before write; two-feature batch update

All tests use validate_schema=False to isolate update logic from the validator (which has its own 40-test suite in test_validate.py).

Suite size

172 → 201 tests, all green.

Follow-ups noted (not in this PR)

  • _git_changed_files is not directly tested (subprocess boundary — would need a real git repo fixture or a mock). Worth adding in a future test_update_git.py with a tempfile-based git repo.
  • emit_prompts integration test (requires a crawled index + skills dir) — could be added alongside the generate-emit integration tests if those are ever added.

https://claude.ai/code/session_01V3GMvToFpDMsnSbSe2Fsgp


Generated by Claude Code

update.py had zero test coverage despite being the Phase-2 hot path.
Adds 29 stdlib-only tests across four test classes:

  TestBumpVersion       — version parsing + fallback when field absent
  TestDomainFromSkill   — class/XML/SQL/shell extraction; dedup invariant
  TestResolveSkillsDir  — .github/skills/ preferred; None when absent
  TestMapFilesToFeatures — basename matching; multi-feature; unmatched

Plus seven ingest_responses integration tests (validate_schema=False):
version bump to existing+1, last_updated rewritten to today, failed[]
entries for missing response / missing skill / empty response, markdown-
fence stripping, no-skills-dir guard, and multi-feature batch update.

Total suite: 172 → 201 tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_01V3GMvToFpDMsnSbSe2Fsgp
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.

2 participants