Commit Graph
145 Commits
Author SHA1 Message Date
dingo cd43880a9a fix client chat 2026-03-05 08:33:07 -05:00
dingo 8dca906afd fix client 2026-03-05 06:15:41 -05:00
52419e2199 Chat module — overlay, friends, presence, DMs, context menus
- Chat.gd autoload: data layer for channels, messages, social graph,
  presence, and notifications; wires to Network/Auth singletons
- ChatOverlay.tscn + chat_overlay.gd: CanvasLayer (layer=100) that
  persists across all scenes; bubble toggle at bottom-right corner
- Six tabs: Friends, Presence, Global, Lobby, Game, DMs
- Message rows show [HH:MM] [source] Name: text with color-coded
  source badges (global/lobby/game/private/party/system)
- Friends list: online/offline sections, right-click context menu
  (Private Message, Set Nickname, Block, Remove Friend)
- Player name click: Add Friend, Invite to Party (stub), Mute/Unmute,
  Hi Scores (disabled placeholder)
- Presence tab: own status selector (Online/Away/Offline) + friends
  presence overview with status dots
- DMs tab: conversation sidebar + message pane, input bar shown when
  a conversation is selected
- Unread notification badge on chat bubble
- Per-session nickname overrides and muting

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-05 05:48:09 -05:00
dingo 888164603c client 2026-03-04 21:08:56 -05:00
dingo 62763859a3 CDN 2026-03-03 18:39:20 -05:00
dingo ba04911acc CDN flag change 2026-03-03 17:05:27 -05:00
dingo 551610a8ee CDN Browser changes 2026-03-03 11:49:45 -05:00
dingo 8bf7da1092 CDN browser in Admin Portal 2026-03-03 11:26:59 -05:00
dingo 18aeaf093b Client bug fixes 2026-03-03 08:48:00 -05:00
dingo d3411e54b5 Remove Starter Deck 2026-03-03 07:18:00 -05:00
dingo a3bcc71082 Client changes, admin portal, collection fixes. 2026-03-02 10:49:49 -05:00
dingo ffe1ec5094 Fixing Deck rules on server.... 2026-03-02 08:45:25 -05:00
dingo d3e39f9511 minor admin portal changes 2026-03-02 08:37:51 -05:00
0a1796cd77 fix: setup() after add_child(); defer scene change from _ready()
card_widget.gd uses @onready vars which are null until _ready() fires.
_ready() only fires after add_child(), so both cards_view.gd and decks_view.gd
must call add_child(widget) before widget.setup().

login_screen.gd called change_scene_to_file() synchronously from _ready(),
causing "parent busy" crash.  Deferred with call_deferred().

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-02 07:45:10 -05:00
56027e0f47 fix: use correct SOR.Database.Enums.Affinity values throughout client
Replace placeholder Fire/Water/Earth/Air/Lightning/Dark/Light affinities
with the actual enum values: Void, Aether, Lake, Hill, Forest, Field (basics)
plus their non-basic combos (Ocean, Island, Marsh, Swamp, Mountain, Steppe,
Fort, Plains, Grove, Jungle, PerfectAether, PureVoid).

- Rename 7 wrong SVG icons → 6 correct ones (Void/Aether/Lake/Hill/Forest/Field)
- card_widget.gd: rewrite AFFINITY_BORDER, AFFINITY_BG for all 18 card affinities;
  add static affinity_icon() helper that maps non-basics to their primary basic icon
- card_detail_popup.gd: use affinity_icon() instead of direct dict lookup
- cars_view.gd: affinity filter now lists all 18 card-valid affinities

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-02 07:34:07 -05:00
8da0172563 fix: PackedByteArray cannot be const in GDScript — move key halves inline
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-02 07:15:30 -05:00
3c4908eec6 client: remember me, SVG affinity icons, card detail popup
Remember Me (login screen):
- AES-256-CBC encrypted credential storage in user://creds.dat
- Key XOR-obfuscated across two halves; random IV stored with ciphertext
- Checkbox pre-fills email/password on next launch; unchecking clears saved creds

SVG affinity icons (web-compatible):
- Replace emoji art symbols (🔥💧⛰💨⚡✦★) with SVG TextureRect in CardWidget
- 7 new icons/affinity_*.svg — monochrome white, modulate-tinted at runtime
- ArtSymbol node changed from Label to TextureRect (stretch_mode = keep-aspect-centred)

