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

test: drop clear-then-type race in retention-window test (#9422)

[._.]/ Adam Eivyd0f97976b73e
diff --git a/client/src/pages/PersistentMindTools.test.jsx b/client/src/pages/PersistentMindTools.test.jsx
index c748915d2f..5427ed7a8c 100644
--- a/client/src/pages/PersistentMindTools.test.jsx
+++ b/client/src/pages/PersistentMindTools.test.jsx
@@ -1,7 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { render, screen, waitFor } from '@testing-library/react';
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { typeSettled } from '../test/settledInput.js';
import { MemoryRouter } from 'react-router';
const api = vi.hoisted(() => ({
@@ -261,12 +260,12 @@ describe('PersistentMindTools', () => {
const retentionInput = await screen.findByLabelText('Retention window (extra turns)');
expect(retentionInput).toHaveValue(3);
- await user.clear(retentionInput);
- // Clearing this controlled number field renders 0. Settle that transition
- // before typing: otherwise user.type can append 5 to the old 3 and the
- // component clamps 35 to 20. The generic empty-field helper expects null.
- await waitFor(() => expect(retentionInput).toHaveValue(0));
- await typeSettled(user, retentionInput, '5');
+ // One change event (3 -> 5) instead of clear-then-type: a clear is its own
+ // controlled-input transition that a late capabilities sync can overwrite
+ // under CI load, leaving the field at 3.
+ fireEvent.change(retentionInput, { target: { value: '5' } });
+ await waitFor(() => expect(retentionInput).toHaveValue(5));
+ await user.click(retentionInput);
await user.tab();
await waitFor(() => expect(api.updateCosConfig).toHaveBeenCalledWith({