Skip to content

test: smoke tests for update.py (Phase 2 incremental updater)#14

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

test: smoke tests for update.py (Phase 2 incremental updater)#14
bipinhcs11 wants to merge 1 commit into
mainfrom
test/update-smoke-tests

Conversation

@bipinhcs11
Copy link
Copy Markdown
Owner

$(cat <<'EOF'

What

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

Why

update.py is the Phase 2 incremental updater — the path that runs on every PR merge or manual refresh. It does git diff mapping, version bumping, and conditional git commits. A silent regression here would corrupt SKILL.md files without any test catching it.

What's covered

Test class Functions exercised Cases
TestBumpVersion _bump_version() Standard version, v1→v2, missing field (defaults to 1), extra whitespace, large number, multiline doc
TestResolveSkillsDir _resolve_skills_dir() .github/skills found, skills/ fallback, neither exists, both exist (.github/skills wins)
TestDomainFromSkill _domain_from_skill() feature_id propagation, empty content, Java class extraction, deduplication, XML/SQL/shell extraction, lowercase names skipped
TestMapFilesToFeatures _map_files_to_features() Missing skills dir, empty file list, basename match, no-match (new feature), multi-feature, XML and SQL extension matching
TestIngestResponses ingest_responses() No skills dir, missing response, empty response, valid write, version forced to old+1, last_updated forced to today, schema validation blocks invalid content, validate_schema=False bypass, --feature filter

Not in this PR (follow-up candidates)

  • emit_prompts() has no test — it calls crawl() and writes to disk; a meaningful smoke test needs a synthetic Java file tree. Worth a separate PR.
  • _git_changed_files() requires subprocess mocking; left out deliberately to keep this PR stdlib-only and focused.
  • generate.py JSON parse errors surface as raw tracebacks; a follow-up could wrap them with clearer messages.
    EOF
    )

Generated by Claude Code

update.py was the only module in tools/skill_generator/ with zero test
coverage. This adds 35 tests across five test classes covering the four
pure/filesystem helper functions and the ingest_responses() round-trip:

- TestBumpVersion   — all version extraction cases incl. missing field
- TestResolveSkillsDir — .github/skills vs skills/ precedence + neither
- TestDomainFromSkill  — class/XML/SQL/shell extraction, dedup, empty
- TestMapFilesToFeatures — matching, no-match, multi-feature, extensions
- TestIngestResponses   — missing/empty response, version bump, date
  forcing, schema validation gate, validate_schema=False bypass, feature
  filter

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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