test: smoke tests for update.py — last uncovered module#12
Open
bipinhcs11 wants to merge 1 commit into
Open
Conversation
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
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.
What
Adds
tests/test_update.py— 29 stdlib-only smoke tests fortools/skill_generator/update.py, which was the only module in the package with zero test coverage.Why
update.pyis the Phase-2 hot path: it maps changed files to features, bumps versions, rewriteslast_updated, and writes refreshed SKILL.mds. Silent bugs here corrupt the skills that every AI session depends on. The existing suite coveredcrawler,plan,generate,link,validate, anddoctor—updatewas the gap.What is tested
TestBumpVersion(5 tests)TestDomainFromSkill(8 tests)feature_idused asidandname; description always""; Java class names extracted; XML/SQL/shell sources extracted with": from prior skill"suffix; empty text → empty classes; duplicate class names deduplicatedTestResolveSkillsDir(3 tests).github/skills/preferred overskills/;skills/used when.github/skills/absent;Nonewhen neither existsTestMapFilesToFeatures(6 tests){}TestIngestResponses(7 tests)existing+1;last_updatedrewritten to today; missing response →failed[]; missing existing SKILL.md →failed[]; empty/whitespace response →failed[]; markdown fence stripped before write; two-feature batch updateAll tests use
validate_schema=Falseto isolate update logic from the validator (which has its own 40-test suite intest_validate.py).Suite size
172 → 201 tests, all green.
Follow-ups noted (not in this PR)
_git_changed_filesis not directly tested (subprocess boundary — would need a real git repo fixture or a mock). Worth adding in a futuretest_update_git.pywith atempfile-based git repo.emit_promptsintegration test (requires a crawled index + skills dir) — could be added alongside thegenerate-emitintegration tests if those are ever added.https://claude.ai/code/session_01V3GMvToFpDMsnSbSe2Fsgp
Generated by Claude Code