Commit Graph
6 Commits
Author SHA1 Message Date
2643fe4276 client: fix auth_failed loop — logout + navigate from Auth.gd centrally
When auth.hello is rejected (session expired/revoked), Auth.gd now calls
logout() to wipe all auth state (including auth.cfg) and drives the scene
change to LoginScreen directly, instead of relying on each scene's own
auth_failed handler.

This covers all screens (main, collection, etc.) without each needing a
handler, and eliminates the race where the auth.hello reply arrived as
DISCONNECTED (STATE_CLOSING path, token kept) → reconnect → resend token.

main_screen.gd no longer subscribes to auth_failed; session expiry redirect
is fully owned by Auth.gd.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-01 10:57:15 -05:00
4322732b47 client: fix auth-expiry reconnect loop + improve error messages
Network.gd — drain packets before handling close (main bug fix):
  When the server rejects auth.hello it sends an error frame then closes
  the connection. Godot's WebSocketPeer.poll() can transition directly to
  STATE_CLOSED while the error packet sits unread in the buffer. The old
  code returned early on STATE_CLOSED without calling _poll_packets(), so
  _on_ws_closed() fired DISCONNECTED for the pending auth.hello instead of
  the real AUTH_FAILED. Auth kept the session token and retried forever.
  Fix: drain any buffered packets before _on_ws_closed().

Network.gd — fail request() immediately when not connected:
  Previously request() silently dropped the send but left a dangling
  pending entry that was never resolved until the next disconnect. Now
  on_error("DISCONNECTED") is called immediately, giving the caller
  consistent feedback and keeping _pending clean.

main_screen.gd — stay on screen for DISCONNECTED auth errors:
  A transient network drop during auth.hello was sending the user back
  to the login screen unnecessarily. Only navigate to login when the
  session is explicitly rejected (AUTH_FAILED, ACCOUNT_LOCKED, etc.).
  The "● Reconnecting…" status label already handles the transient case.

login_screen.gd — add missing friendly error translations:
  INVALID_PASSWORD / USER_NOT_FOUND → "Wrong email or password."
  DISPLAY_NAME_TAKEN, ACCOUNT_LOCKED, AUTH_REQUIRED,
  AUTH_SERVICE_UNAVAILABLE all now map to clear human-readable strings
  instead of falling through to the raw server message or error code.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-03-01 10:17:03 -05:00
dingo e18cdc6b80 K8s changes for NATS 2026-02-28 16:31:01 -05:00
dingo 0945208e48 gRPC Error 2026-02-28 08:40:05 -05:00
6a33e26237 Godot client: Collection screen — cards grid, deck management, card widget
- CardWidget (146×204px): affinity-coloured border + art placeholder,
  stats with tooltips, foil/serial indicators, selection highlight
- DeckListItem: inline rename, clone/delete signals to parent
- CardsView: paginated + filterable grid (search debounce, type/affinity
  filters, responsive columns, Load More pagination)
- DecksView: deck list with New Deck form (ArchSpirit card picker),
  clone/rename/delete wired to API, ConfirmationDialog for delete
- CollectionScreen: pill-tab container (Cards / Decks), background
  incremental content sync, back button → MainScreen
- MainScreen: wire CollectionBtn → CollectionScreen
- ContentCache: expose is_syncing() public method

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-28 07:48:07 -05:00
3aaabe75e3 Godot client networking + auth + login/main screens; fix admin hamburger
Server:
- ConnectionLoop: accept auth.login and auth.register as valid first messages
  (not just auth.hello); all ack payloads now include sessionToken for client
  persistence
- IGatewayAuthValidator: add LoginAsync and RegisterAsync
- GatewayAuthValidator: implement both via auth gRPC; fetch displayName from
  ValidateAsync after login/register succeeds
- Admin hamburger: custom .sor-admin-hamburger CSS (hardcoded white, no Bootstrap
  btn-link theme fighting); topbar z-index 1050 with position:sticky

Client (Godot 4.5, GDScript):
- autoloads/Network.gd: WebSocketPeer state machine (CONNECTING / CONNECTED /
  RECONNECTING), exponential backoff (1→30s), app-level keepalive ping every
  30s of idle, 30s ping timeout → reconnect, request/reply correlation by
  sequence number, debug_log_packets export flag for full packet dumps
- autoloads/Auth.gd: drives auth.hello / auth.login / auth.register as first
  WS message; persists sessionToken + userId + displayName to user://auth.cfg;
  auto-resumes saved session on reconnect; auth_success / auth_failed signals
- scenes/login/LoginScreen.tscn + login_screen.gd: Login + Register tabs,
  touch-friendly inputs (44px height), status label, Enter key submits, handles
  reconnect/resume states
- scenes/main/MainScreen.tscn + main_screen.gd: top bar with live connection
  dot, welcome label, placeholder nav buttons, sign-out, redirects to login on
  session expiry
- project.godot: Network and Auth autoloads registered; LoginScreen as main scene

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
2026-02-27 20:48:53 -05:00