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

fix(tests): remove two wall-clock races that only fail under CI load

[._.]/ Adam Eivyab0affb67578
diff --git a/client/src/pages/SongBookViewer.test.jsx b/client/src/pages/SongBookViewer.test.jsx
index 98628d8689..a4675baca9 100644
--- a/client/src/pages/SongBookViewer.test.jsx
+++ b/client/src/pages/SongBookViewer.test.jsx
@@ -452,8 +452,15 @@ K: o - - - - - o -`;
api.getSong.mockResolvedValue(drumSong());
renderPage();
await screen.findByLabelText('Turn the metronome off');
- fireEvent.keyDown(window, { key: 'm' });
- expect(await screen.findByLabelText('Turn the metronome on')).toBeTruthy();
+ // The `m` binding lives on a window listener attached in an effect, while
+ // `findByLabelText` resolves on the transport bar's DOM mutation — which
+ // can commit first. Retry the keystroke until it lands, or a loaded runner
+ // drops it into a page that has no handler yet. (The click-based tests
+ // aren't exposed to this: those are React prop handlers.)
+ await waitFor(() => {
+ fireEvent.keyDown(window, { key: 'm' });
+ expect(screen.getByLabelText('Turn the metronome on')).toBeTruthy();
+ });
fireEvent.keyDown(window, { key: 'm' });
expect(await screen.findByLabelText('Turn the metronome off')).toBeTruthy();
});
diff --git a/server/services/llamaServerManager.test.js b/server/services/llamaServerManager.test.js
index 1298f8bcf7..2f9b87605c 100644
--- a/server/services/llamaServerManager.test.js
+++ b/server/services/llamaServerManager.test.js
@@ -318,18 +318,16 @@ describe('llamaServerManager', () => {
vi.spyOn(childProcess, 'spawn').mockImplementation((cmd, args) => {
spawnCalls.push({ cmd, args });
const child = args[0] === 'install' ? installChild : linkChild;
+ // The binary shows up on PATH because `brew link` ran — key the mock off
+ // that spawn, not a wall-clock timer. A timer races the install child's
+ // own exit handler, and on a loaded runner it can fire first, making the
+ // binary look already-linked so the link step never happens (#4642).
+ if (args[0] === 'link') findSpy.mockReturnValue('/opt/homebrew/bin/llama-server');
setTimeout(() => endProcess(child, 0), 10);
return child;
});
- const resultPromise = installLlamaServer();
-
- // Once `brew link` resolves, the binary shows up on PATH.
- setTimeout(() => {
- findSpy.mockReturnValue('/opt/homebrew/bin/llama-server');
- }, 15);
-
- const result = await resultPromise;
+ const result = await installLlamaServer();
expect(result.success).toBe(true);
expect(spawnCalls).toEqual([
{ cmd: 'brew', args: ['install', 'llama.cpp'] },