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

View file

@ -22,6 +22,18 @@ teardown() { teardown_party_sandbox; }
[ ! -d "$PARTY_SOCKET_DIR/party-$USER:ghost.d" ]
}
@test "clean rescues a non-empty transcript before removing the dir" {
export HOME="$PARTY_TMP/home"
mkdir -p "$HOME"
ensure_party_dir "$USER" crashed
printf 'the night\n' > "$PARTY_SOCKET_DIR/party-$USER:crashed.d/log"
run "$PARTY_BIN" clean
[ "$status" -eq 0 ]
[[ "$output" == *"transcript saved to"* ]]
[ ! -d "$PARTY_SOCKET_DIR/party-$USER:crashed.d" ]
grep -q "the night" "$HOME"/party-crashed-*.log
}
@test "clean removes a crash-before-bind dir (no sock at all)" {
mkdir "$PARTY_SOCKET_DIR/party-$USER:stillborn.d"
run "$PARTY_BIN" clean