Skip to content

scripts: check-skill-precompute-compose treats an invalid base ref as a pass because exit 2 dies inside a process substitution #3377

Description

@kyle-sexton

Context

In scripts/check-skill-precompute-compose.sh:93-112, target discovery runs inside mapfile -t targets < <( case "$first" in ... esac ). The base-ref branch validates the ref and, on failure, prints an error and runs exit 2 (lines 103-106) -- but that exit terminates only the process-substitution subshell. The parent never observes its status (mapfile's own status reflects the read, and process-substitution exit codes are not propagated), so targets is simply empty and the script proceeds to scan zero files and exit 0. An invalid base ref (a typo'd branch, a shallow clone missing the ref) therefore reads as "nothing to gate": a silent pass in exactly the situation the validation was written to catch. The error text does go to stderr, but the exit code, which is what CI gates on, says success.

Proposed work

  • Validate the base ref in the parent shell before the mapfile (move the git rev-parse --verify check out of the process substitution), exiting 2 from the parent on failure.
  • Add a test case invoking the script with a bogus base ref and asserting exit 2 (the suite already exists for this script).

Acceptance criteria

  • Invoking the script with a nonexistent base ref exits 2.
  • A test covers the invalid-base-ref invocation and fails if the script exits 0.
  • Valid base-ref, --all, and --paths modes behave as before.

References

  • scripts/check-skill-precompute-compose.sh:93-112 (mapfile process substitution at line 93; unreachable-to-the-parent exit 2 at line 105)
  • Found by the batch-simplify sweep on branch claude/code-tidying-batch-simplify-s7ljbi; deliberately not fixed there because the sweep was behavior-preserving.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: highSignificant impact, or blocks an imminent release; staff this cycle.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions