fix(validate-module): harden standalone module validation#97
Conversation
Three robustness fixes to validate-module.py for standalone single-skill modules: - Accept importable underscore-named merge scripts (merge_config.py) in addition to the scaffolder's dash form (merge-config.py). Either is valid; a module may rename them to be importable from module-setup.md without that being a structural defect. - Treat colon-less preceded-by/followed-by refs as cross-module positional references (bare sibling-module skill names) and skip them. Other installed modules aren't visible to the validator, so they can't be resolved and aren't defects; intra-module skill:action refs are still validated. - Detect a standalone module when handed the skill directory itself, not only its parent folder (as the reference doc already promised). Skill-folder and orphan-entry checks now resolve in both cases. Adds 3 regression tests (20 pass total); updates the reference doc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
ChangesStandalone Module Validation Improvements
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
skills/bmad-module-builder/scripts/validate-module.py (1)
328-330:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winCLI help text is now stale for accepted input shape
Line 329 still says only “module’s skills folder”, but validation now also supports passing a standalone skill directory directly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@skills/bmad-module-builder/scripts/validate-module.py` around lines 328 - 330, The help text for the "module_dir" argument in the CLI parser is outdated and only describes the module's skills folder scenario. Update the help string to accurately reflect that the argument now accepts both a module's skills folder (containing the setup skill and other skills) and a standalone skill directory. This ensures users understand all accepted input shapes for the module_dir parameter.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/bmad-module-builder/scripts/validate-module.py`:
- Around line 232-239: The issue is that when validating a skill directory
directly (standalone_dir mode), setting skill_parent to standalone_dir.parent
makes the parent directory the reference point for validating in-module skills.
This causes sibling skill directories to be incorrectly treated as in-module
skills during orphan CSV validation, making the validation too permissive. Fix
this by setting skill_parent to standalone_dir itself instead of
standalone_dir.parent when in standalone mode, so that the orphan validation at
lines 249-254 only considers the specific skill directory being validated and
properly identifies true orphan CSV skill entries.
---
Outside diff comments:
In `@skills/bmad-module-builder/scripts/validate-module.py`:
- Around line 328-330: The help text for the "module_dir" argument in the CLI
parser is outdated and only describes the module's skills folder scenario.
Update the help string to accurately reflect that the argument now accepts both
a module's skills folder (containing the setup skill and other skills) and a
standalone skill directory. This ensures users understand all accepted input
shapes for the module_dir parameter.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c8570b1b-4c3f-48e8-a9e6-51c61968280c
📒 Files selected for processing (3)
skills/bmad-module-builder/references/validate-module.mdskills/bmad-module-builder/scripts/tests/test-validate-module.pyskills/bmad-module-builder/scripts/validate-module.py
Addresses CodeRabbit review on bmad-code-org#97: in direct skill-dir mode the orphan check resolved CSV skills against the parent folder, so an unrelated sibling skill directory could mask a true orphan entry. For a standalone module, skill_folders already enumerates every valid skill (just the standalone skill), so any other CSV skill is an orphan — drop the parent-folder filesystem lookup entirely. The multi-skill path still re-checks the filesystem for the setup skill. Adds a regression test (sibling dir must not mask the orphan); 21 tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/bmad-module-builder/scripts/tests/test-validate-module.py`:
- Line 389: The variable `code` is unpacked from the return value of
`run_validate(skill_dir)` on line 389 but is never used in the test. Replace the
unused `code` variable with an underscore `_` to follow Python convention for
intentionally discarded values and to resolve the Ruff linter warning.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 55663afe-95c0-4179-9cdb-98cce84fae98
📒 Files selected for processing (2)
skills/bmad-module-builder/scripts/tests/test-validate-module.pyskills/bmad-module-builder/scripts/validate-module.py
🚧 Files skipped from review as they are similar to previous changes (1)
- skills/bmad-module-builder/scripts/validate-module.py
Addresses CodeRabbit nit on bmad-code-org#97: the orphan regression test unpacked `code` without using it. Assert `code == 1` (the orphan makes validation fail), which also strengthens the test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
thanks @armelhbobdad - merged |
What
Three robustness fixes to
validate-module.pyfor standalone single-skill modules.Why
A correctly-structured, runnable standalone module currently gets false-positive findings when it (a) renames its merge scripts to the importable underscore form, (b) positions itself via bare sibling-module skill names, or (c) is validated by passing its own skill directory.
How
merge-config.py(scaffolder default) ormerge_config.py(importable) for the two merge scripts.preceded-by/followed-byrefs (cross-module positional, unresolvable here); still validate intra-moduleskill:actionrefs.detect_standalone_module()now also matches when given the skill dir itself; skill-folder and orphan-entry checks resolve in both cases.Testing
python3 skills/bmad-module-builder/scripts/tests/test-validate-module.py→ 20 pass (3 new regression tests added). Targets currentmain(preceded-by/followed-by); independent of the unmergedfix/validate-module-csv-headerbranch.🤖 Generated with Claude Code
Summary by CodeRabbit
Documentation
Improvements
preceded-by/followed-byreferences and standalone CSV “orphan” reporting.Tests