A missing room must not burn the seat

The client deleted its saved seat credentials on "no such room" — but
that error proves nothing about the seat: a restarting server, a
stale restore, or a wrong backend all say it, and burning the token
on a transient locked a live player out of a live game (room 22EC,
after this session's server-squatting incident). Now only "name is
taken" — this exact token tried and refused — clears the credential;
a not-found shows its error and keeps the key for the reconnect that
finds the room home again.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015RCWSTnb1KYTPyL4GmhGnF
This commit is contained in:
Eric Wagoner
2026-08-26 14:00:30 -04:00
co-authored by Claude Fable 5
parent b396469bea
commit 72148dd7c2
+10 -1
View File
@@ -507,8 +507,17 @@ class Net {
break;
}
case "error":
if (this.roomIdPending && /no such room|name is taken/.test(msg.message)) {
// "Name is taken" means THIS token was tried and refused: the
// credential itself is dead, and holding it helps nobody. But
// "no such room" proves nothing about the seat — a restarting
// server, a stale restore, or the wrong backend all say it —
// and burning credentials on a transient locked a real player
// out of a live game. The seat stays; the error shows; a later
// reconnect against the right server walks back in.
if (this.roomIdPending && /name is taken/.test(msg.message)) {
localStorage.removeItem(SEAT_KEY);
}
if (this.roomIdPending && /no such room|name is taken/.test(msg.message)) {
this.roomIdPending = null;
}
this.error = msg.message;