Card detail popup (collection screen):
- Tap any card in Cards tab to see full stats + abilities overlay
- CardDetailPopup added to viewport root (avoids VBoxContainer layout conflict)
- Shows: name, affinity icon, foil badge, type/affinity/rarity, all 6 stats,
  and parsed ability list with names + descriptions
- Dismiss by tapping ✕ or the dim background overlay

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-02 07:12:26 -05:00
2508fe1297 client: force WebSocket reconnect on logout so auth arrives on a fresh connection
logout() now calls Network.force_reconnect() to tear down the existing Phase-5
connection; the next auth.login / auth.register is then the very first message
on the new connection, which is the only point where ConnectionLoop handles auth.

Also adds Network.force_reconnect() 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-03-01 22:55:45 -05:00
dingo ad611ee4ca ops(argocd): enforce sync waves (nats first) and add redeploy stamp annotation 2026-03-02 03:52:17 +00:00
cec6773a12 fix: NatsMessageRpcResponder SerializePayload must use CamelCase JSON options
SerializePayload was using default JsonSerializerOptions, so record properties
like GetStarterDecksResponse.Decks were serialized as "Decks" (PascalCase).
That JsonElement travels through the NATS reply back to the gateway, which
forwards it verbatim. The client reads p.get("decks", []) and finds nothing
→ "No starter decks available."

Fix: use the same PropertyNamingPolicy=CamelCase that SystemTextJsonSerializer
uses, so all payload field names arrive at the client in camelCase.

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 22:28:33 -05:00
fa5beb104c client: map WebSocket close reason to error code in _on_ws_closed
Godot discards buffered data packets when the close frame arrives, so the
JSON error sent by RejectAsync is never received. Map known server close
reasons (auth_failed, auth_required) from the close frame's reason field
to AUTH_FAILED / AUTH_REQUIRED so Auth.gd's logout+navigate logic fires
correctly instead of treating every rejection as a transient DISCONNECTED.

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 20:46:48 -05:00
5d4f0c3745 admin: fix CardEditor AddAsset/AddAnimation + Remove EF bugs
Same two classes of bug as PrebuiltDeckEditor:

1. AddAsset / AddAnimation — ValueGeneratedOnAdd sentinel mismatch:
   New entities with Id = Guid.NewGuid() added to a tracked ObservableHashSet
   are classified as Modified by EF, causing a 0-rows-affected UPDATE.
   Fix: Db.Entry(entry).State = EntityState.Added when !_isNew.

2. RemoveAsset / RemoveAnimation — redundant Db.Remove on detached entity:
   Id != Guid.Empty is always true (Guid.NewGuid() default). Removing an
   Added entity from the collection detaches it; calling Db.Remove re-attaches
   it as Deleted → DELETE on a non-existent row → DbUpdateConcurrencyException.
   Fix: removed the explicit Db.Remove calls; EF handles orphan deletion.

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 11:14:06 -05:00
9c4a1db8b1 admin: fix AddCard inserting 0 rows (EF ValueGeneratedOnAdd sentinel mismatch)
PrebuiltDeckCard.Id is configured as ValueGeneratedOnAdd; EF's sentinel for
Guid is Guid.Empty. When a new entity with Id = Guid.NewGuid() is added to
the tracked ObservableHashSet (_deck.Cards), EF interprets the non-empty Guid
as an existing row and tracks the entity as Modified instead of Added.
SaveChangesAsync then issues an UPDATE that finds 0 rows →
DbUpdateConcurrencyException.

Fix: call Db.Entry(entry).State = EntityState.Added immediately after adding
to the collection for existing (tracked) decks. For new decks the plain
List<> is not yet tracked so graph traversal in SaveAsync handles it.

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 11:11:27 -05:00
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
dingo 3d2b9c3608 Client/Server changes 2026-03-01 10:27:12 -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
0607f02e93 admin: fix RemoveCard DbUpdateConcurrencyException on save
PrebuiltDeckCard.Id is always a NewGuid() (never Guid.Empty), so the
old `if (entry.Id != Guid.Empty) Db.PrebuiltDeckCards.Remove(entry)`
guard was always true. When a user added a card then removed it before
saving, EF detached the Added entity from the collection, then the
explicit Db.Remove re-attached it as Deleted. SaveChangesAsync then
tried to DELETE a row that was never inserted → DbUpdateConcurrencyException.

