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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (claude): close three assertions that could not fail
[._.]/ Adam Eivy350b53152ea1
diff --git a/client/src/components/music/MusicGenPanel.test.jsx b/client/src/components/music/MusicGenPanel.test.jsxindex 7a353f9f5c..e61d04c917 100644--- a/client/src/components/music/MusicGenPanel.test.jsx+++ b/client/src/components/music/MusicGenPanel.test.jsx@@ -1,4 +1,4 @@-import { describe, it, expect, vi, beforeEach } from 'vitest';+import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest';import { StrictMode } from 'react';import { fireEvent, render, screen, waitFor } from '@testing-library/react';import MusicGenPanel from './MusicGenPanel';@@ -71,6 +71,13 @@ describe('MusicGenPanel', () => {api.getInstances.mockResolvedValue({ peers: [] });});+ // `clearAllMocks` resets calls but leaves a spy installed. A test that pins+ // Date.now and then fails before restoring it would leave the clock frozen+ // for every test after it, turning one failure into a cascade.+ afterEach(() => {+ vi.restoreAllMocks();+ });+it('does not show a missing-runtime warning immediately for an empty saved track', async () => {api.listMusicEngines.mockResolvedValue({defaultEngine: 'acestep',@@ -305,6 +312,40 @@ describe('MusicGenPanel', () => {expect(requestBody).not.toHaveProperty('lyrics');});+ // The usable branch has no remedy text behind it, so without an assertion+ // here collapsing it back to `help || 'requires a ready peer'` would print+ // the not-ready sentence beside an enabled button and still ship green.+ it('reports a usable peer’s queue, and says it is ready when there is nothing to report', async () => {+ api.listMusicEngines.mockResolvedValue({ defaultEngine: 'musicgen', engines: [engine({ ready: true })] });+ const peer = (queue) => ({+ id: 'peer-example',+ name: 'Example GPU',+ status: 'online',+ enabled: true,+ mediaProvider: { enabled: true, audioModels: [{ engine: 'minimax-music3', modelId: 'minimax-music3' }] },+ mediaProviderStatus: {+ state: 'ready',+ checkedAt: new Date().toISOString(),+ freshUntil: new Date(Date.now() + 60_000).toISOString(),+ snapshot: { queue, capabilities: [] },+ },+ });++ api.getInstances.mockResolvedValue({+ peers: [peer({ accepting: true, running: 0, queued: 0, totalActive: 1, maxQueuedJobs: 4 })],+ });+ const { unmount } = render(<MusicGenPanel track={{ id: 'track-1' }} prompt="p" />);+ fireEvent.change(await screen.findByRole('combobox', { name: /generation target/i }), { target: { value: 'peer-example' } });+ expect(screen.getByText(/1\/4 shared slots active/)).toBeInTheDocument();+ unmount();++ // Same peer, but a queue block with no reportable counts at all.+ api.getInstances.mockResolvedValue({ peers: [peer({ accepting: true })] });+ render(<MusicGenPanel track={{ id: 'track-2' }} prompt="p" />);+ fireEvent.change(await screen.findByRole('combobox', { name: /generation target/i }), { target: { value: 'peer-example' } });+ expect(screen.getByText('Peer is ready.')).toBeInTheDocument();+ });+// `state` is the provider's verdict on its own surface, so a peer switched off// inside its freshness window still reads `ready`. Showing its queue there// suppressed the one line explaining why Generate was disabled.@@ -409,7 +450,6 @@ describe('MusicGenPanel', () => {await waitFor(() => expect(toast.error).toHaveBeenCalledWith(expect.stringMatching(/capacity snapshot expired/i)));expect(api.generateMusic).not.toHaveBeenCalled();- Date.now.mockRestore();});// The stored probe keeps saying `ready` long after the server would refusediff --git a/client/src/lib/federatedMediaReadiness.test.js b/client/src/lib/federatedMediaReadiness.test.jsindex cdb372da4c..3faebde456 100644--- a/client/src/lib/federatedMediaReadiness.test.js+++ b/client/src/lib/federatedMediaReadiness.test.js@@ -273,13 +273,17 @@ describe('summarizePeerMediaQueue', () => {// The provider omits an idle kind, but a build that sent one must not add a// segment saying nothing.+ // Asserted as an exact array: `toContain` on an array is element identity,+ // not substring, so `.not.toContain('audio')` would pass against a segment+ // reading 'audio 0 running' and verify nothing.it('omits a kind reporting no work', () => {expect(summarizePeerMediaQueue(queue({byKind: { audio: { running: 0, queued: 0 }, image: { running: 2, queued: 0 } },- }))).toContain('image 2 running');- expect(summarizePeerMediaQueue(queue({- byKind: { audio: { running: 0, queued: 0 } },- }))).not.toContain('audio');+ }))).toEqual([+ '2/4 shared slots active',+ 'image 2 running',+ 'federated 1 running, 1 queued',+ ]);});it('reports nothing at all when the queue block is missing', () => {