Skip to content

🧪 Add unit tests for idstack-gen-skills#52

Open
savvides wants to merge 1 commit into
mainfrom
test-gen-skills-3265346482908859913
Open

🧪 Add unit tests for idstack-gen-skills#52
savvides wants to merge 1 commit into
mainfrom
test-gen-skills-3265346482908859913

Conversation

@savvides

@savvides savvides commented Jun 6, 2026

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed
The bin/idstack-gen-skills script previously lacked dedicated unit tests. This PR adds a comprehensive test suite in test/test-gen-skills.sh to fill this gap.

📊 Coverage: What scenarios are now tested

  1. Missing Templates: Verifies execution fails when required template files are missing.
  2. claude target: Validates proper generation of skills/<skill>/SKILL.md while substituting PREAMBLE, SCHEMA, retaining allowed-tools, and inserting the generation header.
  3. codex target: Validates proper generation of dist/codex/skills/idstack-<skill>/SKILL.md, stripping of allowed-tools, and generation of repo-root AGENTS.md.
  4. all target: Ensures both formats generate properly.
  5. Dry-Run Behavior: Checks --dry-run successfully reports OK on fresh runs, and fails (exits 1) when files are stale/modified.
  6. Invalid Arguments: Confirms that incorrect target arguments correctly return an error code.

Result: The improvement in test coverage
bin/idstack-gen-skills now has an exhaustive and self-contained suite, allowing confident future refactoring. All tests automatically run during CI/pipeline validation via the test/smoke-test.sh integration.


PR created automatically by Jules for task 3265346482908859913 started by @savvides

Adds test/test-gen-skills.sh to verify generation targets and error paths.
Integrates the test suite into the existing smoke-test.sh flow.

Co-authored-by: savvides <1580637+savvides@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates unit tests for the idstack-gen-skills tool by adding a new test script test/test-gen-skills.sh and updating test/smoke-test.sh to run it. The review feedback identifies a critical safety risk in test/test-gen-skills.sh where using rm -rf "$WORK"/* could lead to accidental deletion of the root filesystem if $WORK is empty or unset. The reviewer suggests safely deleting and recreating the entire $WORK directory instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread test/test-gen-skills.sh
Comment on lines +34 to +36
# Clean existing items before seeding to avoid permission issues or stale files
rm -rf "$WORK"/* "$WORK"/.??* 2>/dev/null || true
mkdir -p "$WORK/bin" "$WORK/templates/assets" "$WORK/skills/test-skill"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

⚠️ Safety & Correctness Issue

Using rm -rf "$WORK"/* poses two significant issues:

  1. Severe Safety Risk: If $WORK is ever empty or unset, this command expands to rm -rf /*, which will attempt to delete the entire root filesystem.
  2. Incomplete Dotfile Cleanup: The pattern .??* only matches dotfiles with at least two characters after the dot (e.g., .ab), leaving single-character dotfiles (like .a) untouched.

💡 Recommendation

Simply delete and recreate the entire $WORK directory. This is completely safe from the rm -rf /* expansion risk, automatically cleans up all files (including all dotfiles), and is much simpler.

Suggested change
# Clean existing items before seeding to avoid permission issues or stale files
rm -rf "$WORK"/* "$WORK"/.??* 2>/dev/null || true
mkdir -p "$WORK/bin" "$WORK/templates/assets" "$WORK/skills/test-skill"
# Clean existing items before seeding to avoid permission issues or stale files
rm -rf "$WORK"
mkdir -p "$WORK/bin" "$WORK/templates/assets" "$WORK/skills/test-skill"

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