Drop the explicit remove call entirely. EF Core automatically marks
Unchanged orphans as Deleted when removed from a required relationship
collection, and simply detaches Added orphans — both are the correct
outcomes without any extra Db.Remove.

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 09:22:38 -05:00
dingo 59af920479 admin fixes 2026-03-01 08:09:49 -05:00
773fc6a349 admin/client: fix deck editor concurrency, live search, iOS autofill
PrebuiltDeckEditor.razor:
- Add Db.ChangeTracker.Clear() at OnInitializedAsync start to prevent
  stale Deleted/Modified entities from prior circuit pages causing
  DbUpdateConcurrencyException on save
- Replace @bind + button-only search with @oninput + 300ms debounce for
  both card and arch-spirit search inputs (results appear as you type;
  search button retained as manual fallback)
- Clearing the input immediately clears previous results

LoginScreen.tscn:
- Set virtual_keyboard_type = 5 (EMAIL_ADDRESS) on EmailInput and
  RegEmailInput so Godot's experimental virtual keyboard creates
  <input type="email"> instead of type="text" on mobile/web

export_presets.cfg:
- Extend head_include with a MutationObserver that watches for virtual
  keyboard INPUT elements and sets autocomplete="username" on email
  inputs and autocomplete="current-password" on password inputs,
  enabling iOS Face ID / Touch ID password vault autofill

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 23:00:13 -05:00
2dcb5c48c8 webclient: fix browser scaling and zoom
- Add [display] section to project.godot:
  - 1280x720 base viewport (was unset → Godot default tiny resolution)
  - stretch/mode = canvas_items: all UI + text scales proportionally
  - stretch/aspect = expand: fills window, adds space on wider screens
- Add html/head_include script that runs on page load:
  - Sets canvas touch-action to 'auto' (removes Godot's default 'none'
    which blocked pinch-to-zoom on mobile)
  - Patches viewport meta to allow user-scalable=yes, maximum-scale=5.0
    so browser zoom works on both desktop and mobile

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 22:28:48 -05:00
dingo bcd154ad1e Merge remote-tracking branch 'origin/main' 2026-02-28 21:53:11 -05:00
10c0593120 Single-session login policy + fix deck editor card search
Auth (single-session policy):
- AuthGrpcHandler.Login now calls RevokeAllSessionsForUserAsync before
  CreateSessionAsync. When a user logs in on a new device, all existing
  sessions are revoked in Redis (token keys deleted) and marked RevokedAt
  in Postgres. The old device will fail auth.hello on its next reconnect
  and return to the login screen automatically.

Admin (PrebuiltDeckEditor):
- SearchCardsAsync and SearchArchSpiritsAsync were using .Contains() which
  compiles to a case-sensitive PostgreSQL LIKE. Changed to EF.Functions.ILike
  so card names can be found regardless of capitalisation.

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 21:52:36 -05:00
dingo defc563e28 webclient: enable HTML5 experimental virtual keyboard in export presets 2026-03-01 02:21:54 +00:00
775cf65899 Fix NATS max_payload — use config file instead of invalid CLI flag
-max_payload is not a valid NATS CLI flag; it must be set in a config file.

- Add deploy/k8s/configmap-nats.yaml with nats.conf (jetstream, http_port,
  max_payload=8 MB).
- Update deployment-nats.yaml to mount the ConfigMap at /etc/nats and
  start NATS with -c /etc/nats/nats.conf instead of individual CLI flags.

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 20:09:59 -05:00
2ed7ad2ba9 Fix WebSocket 1009 — increase Godot receive buffer and NATS max payload
Godot's WebSocketPeer.inbound_buffer_size defaults to 65535 bytes (64 KB).
content.sync.ack for a full card catalog (200 cards with assets and animation
bindings) exceeds this, causing Godot to close the connection with code 1009
"Message too big" every time content.sync is called.

- Network.gd: set inbound_buffer_size = 4 MB before connect_to_url so the
  client can receive large sync responses without dropping the connection.
- deployment-nats.yaml: raise NATS max_payload from 1 MB to 8 MB (-max_payload
  8388608) so the content service can reply with large card batches through NATS
  without hitting a publish-too-large error as the card catalog grows.

Note: NATS pod needs a rollout restart to apply the new max_payload arg:
  kubectl rollout restart deployment/nats -n stone-server

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 20:03:10 -05:00
502f1c16f6 Fix content.sync cartesian explosion and gateway timeout
- Add .AsSplitQuery() to ContentSyncHandler to prevent the cartesian
  product join caused by two collection .Include()s (Assets + AnimationBindings).
  EF was executing a single JOIN that multiplied result rows per card,
  causing replies to arrive 10+ seconds late and gateway timeouts.
