Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: improve Game workspace asset recovery (#3228)

[._.]/ Adam Eivy8861a890df2e
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 9a54c0c484..4a55cbb12a 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -33,6 +33,7 @@
- **Agy's model field is now labeled for what it actually selects, and can be overridden per render.** The Image Gen settings field was labeled "Image model" while listing Gemini agent models, which read as the wrong list being loaded. It isn't: `agy models` is the catalog of *agent* models the CLI's `--model` flag accepts, and that agent is what drives the built-in `generate_image` tool. Agy exposes no knob for the underlying image model — its `generate_image` takes prompt, image name, aspect ratio, and reference paths and nothing else — so there is no `imagen-*` option to offer, and passing one makes agy exit before it generates. The field is now "Default agent model" with that explanation, and the Image Gen page adds an **Agent model** picker so a single queue item can run on a different agent model than the saved default without a settings round-trip. Leaving it blank inherits the Settings value; a pinned model that Google later drops from the catalog falls back to the default instead of failing the render. The retry editor on a failed Agy job now edits that same model field (it was bound to the local model-id field, which Agy never reads).
## Game
+- **[issue-3228] Game detail workspaces keep asset blockers and controls in reach.** The compact header and section tabs stay pinned while each panel scrolls independently, blocked rows explain how to recover and link directly to surviving Sprite or Music records, and missing, malformed, and deleted music audio now report distinct causes.
- **[issue-3177] Added a Game studio for assembling managed-app asset bundles.** Create a Game workspace, bind reusable Sprite records and Music tracks, compile an immutable versioned manifest with SHA-256 asset references, and request persisted AI feedback with any configured provider, model, and supported effort. The new `/game/:id` workspace is reachable from Create, Cmd+K, and voice navigation.
- **Game workspaces now stay compact and verify assets before launch.** Bundle, Assets, and Feedback live in separate deep-linkable tabs; large sprite sets use a dense contained grid; imported prop atlases participate in bundles; and a preflight names every missing, stale, or hash-mismatched asset. A game can be started from its workspace only after the current manifest and all bound asset bytes pass verification.
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 1c2ed452cd..247f2526b4 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -1210,6 +1210,9 @@ export default function Layout() {
location.pathname.startsWith('/brain') ||
location.pathname.startsWith('/digital-twin') ||
location.pathname.startsWith('/feature-agents') ||
+ // Only Game DETAIL workspaces own an internal scroll region; the
+ // bare /game index stays on the normal padded page layout.
+ location.pathname.startsWith('/game/') ||
location.pathname.startsWith('/goals') ||
location.pathname.startsWith('/insights') ||
location.pathname.startsWith('/meatspace') ||
diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsx
index 8991252c34..6c33385c84 100644
--- a/client/src/components/Layout.test.jsx
+++ b/client/src/components/Layout.test.jsx
@@ -180,6 +180,19 @@ describe('Layout — persistent mobile touch targets', () => {
});
});
+describe('Layout — Game workspace scroll mode', () => {
+ it('makes only the Game detail route full-bleed', async () => {
+ const detail = await renderLayout('/game/example-game');
+ expect(detail.container.querySelector('#main-content')?.className).toContain('overflow-hidden');
+ detail.unmount();
+
+ const index = await renderLayout('/game');
+ const main = index.container.querySelector('#main-content');
+ expect(main?.className).toContain('overflow-auto');
+ expect(main?.className).toContain('p-4');
+ });
+});
+
describe('Layout — dynamic third-level navigation', () => {
it('collapses and expands the Series and Universes children', async () => {
api.listPipelineSeries.mockResolvedValue([{ id: 'series-1', name: 'Example Series' }]);
diff --git a/client/src/components/games/GameBindings.jsx b/client/src/components/games/GameBindings.jsx
index 5f91e583b5..2592bf9366 100644
--- a/client/src/components/games/GameBindings.jsx
+++ b/client/src/components/games/GameBindings.jsx
@@ -1,5 +1,6 @@
import { useMemo, useState } from 'react';
-import { AlertTriangle, CheckCircle2, HelpCircle, Music2, PersonStanding, Plus, Unlink } from 'lucide-react';
+import { AlertTriangle, ArrowUpRight, CheckCircle2, HelpCircle, Music2, PersonStanding, Plus, Unlink } from 'lucide-react';
+import { Link } from 'react-router-dom';
import Pill from '../ui/Pill.jsx';
const selectClass = 'w-full min-h-[44px] rounded-lg border border-port-border bg-port-bg px-3 py-2 text-sm text-white';
@@ -21,23 +22,52 @@ const healthTone = (health) => {
return HEALTH_TONES[health.status] || HEALTH_TONES.blocked;
};
-function BindingRow({ label, detail, health, disabled, onUnbind, unbindTitle }) {
+const missingHelp = {
+ SPRITE_MISSING: 'This Sprite Manager record was deleted. Unbind it from this game to clear the blocker.',
+ TRACK_MISSING: 'This music track was deleted. Unbind it from this game to clear the blocker.',
+};
+
+function BindingRow({
+ label,
+ detail,
+ health,
+ issue,
+ manageTo,
+ manageLabel,
+ disabled,
+ onUnbind,
+ unbindTitle,
+}) {
const { Icon, className } = healthTone(health);
const message = health?.message || detail;
+ const needsAttention = health?.status === 'blocked';
+ const explanation = missingHelp[issue?.code] || issue?.message;
return (
- <li className="flex min-h-[54px] items-center justify-between gap-2 rounded-lg border border-port-border bg-port-bg/50 px-3 py-1.5">
- <div className="min-w-0">
+ <li className="flex min-h-[54px] items-start justify-between gap-2 rounded-lg border border-port-border bg-port-bg/50 px-3 py-2">
+ <div className="min-w-0 flex-1">
<div className="flex items-center gap-1.5">
<Icon className={`h-3.5 w-3.5 shrink-0 ${className}`} aria-hidden="true" />
<div className="truncate text-sm font-medium text-white">{label}</div>
</div>
<div className="truncate text-xs text-gray-500" title={message}>{message}</div>
+ {needsAttention && explanation ? (
+ <p className="mt-1 text-xs leading-5 text-gray-400">{explanation}</p>
+ ) : null}
+ {needsAttention && manageTo ? (
+ <Link
+ to={manageTo}
+ className="mt-1 inline-flex min-h-[32px] items-center gap-1 text-xs font-medium text-port-accent hover:underline"
+ >
+ {manageLabel}
+ <ArrowUpRight className="h-3.5 w-3.5" aria-hidden="true" />
+ </Link>
+ ) : null}
</div>
<button
type="button"
onClick={onUnbind}
disabled={disabled}
- className="min-h-[44px] min-w-[44px] rounded-lg p-2 text-gray-400 hover:text-port-error disabled:opacity-50"
+ className="min-h-[44px] min-w-[44px] shrink-0 rounded-lg p-2 text-gray-400 hover:text-port-error disabled:opacity-50"
aria-label={`Unbind ${label}`}
title={unbindTitle}
>
@@ -122,6 +152,16 @@ export default function GameBindings({
const musicIntegrity = useMemo(() => new Map(
(integrity?.assets?.music || []).map((asset) => [asset.bindingId, asset]),
), [integrity]);
+ const spriteIssues = useMemo(() => new Map(
+ (integrity?.issues || [])
+ .filter((issue) => issue.assetType === 'sprite')
+ .map((issue) => [issue.assetId, issue]),
+ ), [integrity]);
+ const musicIssues = useMemo(() => new Map(
+ (integrity?.issues || [])
+ .filter((issue) => issue.assetType === 'music')
+ .map((issue) => [issue.assetId, issue]),
+ ), [integrity]);
const boundSpriteIds = new Set(game.spriteBindings.map((binding) => binding.spriteId));
const boundTrackIds = new Set(game.musicBindings.map((binding) => binding.trackId));
const availableSprites = sprites
@@ -158,12 +198,16 @@ export default function GameBindings({
<ul className="grid max-h-72 gap-2 overflow-y-auto pr-1 sm:grid-cols-2">
{game.spriteBindings.map((binding) => {
const sprite = spriteMap.get(binding.spriteId);
+ const issue = spriteIssues.get(binding.spriteId);
return (
<BindingRow
key={binding.spriteId}
label={sprite?.name || binding.spriteId}
detail={sprite ? `${sprite.kind} · ${sprite.status}` : 'Record unavailable'}
health={spriteIntegrity.get(binding.spriteId)}
+ issue={issue}
+ manageTo={sprite ? `/sprites/${encodeURIComponent(binding.spriteId)}` : null}
+ manageLabel="Open in Sprite Manager"
disabled={busy}
onUnbind={() => onUnbindSprite(binding.spriteId)}
unbindTitle="Unbind sprite"
@@ -190,6 +234,7 @@ export default function GameBindings({
<ul className="max-h-72 space-y-2 overflow-y-auto pr-1">
{game.musicBindings.map((binding) => {
const track = trackMap.get(binding.trackId);
+ const issue = musicIssues.get(binding.trackId);
return (
<BindingRow
key={binding.id}
@@ -200,6 +245,9 @@ export default function GameBindings({
// nobody hashed. The server's own message wins when present.
detail={track?.audioFilename ? 'Audio attached' : 'No audio yet'}
health={musicIntegrity.get(binding.id)}
+ issue={issue}
+ manageTo={track ? `/music/tracks/${encodeURIComponent(binding.trackId)}` : null}
+ manageLabel="Open in Music"
disabled={busy}
onUnbind={() => onUnbindMusic(binding.id)}
unbindTitle="Unbind music track"
diff --git a/client/src/components/games/GameBindings.test.jsx b/client/src/components/games/GameBindings.test.jsx
new file mode 100644
index 0000000000..e8a65ea05a
--- /dev/null
+++ b/client/src/components/games/GameBindings.test.jsx
@@ -0,0 +1,78 @@
+import { render, screen, within } from '@testing-library/react';
+import { MemoryRouter } from 'react-router-dom';
+import { describe, expect, it, vi } from 'vitest';
+import GameBindings from './GameBindings.jsx';
+
+const noop = vi.fn();
+
+const renderBindings = () => render(
+ <MemoryRouter>
+ <GameBindings
+ game={{
+ spriteBindings: [{ spriteId: 'deleted-sprite' }],
+ musicBindings: [{ id: 'binding-1', trackId: 'theme/one' }],
+ }}
+ sprites={[]}
+ tracks={[{
+ id: 'theme/one',
+ title: 'Example Theme',
+ audioFilename: 'example-theme.ogg',
+ }]}
+ integrity={{
+ issues: [
+ {
+ assetType: 'sprite',
+ assetId: 'deleted-sprite',
+ code: 'SPRITE_MISSING',
+ message: 'Bound sprite no longer exists: deleted-sprite',
+ },
+ {
+ assetType: 'music',
+ assetId: 'theme/one',
+ code: 'TRACK_AUDIO_INTEGRITY_FAILED',
+ message: 'The rendered audio path for "Example Theme" is invalid',
+ },
+ ],
+ assets: {
+ sprites: [{
+ assetId: 'deleted-sprite',
+ status: 'blocked',
+ message: 'Bound sprite no longer exists',
+ }],
+ music: [{
+ bindingId: 'binding-1',
+ status: 'blocked',
+ message: 'Audio path invalid',
+ }],
+ },
+ }}
+ busy={false}
+ onBindSprite={noop}
+ onUnbindSprite={noop}
+ onBindMusic={noop}
+ onUnbindMusic={noop}
+ />
+ </MemoryRouter>,
+);
+
+describe('GameBindings', () => {
+ it('explains a missing source without linking to its deleted record', () => {
+ renderBindings();
+
+ expect(screen.getByText(
+ 'This Sprite Manager record was deleted. Unbind it from this game to clear the blocker.',
+ )).toBeInTheDocument();
+ const spriteSection = screen.getByRole('heading', { name: 'Sprite assets' }).closest('section');
+ expect(within(spriteSection).queryByRole('link')).not.toBeInTheDocument();
+ });
+
+ it('falls back to the server message and links when the source record exists', () => {
+ renderBindings();
+
+ expect(screen.getByText(
+ 'The rendered audio path for "Example Theme" is invalid',
+ )).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: 'Open in Music' }))
+ .toHaveAttribute('href', '/music/tracks/theme%2Fone');
+ });
+});
diff --git a/client/src/components/games/GameCompilePanel.jsx b/client/src/components/games/GameCompilePanel.jsx
index c99c247663..c7de07a586 100644
--- a/client/src/components/games/GameCompilePanel.jsx
+++ b/client/src/components/games/GameCompilePanel.jsx
@@ -1,5 +1,6 @@
import {
AlertTriangle,
+ ArrowUpRight,
Boxes,
CheckCircle2,
CircleDashed,
@@ -8,6 +9,7 @@ import {
RefreshCw,
ShieldCheck,
} from 'lucide-react';
+import { Link } from 'react-router-dom';
import Banner from '../ui/Banner.jsx';
import { formatDateShort } from '../../utils/formatters.js';
@@ -42,8 +44,26 @@ const statusStyle = {
},
};
+const manageSource = (issue, spriteIds, trackIds) => {
+ if (issue.assetType === 'sprite' && spriteIds.has(issue.assetId)) {
+ return {
+ label: 'Open in Sprite Manager',
+ to: `/sprites/${encodeURIComponent(issue.assetId)}`,
+ };
+ }
+ if (issue.assetType === 'music' && trackIds.has(issue.assetId)) {
+ return {
+ label: 'Open in Music',
+ to: `/music/tracks/${encodeURIComponent(issue.assetId)}`,
+ };
+ }
+ return null;
+};
+
export default function GameCompilePanel({
game,
+ sprites = [],
+ tracks = [],
integrity,
loadingIntegrity,
compiling,
@@ -63,6 +83,8 @@ export default function GameCompilePanel({
const StatusIcon = bundleStatus.icon;
const blocked = !integrity || !integrity.readyToCompile;
const issues = integrity?.issues || [];
+ const spriteIds = new Set(sprites.map((sprite) => sprite.id));
+ const trackIds = new Set(tracks.map((track) => track.id));
return (
<section className="rounded-xl border border-port-border bg-port-card p-4">
<div className="flex flex-col justify-between gap-3 sm:flex-row sm:items-start">
@@ -153,11 +175,25 @@ export default function GameCompilePanel({
className="mt-4"
>
<ul className="mt-2 grid gap-1 sm:grid-cols-2">
- {issues.map((item) => (
- <li key={`${item.assetType}-${item.assetId}`} className="truncate" title={item.message}>
- <span className="font-medium">{item.name}</span>: {item.message}
- </li>
- ))}
+ {issues.map((item) => {
+ const source = manageSource(item, spriteIds, trackIds);
+ return (
+ <li key={`${item.assetType}-${item.assetId}`} className="min-w-0" title={item.message}>
+ <div className="truncate">
+ <span className="font-medium">{item.name}</span>: {item.message}
+ </div>
+ {source ? (
+ <Link
+ to={source.to}
+ className="mt-1 inline-flex min-h-[32px] items-center gap-1 text-xs font-medium text-port-accent hover:underline"
+ >
+ {source.label}
+ <ArrowUpRight className="h-3.5 w-3.5" aria-hidden="true" />
+ </Link>
+ ) : null}
+ </li>
+ );
+ })}
</ul>
</Banner>
)}
diff --git a/client/src/components/games/GameCompilePanel.test.jsx b/client/src/components/games/GameCompilePanel.test.jsx
index 578714e35a..483eef7ec0 100644
--- a/client/src/components/games/GameCompilePanel.test.jsx
+++ b/client/src/components/games/GameCompilePanel.test.jsx
@@ -1,14 +1,20 @@
import { fireEvent, render, screen } from '@testing-library/react';
+import { MemoryRouter } from 'react-router-dom';
import { describe, expect, it, vi } from 'vitest';
import GameCompilePanel from './GameCompilePanel.jsx';
const game = {
compiledManifest: null,
};
+const renderPanel = (panel) => render(
+ <MemoryRouter>
+ {panel}
+ </MemoryRouter>,
+);
describe('GameCompilePanel', () => {
it('surfaces integrity blockers and gates build and launch', () => {
- render(
+ renderPanel(
<GameCompilePanel
game={game}
integrity={{
@@ -41,7 +47,7 @@ describe('GameCompilePanel', () => {
it('surfaces a compile failure as an alert', () => {
// The inline alert is the only surface for a failed compile — the page
// deliberately does not also toast it.
- render(
+ renderPanel(
<GameCompilePanel
game={game}
integrity={{
@@ -65,7 +71,7 @@ describe('GameCompilePanel', () => {
// that would leave Build enabled on an unverified tree and label an existing
// bundle "Not built" right above the block describing it.
const onRetryIntegrity = vi.fn();
- render(
+ renderPanel(
<GameCompilePanel
game={{ compiledManifest: { version: 2, spriteCount: 1, musicCount: 0, builtAt: '2026-07-28T12:00:00.000Z', manifestPath: 'manifests/game-assets-v2.json' } }}
integrity={null}
@@ -86,7 +92,7 @@ describe('GameCompilePanel', () => {
});
it('does not offer to build while the preflight is still loading', () => {
- render(
+ renderPanel(
<GameCompilePanel
game={game}
integrity={null}
@@ -104,7 +110,7 @@ describe('GameCompilePanel', () => {
it('allows a verified bundle to launch', () => {
const onLaunch = vi.fn();
- render(
+ renderPanel(
<GameCompilePanel
game={{
compiledManifest: {
@@ -136,4 +142,42 @@ describe('GameCompilePanel', () => {
expect(onLaunch).toHaveBeenCalledOnce();
expect(screen.getByText('Verified')).toBeInTheDocument();
});
+
+ it('links resolved blockers to their source records but not deleted records', () => {
+ renderPanel(
+ <GameCompilePanel
+ game={game}
+ sprites={[{ id: 'hero/one' }]}
+ tracks={[]}
+ integrity={{
+ readyToCompile: false,
+ canLaunch: false,
+ bundle: { status: 'missing' },
+ issues: [
+ {
+ assetType: 'sprite',
+ assetId: 'hero/one',
+ name: 'Hero',
+ code: 'SPRITE_ATLAS_REQUIRED',
+ message: 'Runtime atlas required',
+ },
+ {
+ assetType: 'music',
+ assetId: 'deleted-track',
+ name: 'Deleted Track',
+ code: 'TRACK_MISSING',
+ message: 'Bound music track no longer exists',
+ },
+ ],
+ counts: { spriteReady: 0, spriteTotal: 1, verifiedFiles: 0 },
+ }}
+ onCompile={() => {}}
+ onLaunch={() => {}}
+ />,
+ );
+
+ expect(screen.getByRole('link', { name: 'Open in Sprite Manager' }))
+ .toHaveAttribute('href', '/sprites/hero%2Fone');
+ expect(screen.queryByRole('link', { name: 'Open in Music' })).not.toBeInTheDocument();
+ });
});
diff --git a/client/src/pages/Game.jsx b/client/src/pages/Game.jsx
index 19e3f1f10d..6c00c959cd 100644
--- a/client/src/pages/Game.jsx
+++ b/client/src/pages/Game.jsx
@@ -286,19 +286,21 @@ export default function Game() {
// feedback, launch, …) doesn't have to be remembered in an exclusion list.
const bindingBusy = /^(un)?bind-/.test(busy);
return (
- <div className="mx-auto max-w-6xl space-y-4">
- <header className="flex flex-col justify-between gap-2 sm:flex-row sm:items-end">
- <div>
- <Link to="/game" className="mb-2 inline-flex min-h-[44px] items-center gap-2 text-sm text-gray-400 hover:text-white">
+ <div className="flex h-full min-h-0 flex-col">
+ <header className="flex shrink-0 flex-col justify-between gap-2 border-b border-port-border px-4 py-3 sm:flex-row sm:items-center">
+ <div className="flex min-w-0 items-center gap-3">
+ <Link
+ to="/game"
+ className="inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-lg text-gray-400 hover:bg-port-card hover:text-white"
+ aria-label="All Games"
+ title="All Games"
+ >
<ArrowLeft className="h-4 w-4" aria-hidden="true" />
- All Games
</Link>
- <div className="flex items-center gap-3">
- <Gamepad2 className="h-7 w-7 text-port-accent" aria-hidden="true" />
- <div>
- <h1 className="text-2xl font-bold text-white">{game.name}</h1>
- <p className="text-sm text-gray-400">{app?.name || 'Managed app unavailable'}</p>
- </div>
+ <Gamepad2 className="h-6 w-6 shrink-0 text-port-accent" aria-hidden="true" />
+ <div className="min-w-0">
+ <h1 className="truncate text-xl font-bold text-white">{game.name}</h1>
+ <p className="truncate text-xs text-gray-400">{app?.name || 'Managed app unavailable'}</p>
</div>
</div>
<div className="flex items-center gap-2 text-xs text-gray-400">
@@ -316,43 +318,50 @@ export default function Game() {
controlsIdPrefix="game-panel"
mobileDropdown
mobileSelectId="game-section"
+ className="px-4"
/>
- {activeTab === 'bundle' && (
- <div id="game-panel-bundle" role="tabpanel" aria-labelledby="tab-bundle">
- <GameCompilePanel
- game={game}
- integrity={integrity}
- loadingIntegrity={integrityLoading}
- compiling={busy === 'compile'}
- launching={busy === 'launch'}
- compileError={compileError}
- onCompile={compile}
- onLaunch={launch}
- onRetryIntegrity={refreshIntegrity}
- />
- </div>
- )}
- {activeTab === 'assets' && (
- <div id="game-panel-assets" role="tabpanel" aria-labelledby="tab-assets">
- <GameBindings
- game={game}
- sprites={sprites}
- tracks={tracks}
- integrity={integrity}
- busy={bindingBusy}
- onBindSprite={(spriteId) => mutate('bind-sprite', () => bindGameSprite(game.id, spriteId, silent), 'Sprite bound')}
- onUnbindSprite={(spriteId) => mutate('unbind-sprite', () => unbindGameSprite(game.id, spriteId, silent), 'Sprite unbound')}
- onBindMusic={(trackId) => mutate('bind-music', () => bindGameMusic(game.id, trackId, silent), 'Music bound')}
- onUnbindMusic={(bindingId) => mutate('unbind-music', () => unbindGameMusic(game.id, bindingId, silent), 'Music unbound')}
- />
- </div>
- )}
- {activeTab === 'feedback' && (
- <div id="game-panel-feedback" role="tabpanel" aria-labelledby="tab-feedback">
- <GameFeedback history={game.feedbackHistory} submitting={busy === 'feedback'} onSubmit={feedback} />
+ <div className="min-h-0 flex-1 overflow-y-auto p-4">
+ <div className="mx-auto max-w-6xl">
+ {activeTab === 'bundle' && (
+ <div id="game-panel-bundle" role="tabpanel" aria-labelledby="tab-bundle">
+ <GameCompilePanel
+ game={game}
+ sprites={sprites}
+ tracks={tracks}
+ integrity={integrity}
+ loadingIntegrity={integrityLoading}
+ compiling={busy === 'compile'}
+ launching={busy === 'launch'}
+ compileError={compileError}
+ onCompile={compile}
+ onLaunch={launch}
+ onRetryIntegrity={refreshIntegrity}
+ />
+ </div>
+ )}
+ {activeTab === 'assets' && (
+ <div id="game-panel-assets" role="tabpanel" aria-labelledby="tab-assets">
+ <GameBindings
+ game={game}
+ sprites={sprites}
+ tracks={tracks}
+ integrity={integrity}
+ busy={bindingBusy}
+ onBindSprite={(spriteId) => mutate('bind-sprite', () => bindGameSprite(game.id, spriteId, silent), 'Sprite bound')}
+ onUnbindSprite={(spriteId) => mutate('unbind-sprite', () => unbindGameSprite(game.id, spriteId, silent), 'Sprite unbound')}
+ onBindMusic={(trackId) => mutate('bind-music', () => bindGameMusic(game.id, trackId, silent), 'Music bound')}
+ onUnbindMusic={(bindingId) => mutate('unbind-music', () => unbindGameMusic(game.id, bindingId, silent), 'Music unbound')}
+ />
+ </div>
+ )}
+ {activeTab === 'feedback' && (
+ <div id="game-panel-feedback" role="tabpanel" aria-labelledby="tab-feedback">
+ <GameFeedback history={game.feedbackHistory} submitting={busy === 'feedback'} onSubmit={feedback} />
+ </div>
+ )}
</div>
- )}
+ </div>
</div>
);
}
diff --git a/client/src/pages/Game.test.jsx b/client/src/pages/Game.test.jsx
index 6e2e61a644..a8813ff9e8 100644
--- a/client/src/pages/Game.test.jsx
+++ b/client/src/pages/Game.test.jsx
@@ -115,6 +115,13 @@ describe('Game page', () => {
renderAt('/game/verified-game');
expect(await screen.findByText('Verified')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Start game' })).toBeEnabled();
+ const back = screen.getByRole('link', { name: 'All Games' });
+ expect(back.className).toContain('h-11');
+ expect(back.className).toContain('w-11');
+ expect(back).toHaveAttribute('title', 'All Games');
+ expect(back.closest('header')?.className).toContain('shrink-0');
+ expect(screen.getByRole('tabpanel').parentElement?.parentElement?.className)
+ .toContain('overflow-y-auto');
});
it('never offers to launch a game whose bundle was never built', async () => {
diff --git a/server/services/games/integrity.js b/server/services/games/integrity.js
index 5439a028c8..e40f3b94fe 100644
--- a/server/services/games/integrity.js
+++ b/server/services/games/integrity.js
@@ -212,7 +212,7 @@ async function resolveMusic(binding) {
// can reach here with one. Screen it first, or one bad track fails the whole
// read-only preflight instead of naming itself (same reason the sprite path
// guards on `isValidSpriteId`).
- if (!isSafeMusicFilename(track.audioFilename) || !(await statMusicTrack(track.audioFilename))) {
+ if (!track.audioFilename) {
return blocked(
'music',
identity,
@@ -222,6 +222,26 @@ async function resolveMusic(binding) {
);
}
+ if (!isSafeMusicFilename(track.audioFilename)) {
+ return blocked(
+ 'music',
+ identity,
+ 'TRACK_AUDIO_INTEGRITY_FAILED',
+ `The rendered audio path for "${track.title}" is invalid`,
+ 'Audio path invalid',
+ );
+ }
+
+ if (!(await statMusicTrack(track.audioFilename))) {
+ return blocked(
+ 'music',
+ identity,
+ 'TRACK_AUDIO_MISSING',
+ `The rendered audio for "${track.title}" is missing or unreadable`,
+ 'Audio integrity failed',
+ );
+ }
+
const audioSha256 = await hashIfPresent(join(PATHS.music, track.audioFilename));
if (!audioSha256) {
return blocked(
diff --git a/server/services/games/integrity.test.js b/server/services/games/integrity.test.js
index ed6d35089d..1d8865e780 100644
--- a/server/services/games/integrity.test.js
+++ b/server/services/games/integrity.test.js
@@ -245,17 +245,48 @@ describe('Game bundle integrity', () => {
});
});
- it('blocks a track whose stored filename is not a supported music name', async () => {
+ it('distinguishes missing, malformed, and missing-file track audio', async () => {
// `sanitizeTrack` only trims the top-level audioFilename, so a legacy or
// peer-synced track can carry one `statMusicTrack` would THROW a 400 on.
// It has to become one blocked row, not a failed preflight.
state.game.spriteBindings = [];
const { getTrack } = await import('../tracks/index.js');
- getTrack.mockResolvedValueOnce({ id: 'theme', title: 'Legacy Theme', audioFilename: 'theme.opus' });
- const resolved = await resolveGameAssets(state.game);
- expect(resolved.music).toEqual([]);
- expect(resolved.issues).toEqual([
- expect.objectContaining({ assetId: 'theme', code: 'TRACK_AUDIO_REQUIRED' }),
+ const { statMusicTrack } = await import('../pipeline/musicLibrary.js');
+
+ getTrack.mockResolvedValueOnce({ id: 'theme', title: 'No Audio' });
+ const missingName = await resolveGameAssets(state.game);
+ expect(missingName.issues).toEqual([
+ expect.objectContaining({
+ code: 'TRACK_AUDIO_REQUIRED',
+ message: expect.stringContaining('Render or upload audio'),
+ }),
+ ]);
+
+ getTrack.mockResolvedValueOnce({
+ id: 'theme',
+ title: 'Legacy Theme',
+ audioFilename: 'theme.opus',
+ });
+ const malformedName = await resolveGameAssets(state.game);
+ expect(malformedName.issues).toEqual([
+ expect.objectContaining({
+ code: 'TRACK_AUDIO_INTEGRITY_FAILED',
+ message: 'The rendered audio path for "Legacy Theme" is invalid',
+ }),
+ ]);
+
+ getTrack.mockResolvedValueOnce({
+ id: 'theme',
+ title: 'Missing Theme',
+ audioFilename: 'missing-theme.ogg',
+ });
+ statMusicTrack.mockResolvedValueOnce(null);
+ const missingFile = await resolveGameAssets(state.game);
+ expect(missingFile.issues).toEqual([
+ expect.objectContaining({
+ code: 'TRACK_AUDIO_MISSING',
+ message: 'The rendered audio for "Missing Theme" is missing or unreadable',
+ }),
]);
});
});