Commit Graph
35 Commits
Author SHA1 Message Date
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
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
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
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 defc563e28 webclient: enable HTML5 experimental virtual keyboard in export presets 2026-03-01 02:21:54 +00: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
dingo e18cdc6b80 K8s changes for NATS 2026-02-28 16:31:01 -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 0945208e48 gRPC Error 2026-02-28 08:40:05 -05:00
c6177cd627 build(web): two-step import+export, diagnose templates, drop --path
- Split into godot --import then godot --export-release to avoid the
  race condition where _fs_changed fires before Web export platform
  is fully registered (causes empty "configuration errors" list)
- Remove --path /project (WORKDIR is already /project; matches
  barichello/godot-ci example usage)
- Add diagnostic RUN that prints the export_templates directory so
  CI logs reveal missing templates immediately
- Expand fallback export_presets.cfg with all required Godot 4.5
  Web preset fields (custom_template, variant/extensions_support)

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 08:09:14 -05:00
9cc4dc7ad3 fix(web): use gl_compatibility renderer for Godot 4.5 web export
Godot 4.5 web export requires renderer/rendering_method="gl_compatibility";
"compatibility" and "mobile" are both invalid for the Web platform.

- project.godot: switch renderer from "mobile" to "gl_compatibility",
  update config/features to "GL Compatibility", add mobile override
- Dockerfile.web: fix sed to replace any renderer value with
  "gl_compatibility" (handles forward_plus/mobile/any future value)

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:59:26 -05:00
4795df6182 fix(client): use instance= syntax for embedded scenes in CollectionScreen
CardsView and DecksView were incorrectly attached via script=ExtResource()
pointing at PackedScene resources.  Godot requires instance=ExtResource()
for scene embedding — this caused a fatal load error at export time.

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:54:04 -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
dingo 1b440e92ba build(web): install fontconfig in build stage for Godot HTML5 export 2026-02-28 12:11:45 +00:00
dingo 80c0f4d372 build(web): use headless mode to avoid X/Wayland display init in CI 2026-02-28 11:54:15 +00:00
dingo 44bc876e9b build(web): use Godot 4 export-release flag 2026-02-28 03:58:14 +00:00
dingo a39059a774 build(web): switch to HTML5 preset and no-window export command 2026-02-28 03:50:04 +00:00
dingo 0211e97e09 build(web): use Godot 4.5 image to match project feature version 2026-02-28 03:41:33 +00:00
dingo c19cf651de build(web): ensure export presets exist in image and precreate .godot/editor for headless export 2026-02-28 03:37:25 +00:00
dingo 505c0b59fa build(web): force compatibility renderer + import pass; export and copy index.html 2026-02-28 03:25:00 +00:00
dingo 1252486c3c ci: build Godot web export inside Dockerfile to avoid dind workspace mount issue 2026-02-28 03:20:50 +00:00
dingo 0383dd431b Add Godot web client build pipeline, image packaging, and Argo webclient deployment manifests 2026-02-28 02:47:41 +00:00
2d6b20f3cb Godot client: version check + content sync + caching architecture
Client flow after auth is now:
  LoginScreen → auth_success → InitScreen → MainScreen

autoloads/ContentCache.gd
  - Cursor-based incremental sync via content.sync (PageSize=200)
  - Merges definition DTOs in-memory (id → Dictionary)
  - Persists to user://content/defs.json on sync completion
  - Incremental on repeat launches: 0 round trips when nothing changed
  - Signals: sync_progress(fetched_total), sync_complete(total), sync_failed(error)

scenes/init/InitScreen.tscn + init_screen.gd
  - Step 1: version.check (clientVersion="0.1.0", platform="web")
      UpdateRequired  → show "please refresh" panel, block
      UpdateAvailable → soft banner, continue
      Ok              → continue
      DISCONNECTED    → wait for Network.connected (one-shot), retry
      other error     → warn + proceed (don't block player on non-critical check)
  - Step 2: ContentCache.start_sync()
      Shows running card count while pages arrive
      On sync_complete: transition to MainScreen
      On sync_failed: show error + Retry button

scenes/login/login_screen.gd
  - _go_to_main() now routes to InitScreen instead of MainScreen directly

project.godot
  - ContentCache registered as autoload (loads before Auth)
  - pointing/emulate_touch_from_mouse=true for desktop browser testing

Caching architecture decision (see plan):
  - Layer 1 (definitions/text): always sync all eagerly — no privacy concern
  - Layer 2 (2D art): lazy by definition ID, CDN fetch on demand
  - Layer 3 (3D models/animations): set-bundle granularity + server-injected
    noise during match pre-warm to prevent cache oracle attack
    (Layer 2/3 implementation is future work)

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 21:31:47 -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
dingo 3bdbfc8c57 Initial commit 2026-02-21 17:47:52 -05:00