feat: party clean rescues an orphaned transcript before deleting

A server crash mid-logged-party is the one case close's rescue can
never have run, and host's EEXIST message funnels the host straight
into clean. Deleting the night's log there is exactly the accident
class the close-time rescue exists for, so clean applies the same
rescue: no quiescence poll needed, the liveness gate just proved the
writers are gone.
This commit is contained in:
veg 2026-07-11 13:13:05 +00:00
parent f946c7e876
commit 8d10e62779
4 changed files with 31 additions and 1 deletions

15
party
View file

@ -1005,6 +1005,21 @@ EOF
echo "party clean: skipping $d (server is live; use party close)." >&2
continue
fi
# A crash-orphaned transcript is the same "lost the night's log"
# accident cmd_close's rescue exists for; the server here is
# already confirmed dead by the liveness check above, so unlike
# close there's no pipe-pane `cat` still draining and no
# quiescence poll is needed before moving it.
if [ -s "$d/log" ]; then
_cn_name=${d##*"party-$USER:"}
_cn_name=${_cn_name%.d}
_cn_dest="$HOME/party-$_cn_name-$(date -u '+%Y%m%d-%H%M%S').log"
if mv "$d/log" "$_cn_dest" 2>/dev/null; then
echo "party clean: transcript saved to $_cn_dest"
fi
fi
rm -rf "$d"
echo "removed $d"
removed=$((removed+1))