fix(battle-viewer): unblock synthetic-game battle load #16

Merged
developer merged 1 commits from feature/synthetic-battle-loading-fix into development 2026-05-19 05:58:02 +00:00
Owner

Summary

  • lib/active-view/battle.svelte was waiting on a GalaxyClient handle that the in-game shell layout deliberately never publishes for synthetic-report games, so clicking a battle cross in any synthetic game (e.g. loaded from tools/local-dev/reports/dg/KNNTS041.json) sat on "loading battle…" forever.
  • Let the guard skip the wait when isSyntheticGameId(gameId)fetchBattle already resolves synthetic ids from the in-memory fixture map and ignores the client. Widen its signature to GalaxyClient | null.
  • Bring docs/FUNCTIONAL.md §6.5 + Russian mirror in sync with the Phase 28 ConnectRPC migration (still described the pre-Phase-28 raw REST path).

Test plan

  • npx vitest run game-shell-stubs.test.ts — 9 tests pass, including two new regressions (synthetic + missing fixture → not_found; synthetic + registered fixture → BattleViewer mounts)
  • npx vitest run — full suite 651/651 green
  • npm run check — svelte-check 0 errors / 0 warnings
  • Gitea ui-test workflow #194 green on the feature branch
  • Manual: reload https://www.galaxy.lan, open a synthetic-report game from KNNTS041.json, click a battle cross — viewer renders instead of hanging
## Summary - `lib/active-view/battle.svelte` was waiting on a `GalaxyClient` handle that the in-game shell layout deliberately never publishes for synthetic-report games, so clicking a battle cross in any synthetic game (e.g. loaded from `tools/local-dev/reports/dg/KNNTS041.json`) sat on "loading battle…" forever. - Let the guard skip the wait when `isSyntheticGameId(gameId)` — `fetchBattle` already resolves synthetic ids from the in-memory fixture map and ignores the client. Widen its signature to `GalaxyClient | null`. - Bring `docs/FUNCTIONAL.md` §6.5 + Russian mirror in sync with the Phase 28 ConnectRPC migration (still described the pre-Phase-28 raw REST path). ## Test plan - [x] `npx vitest run game-shell-stubs.test.ts` — 9 tests pass, including two new regressions (synthetic + missing fixture → not_found; synthetic + registered fixture → BattleViewer mounts) - [x] `npx vitest run` — full suite 651/651 green - [x] `npm run check` — svelte-check 0 errors / 0 warnings - [x] Gitea ui-test workflow #194 green on the feature branch - [ ] Manual: reload `https://www.galaxy.lan`, open a synthetic-report game from KNNTS041.json, click a battle cross — viewer renders instead of hanging
developer added 1 commit 2026-05-19 05:57:44 +00:00
fix(battle-viewer): unblock synthetic-game battle load
Tests · UI / test (push) Successful in 2m18s
Tests · UI / test (pull_request) Waiting to run
bde01b1ce2
The Phase 28 ConnectRPC migration of the battle viewer added a
guard in `lib/active-view/battle.svelte` that waits for the
surrounding layout to publish a `GalaxyClient` before issuing the
fetch. The in-game shell layout deliberately skips
`galaxyClient.set(...)` on the synthetic branch (gateway is not
reachable in synthetic mode), so for any battle opened from a
synthetic-report game the viewer sat on "loading battle…"
forever — `fetchBattle` was never called, so the synthetic-fixture
short-circuit it carries was unreachable.

Let the guard skip synthetic ids: `fetchBattle` already resolves
those through `lookupSyntheticBattle` and never touches the
client, so its signature widens to `GalaxyClient | null` and the
synthetic path passes `null`. The live path still waits for the
handle as before; a `null` client on the live path now fails
fast with a transport-level `BattleFetchError` instead of silently
sitting on `loading`.

Tests:
- Existing "loading placeholder" smoke now uses a non-synthetic
  game id so it keeps asserting the live-path wait.
- Two new cases pin the synthetic behaviour: missing fixture →
  `battle-not-found`; registered fixture → `BattleViewer` mounts.

Docs:
- `docs/FUNCTIONAL.md` §6.5 still described the pre-Phase-28
  raw REST path. Updated to the signed ConnectRPC command and
  noted the synthetic short-circuit. Russian mirror updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
developer merged commit 8f84075c4b into development 2026-05-19 05:58:02 +00:00
developer deleted branch feature/synthetic-battle-loading-fix 2026-05-19 05:58:02 +00:00
Sign in to join this conversation.