- Bump Gateway__RemoteDispatchTimeoutMs from 10000 → 15000ms in configmap
  to give worker pods headroom on cold starts (EF model compilation +
  first DB query can take 3-5 seconds on a fresh pod).

NOTE: restart gateway pods after deploying to pick up the new timeout value:
  kubectl rollout restart deployment/sor-gateway -n stone-server

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 19:05:32 -05:00
dingo 7150afa42e NATS fighting 2026-02-28 18:02:24 -05:00
dingo 76e50b5be9 NATS 2026-02-28 17:02:43 -05:00
dingo e18cdc6b80 K8s changes for NATS 2026-02-28 16:31:01 -05:00
dingo d1a555cce7 Changing packet dispatch, packets dying on gateway and not being relayed, missed a nullable 2026-02-28 15:14:36 -05:00
dingo 285d67374e Changing packet dispatch, packets dying on gateway and not being relayed 2026-02-28 15:10:49 -05:00
fd8fe950f8 Add Grant Card section to AccountDetail admin page
Search card definitions by name (ILike, top 20), click a row to select,
set quantity (1–99), toggle Tradeable + Foil, then Grant.
Creates PlayerCard rows directly in CollectionDbContext.
Injects CatalogDbContext + CollectionDbContext (both already registered).

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 13:45:37 -05:00
a24e3ea17c Add Account Properties card to AccountDetail admin page
Shows all key-value properties for an account in a table with
inline editing (pencil → edit field → save/cancel) and delete per row.
Add-new form below the table: key + value → Add button.
Duplicate-key guard prevents adding an existing key; existing entries
must be edited rather than added again.

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 13:24:29 -05:00
bdd6e59dfe Add starter deck flow, admin force-logout + rename, shop flag
Auth chain:
- auth.proto: add needs_starter_deck to Login/Register/ValidateToken responses
- auth.proto: add RevokeAllSessions RPC
- AuthGrpcHandler: populate NeedsStarterDeck from Account.StarterDeckSelectedAt
- AuthGrpcHandler: track tokens in UserSessions Redis SET on create/logout
- AuthGrpcHandler: implement RevokeAllSessions (Redis + Postgres)
- IGatewayAuthValidator / GatewayAuthValidator: thread NeedsStarterDeck through tuples
- ConnectionLoop: include needsStarterDeck in auth ack payload

Client:
- Auth.gd: store needs_starter_deck from auth reply; clear on logout
- login_screen.gd: route to StarterDeckScreen when needs_starter_deck = true
- scenes/starter_deck/: new StarterDeckScreen (fetch decks → pick → confirm → InitScreen)

Admin panel:
- AccountDetail.razor: Force Logout All Sessions card (Redis + Postgres revoke)
- AccountDetail.razor: Change Display Name form with uniqueness check
- SOR.Admin: add StackExchange.Redis package + DI registration
- PrebuiltDeckEditor.razor: split into IsStarterDeck + IsAvailableInShop checkboxes
- PrebuiltDeck.cs: add IsAvailableInShop field
- Migration: AddPrebuiltDeckShopFlag

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 13:08:08 -05:00
fa8418387b Add session TTL and disconnect auto-logout to Auth; fix export presets
- Auth.gd: discard saved sessions older than 30 days on load (saved_at timestamp)
- Auth.gd: auto-logout and return to login screen after 30 min disconnected
- Auth.gd: cancel auto-logout timer immediately on reconnect
- Auth.gd: emit session_expired signal for any listener that needs it
- Network.gd: enable debug_log_packets for easier debugging
- export_presets.cfg: updated to full Godot 4.5 web preset (variant/thread_support,
  custom_template paths, PWA options) — fixes web CI build

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 12:30:45 -05:00
dingo 4be98fd8a0 Register auth data protection services 2026-02-28 11:01:31 -05:00
dingo aed40398b8 Bind public gateway port explicitly 2026-02-28 10:46:48 -05:00
dingo 13402c8551 Split auth gRPC onto internal listener 2026-02-28 10:38:18 -05:00
dingo 9a3eef7d20 gRPC TSing, reverting 2026-02-28 10:14:17 -05:00
dingo d2398af01c gRPC Additional Logging 2026-02-28 09:13:14 -05:00