test(config): cover skill-discovery helpers and prompt assembly#11
Merged
Conversation
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.
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
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_skillsa binding code path in the manager workflow. Several skill-discovery helpers had zero direct tests:front_matter_fieldskill_name_from_contentskill_description_from_contentshould_skip_skill_dirdiscover_skills_with_diagnosticsagent_instructions_with_skillsTest breakdown
front_matter_fieldskill_name_from_contentskill_description_from_contentshould_skip_skill_dirdiscover_skills_with_diagnosticsagent_instructions_with_skillsValidation
cargo fmt --check✅cargo clippy -- -D warnings✅ (lib-only, matches CI)cargo test --lib config::→ 38 passing (was 17), 0 failedcargo test→ 322 passing, 1 ignored (same as main)npm run lint→ 0 errorsReviewer outcomes
Two independent code reviewers were dispatched on
main..HEADafter a clean rebase onto current main (post PR #10). Both returnedproduction_quality. One minor follow-up captured for a future SOW: the "Git source without local_path" diagnostic branch indiscover_skills_with_diagnostics(line 301) is still uncovered.Out of scope