From 07ee4d4318ac3d68125e5e12aa5e3d217137f7f7 Mon Sep 17 00:00:00 2001 From: Michael Villari <147255440+mikevillari@users.noreply.github.com> Date: Mon, 7 Sep 2026 23:14:55 -0400 Subject: [PATCH 1/2] fix(release): validate missing registry version argument --- scripts/check_registry_versions.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/check_registry_versions.sh b/scripts/check_registry_versions.sh index b690b6c8..07fe39ad 100755 --- a/scripts/check_registry_versions.sh +++ b/scripts/check_registry_versions.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash set -euo pipefail -version="${1#v}" +version="${1:-}" +version="${version#v}" [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { - printf 'ERROR: expected a semantic version, got %q\n' "$1" >&2 + printf 'ERROR: expected a semantic version, got %q\n' "${1:-}" >&2 exit 2 } From 0ba6e074a69678b32b0ffb4ec0c07b36c94cb45d Mon Sep 17 00:00:00 2001 From: Michael Villari <147255440+mikevillari@users.noreply.github.com> Date: Mon, 7 Sep 2026 23:16:57 -0400 Subject: [PATCH 2/2] test(release): cover missing and invalid registry versions --- tests/release/release-rehearsal.test.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/release/release-rehearsal.test.sh b/tests/release/release-rehearsal.test.sh index dac49637..eb94d9c7 100755 --- a/tests/release/release-rehearsal.test.sh +++ b/tests/release/release-rehearsal.test.sh @@ -4,6 +4,27 @@ set -euo pipefail repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" rehearsal="${repo_root}/scripts/release_rehearsal.sh" +# Invalid registry versions must fail validation before attempting any network +# requests, including when no positional argument was supplied. +assert_invalid_registry_version() { + local output status + if output="$(bash "${repo_root}/scripts/check_registry_versions.sh" "$@" 2>&1)"; then + printf 'FAIL: registry preflight accepted an invalid version\n' >&2 + exit 1 + else + status=$? + fi + if [[ "$status" -ne 2 ]]; then + printf 'FAIL: registry preflight expected exit 2, got %s: %s\n' "$status" "$output" >&2 + exit 1 + fi + grep -Fq 'ERROR: expected a semantic version' <<<"$output" +} + +assert_invalid_registry_version nope +assert_invalid_registry_version +assert_invalid_registry_version '' + if [[ ! -x "$rehearsal" ]]; then printf 'FAIL: release rehearsal is missing or not executable: %s\n' "$rehearsal" >&2 exit 1