fix: read-only invitees auto-join passive

tmux refuses new-session from read-only clients ('client is
read-only'), so an active join for an -r invitee died under set -eu
with a raw tmux error. Detect the R flag on the caller's ACL line in
the existing preflight and fall back to the mirrored view.
This commit is contained in:
veg 2026-07-04 10:00:01 +00:00
parent f3209e39d1
commit 587a462e3c
2 changed files with 42 additions and 3 deletions

View file

@ -85,3 +85,25 @@ STUB
[ "$status" -eq 0 ]
[[ "$output" == *"no parties found"* ]]
}
@test "read-only invitee joining active falls back to passive with a notice" {
# tmux refuses new-session from a read-only client ("client is
# read-only", exit 1 — verified 3.3a/3.5a), so an active join for an
# -r invitee died mid-command under set -eu. cmd_join must detect the
# R flag on its own ACL line and attach passive instead. The unquoted
# STUB delimiter is deliberate: $USER expands at write time, \$* at
# run time.
cat > "$PARTY_TMP/tmux-ro" <<STUB
#!/bin/sh
case "\$*" in
*"server-access -l"*) printf '%s (R)\nsomehost (W)\n' "$USER"; exit 0 ;;
esac
exit 0
STUB
chmod +x "$PARTY_TMP/tmux-ro"
export PARTY_TMUX="$PARTY_TMP/tmux-ro"
PARTY_DRY_RUN=1 run "$PARTY_BIN" join fiesta
[ "$status" -eq 0 ]
[[ "$output" == *"read-only"* ]]
[[ "$output" == *"attach-session -r -t fiesta"* ]]
}