fix(marmot-interop): guard empty-array expansion in snapshot_invites

bash 3.2 (stock on macOS) raises "unbound variable" on "${gids[*]}"
when the array is empty under `set -u`. The happy-path sanity check
still worked (the array was populated), but the shell error aborted
execution before the actual test cases ran on a fresh state/ directory.

Only expand when the array has at least one entry.
This commit is contained in:
Claude
2026-04-22 18:53:17 +00:00
parent 1cc29d605a
commit d1ea9c39e8
+6 -1
View File
@@ -198,7 +198,12 @@ snapshot_invites() {
g=$(printf '%s' "$one" | jq_group_id)
[[ -n "$g" ]] && gids+=("$g")
done < <(printf '%s' "$raw" | jq -c '(.result // .) | .[]?' 2>/dev/null)
local IFS=','; printf '%s' "${gids[*]}"
# bash 3.2 (stock macOS) treats "${gids[*]}" on an empty array as an
# unbound reference under `set -u`, so guard the expansion.
if (( ${#gids[@]} > 0 )); then
local IFS=','
printf '%s' "${gids[*]}"
fi
}
# wait_for_invite <B|C> <timeout-seconds> [ignore-csv]