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

cover the integrity 404, corrupt-binding guard, and compile-error alert

[._.]/ Adam Eivya0936a8c1633
diff --git a/client/src/components/games/GameCompilePanel.test.jsx b/client/src/components/games/GameCompilePanel.test.jsx
index 4a5411531d..2a82ff112d 100644
--- a/client/src/components/games/GameCompilePanel.test.jsx
+++ b/client/src/components/games/GameCompilePanel.test.jsx
@@ -38,6 +38,28 @@ describe('GameCompilePanel', () => {
expect(screen.getByRole('button', { name: 'Start game' })).toBeDisabled();
});
+ 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(
+ <GameCompilePanel
+ game={game}
+ integrity={{
+ readyToCompile: true,
+ canLaunch: false,
+ bundle: { status: 'missing' },
+ issues: [],
+ counts: { spriteReady: 1, spriteTotal: 1, verifiedFiles: 2 },
+ }}
+ compileError="The runtime atlas for &quot;Hero&quot; is missing or does not match its recorded hash"
+ onCompile={() => {}}
+ onLaunch={() => {}}
+ />,
+ );
+
+ expect(screen.getByRole('alert')).toHaveTextContent('does not match its recorded hash');
+ });
+
it('allows a verified bundle to launch', () => {
const onLaunch = vi.fn();
render(
diff --git a/server/routes/games.test.js b/server/routes/games.test.js
index d4a6864b55..bc3d74d2b2 100644
--- a/server/routes/games.test.js
+++ b/server/routes/games.test.js
@@ -67,6 +67,13 @@ describe('Game routes', () => {
expect(games.getGameIntegrity).toHaveBeenCalledWith('game-1');
});
+ it('404s the integrity preflight for a game that does not exist', async () => {
+ games.getGameIntegrity.mockResolvedValueOnce(null);
+ const response = await request(makeApp()).get('/api/games/missing/integrity');
+ expect(response.status).toBe(404);
+ expect(response.body.code).toBe('NOT_FOUND');
+ });
+
it('passes explicit provider, model, effort, and prompt to feedback', async () => {
games.requestGameFeedback.mockResolvedValueOnce({
feedback: { id: 'feedback-1', text: 'Add a victory cue.' },
diff --git a/server/services/games/integrity.test.js b/server/services/games/integrity.test.js
index cff92b404a..37d50a389a 100644
--- a/server/services/games/integrity.test.js
+++ b/server/services/games/integrity.test.js
@@ -37,7 +37,7 @@ vi.mock('../sprites/paths.js', () => ({
}));
vi.mock('../sprites/recordsLogic.js', () => ({
- isValidSpriteId: vi.fn(() => true),
+ isValidSpriteId: vi.fn((id) => !String(id).includes('/')),
}));
vi.mock('../tracks/index.js', () => ({
@@ -124,6 +124,20 @@ describe('Game bundle integrity', () => {
]));
});
+ it('reports a corrupt binding id as a blocked asset instead of throwing', async () => {
+ // The atlas pointer read is issued in parallel with the record read, so a
+ // binding whose id is not a valid slug must be gated — `spriteDir` throws a
+ // 400 on one, which would fail the whole preflight instead of naming the
+ // one bad binding.
+ state.game.spriteBindings = [{ spriteId: '../escape' }];
+ const resolved = await resolveGameAssets(state.game);
+ expect(resolved.sprites).toEqual([]);
+ expect(resolved.issues).toEqual([
+ expect.objectContaining({ assetId: '../escape', code: 'SPRITE_MISSING' }),
+ ]);
+ expect(resolved.summaries.sprites[0]).toMatchObject({ status: 'blocked' });
+ });
+
it('marks a complete hash-matching manifest current and launchable', async () => {
state.game.spriteBindings = state.game.spriteBindings.filter(
(binding) => binding.spriteId !== 'draft-character',