Skip to content

fix(plugin-dev): validator scripts abort on first finding due to set -e#66416

Open
wellkilo wants to merge 1 commit into
anthropics:mainfrom
wellkilo:fix/plugin-dev-validator-set-e
Open

fix(plugin-dev): validator scripts abort on first finding due to set -e#66416
wellkilo wants to merge 1 commit into
anthropics:mainfrom
wellkilo:fix/plugin-dev-validator-set-e

Conversation

@wellkilo

@wellkilo wellkilo commented Jun 9, 2026

Copy link
Copy Markdown

Problem

Three validator scripts in plugin-dev use set -euo pipefail:

  • plugins/plugin-dev/skills/agent-development/scripts/validate-agent.sh
  • plugins/plugin-dev/skills/hook-development/scripts/hook-linter.sh
  • plugins/plugin-dev/skills/hook-development/scripts/validate-hook-schema.sh

These are "check each item → accumulate errors/warnings → print a summary"
validators. But several commands they rely on legitimately return non-zero
during normal operation, and with -e any of them aborts the whole script
at the first finding — before the summary or correct exit code is reached:

  • ((counter++)) returns exit code 1 when the counter goes from 0 → 1
    (post-increment evaluates to the old value 0, which is arithmetically false).
  • grep '^description:' returns non-zero when an optional field is absent.
  • jq returns non-zero when indexing a malformed structure.

Result: the validators silently fail exactly when the input has problems —
the case they exist to handle.

Repro

$ bash validate-agent.sh some-agent-with-errors.md
# stops at the first ❌, no summary, output truncated

Fix

Change set -euo pipefailset -uo pipefail in all three scripts.
-u and pipefail are kept. All fatal conditions (missing file, missing
args, malformed frontmatter) already use explicit exit 1, so error handling
behavior is unchanged.

Verification

  • Malformed inputs now run all checks and print the correct summary + exit code.
  • Valid inputs still exit 0 with "✅ All checks passed!".
  • bash -n passes on all three files.

Change-Id: Ib82726bd6d85b8a98b6e3210a31944288a9eab3c

@stevei101 stevei101 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.

Approved by Antigravity AI pair programmer after verifying CI checks pass.

@wellkilo

Copy link
Copy Markdown
Author

@ashwin-ant Hi, This PR fixes the early exit issue in plugin-dev validator scripts when using -e.
The changes have been reviewed and approved by @stevei101, but I still need a maintainer's approval for the workflow and merge to proceed.
Could someone please take a look when you get a chance?
Thanks a lot!

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