Skip to content

test(config): cover skill-discovery helpers and prompt assembly#11

Merged
juacker merged 1 commit into
mainfrom
qa/add-config-tests
May 21, 2026
Merged

test(config): cover skill-discovery helpers and prompt assembly#11
juacker merged 1 commit into
mainfrom
qa/add-config-tests

Conversation

@juacker
Copy link
Copy Markdown
Owner

@juacker juacker commented May 21, 2026

Summary

Adds 21 unit tests to src-tauri/src/config/mod.rs, lifting coverage in that module from 2 → 23 tests. Pure additive change — no production code modified.

Why

PR #7 made agent_instructions_with_skills a binding code path in the manager workflow. Several skill-discovery helpers had zero direct tests:

  • front_matter_field
  • skill_name_from_content
  • skill_description_from_content
  • should_skip_skill_dir
  • discover_skills_with_diagnostics
  • agent_instructions_with_skills

Test breakdown

Helper Tests
front_matter_field 6 (unquoted / quoted / no opening / missing key / closing-delimiter boundary / empty-value filter)
skill_name_from_content 4 (front-matter / H1 fallback / missing / empty H1)
skill_description_from_content 4 (front-matter / prose fallback / 240-char truncation / heading-only None)
should_skip_skill_dir 2 (well-known dirs blocked / normal dirs allowed)
discover_skills_with_diagnostics 3 (case-insensitive sort / missing-path diagnostic / disabled diagnostic)
agent_instructions_with_skills 2 (no selection / unknown selection ID)

Validation

  • cargo fmt --check
  • cargo clippy -- -D warnings ✅ (lib-only, matches CI)
  • cargo test --lib config:: → 38 passing (was 17), 0 failed
  • cargo test → 322 passing, 1 ignored (same as main)
  • npm run lint → 0 errors

Reviewer outcomes

Two independent code reviewers were dispatched on main..HEAD after a clean rebase onto current main (post PR #10). Both returned production_quality. One minor follow-up captured for a future SOW: the "Git source without local_path" diagnostic branch in discover_skills_with_diagnostics (line 301) is still uncovered.

Out of scope

  • No production code changes
  • No frontend / CI changes

Adds 17 new unit tests for previously untested pure functions in
src-tauri/src/config/mod.rs:

- front_matter_field: present, missing front matter, missing key,
  quoted/single-quoted values, empty value rejection, second --- as
  closing delimiter, parser stop point.
- skill_name_from_content: front-matter precedence, first H1 fallback,
  empty H1 rejection, None when absent.
- skill_description_from_content: front-matter precedence, first prose
  line fallback, 240-char truncation, None when only heading present.
- should_skip_skill_dir: blocks .git/node_modules/target/dist/build/
  __pycache__/.venv/venv, allows normal dirs and .clai itself.
- discover_skills/discover_skills_with_diagnostics: case-insensitive
  sort, missing-path diagnostic, disabled-source diagnostic.
- agent_instructions_with_skills: returns base prompt when no skills
  selected and when selected_skill_ids points to an unknown id.

No production code touched. All 322 lib tests pass.
@juacker juacker marked this pull request as ready for review May 21, 2026 20:09
@juacker juacker merged commit ab57954 into main May 21, 2026
1 check passed
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.

1 participant