fix(battle-viewer): unblock synthetic-game battle load
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>
This commit is contained in:
+8
-4
@@ -706,10 +706,14 @@ renders one battle at a time. Entry points:
|
||||
The viewer is a logically isolated component that consumes a
|
||||
`BattleReport` (shape per `pkg/model/report/battle.go`). The page
|
||||
loader (`ui/frontend/src/lib/active-view/battle.svelte`) fetches
|
||||
the report through the backend gateway route
|
||||
`GET /api/v1/user/games/{game_id}/battles/{turn}/{battle_id}`,
|
||||
which forwards verbatim to the engine's
|
||||
`GET /api/v1/battle/:turn/:uuid`.
|
||||
the report through the signed `user.games.battle` ConnectRPC
|
||||
command on the authenticated edge: the gateway translates the
|
||||
verified envelope into `GET /api/v1/user/games/{game_id}/battles/{turn}/{battle_id}`
|
||||
against the backend, which in turn proxies the engine's
|
||||
`GET /api/v1/battle/:turn/:uuid`. For synthetic games the loader
|
||||
short-circuits to the in-memory fixture map populated by the
|
||||
synthetic-report envelope (see below) and never touches the
|
||||
gateway.
|
||||
|
||||
Visual model is radial: the planet sits at the centre, races are
|
||||
placed at equal angular spacing on an outer ring, and each race is
|
||||
|
||||
Reference in New Issue
Block a user