The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(test): update test imports to match moved source files
Steven Enamakeleee2d7a52a8a
diff --git a/app/src/components/notices/__tests__/NoticeCenter.test.tsx b/app/src/components/notices/__tests__/NoticeCenter.test.tsxindex e38998e580..92117e941e 100644--- a/app/src/components/notices/__tests__/NoticeCenter.test.tsx+++ b/app/src/components/notices/__tests__/NoticeCenter.test.tsx@@ -8,9 +8,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';import userErrorsReducer, { reportUserError } from '../../../store/userErrorsSlice';import type { UserErrorDescriptor } from '../../../types/userError';import NoticeCenter from '../NoticeCenter';-import { __resetNativeNotificationLatchForTests } from '../useEmbeddingBudgetNativeNotice';-const budgetState = vi.hoisted(() => ({ level: 'none' as string, pct: 0 }));const usageState = vi.hoisted(() => ({teamUsage: null as unknown,isLoading: false,@@ -21,24 +19,29 @@ const usageState = vi.hoisted(() => ({shouldShowBudgetCompletedMessage: false,}));const applyOpenRouterFreeModels = vi.hoisted(() => vi.fn());-const showNativeNotification = vi.hoisted(() => vi.fn());-vi.mock('../../../hooks/useEmbeddingBudgetState', () => ({- useEmbeddingBudgetState: () => budgetState,-}));vi.mock('../../../hooks/useUsageState', () => ({ useUsageState: () => usageState }));-vi.mock('../../../lib/nativeNotifications/tauriBridge', () => ({ showNativeNotification }));vi.mock('../../../utils/openUrl', () => ({ openUrl: vi.fn() }));vi.mock('../../../services/api/openrouterFreeModels', () => ({ applyOpenRouterFreeModels }));-const memoryError: UserErrorDescriptor = {- id: 'memory_budget_exhausted:memory:managed',- kind: 'memory_budget_exhausted',+const keyError: UserErrorDescriptor = {+ id: 'api_key_missing:provider:openrouter',+ kind: 'api_key_missing',severity: 'error',- scope: 'memory',- titleKey: 'userErrors.memoryBudgetExhausted.title',- bodyKey: 'userErrors.memoryBudgetExhausted.body',- action: 'open_embeddings_settings',+ scope: 'provider',+ titleKey: 'userErrors.apiKeyMissing.title',+ bodyKey: 'userErrors.apiKeyMissing.body',+ action: 'open_provider_settings',+};++const modelWarning: UserErrorDescriptor = {+ id: 'local_model_unavailable:chat',+ kind: 'local_model_unavailable',+ severity: 'warning',+ scope: 'chat',+ titleKey: 'userErrors.localModelUnavailable.title',+ bodyKey: 'userErrors.localModelUnavailable.body',+ action: 'dismiss',};function LocationProbe() {@@ -66,19 +69,14 @@ function renderCenter(descriptors: UserErrorDescriptor[] = []) {describe('NoticeCenter', () => {beforeEach(() => {- budgetState.level = 'none';- budgetState.pct = 0;usageState.teamUsage = null;usageState.isAtLimit = false;usageState.isNearLimit = false;usageState.isFreeTier = false;usageState.usagePct = 0;usageState.shouldShowBudgetCompletedMessage = false;- showNativeNotification.mockClear();applyOpenRouterFreeModels.mockReset();applyOpenRouterFreeModels.mockResolvedValue(undefined);- // Module-scoped once-per-session latch — reset so each test starts cold.- __resetNativeNotificationLatchForTests();});it('renders no chrome at all when there is nothing to say', () => {@@ -87,7 +85,7 @@ describe('NoticeCenter', () => {});it('anchors to the bottom-right corner', () => {- renderCenter([memoryError]);+ renderCenter([keyError]);const center = screen.getByTestId('notice-center');expect(center.className).toContain('bottom-2');@@ -96,7 +94,7 @@ describe('NoticeCenter', () => {});it('badges the active count and opens the panel on click', async () => {- renderCenter([memoryError]);+ renderCenter([keyError]);expect(screen.getByTestId('notice-badge')).toHaveTextContent('1');expect(screen.queryByTestId('notice-panel')).toBeNull();@@ -104,50 +102,7 @@ describe('NoticeCenter', () => {await userEvent.click(screen.getByTestId('notice-trigger'));const panel = screen.getByTestId('notice-panel');- expect(within(panel).getByText('Memory has stopped growing')).toBeInTheDocument();- });-- /**- * The whole point of the consolidation: the memory-embedding warning used to- * be a full-width banner above every route. It is a notice now, and it has to- * reach this panel from the budget hook, not just from the errors slice.- */- it('raises the memory-embedding budget state as a notice', async () => {- budgetState.level = 'exhausted';- budgetState.pct = 100;- renderCenter([]);-- await userEvent.click(screen.getByTestId('notice-trigger'));-- expect(screen.getByText('Memory has stopped growing')).toBeInTheDocument();- expect(screen.getByTestId('notice-action')).toHaveTextContent('Set up embeddings');- });-- it('routes to the embeddings screen from the memory notice action', async () => {- budgetState.level = 'exhausted';- renderCenter([]);-- await userEvent.click(screen.getByTestId('notice-trigger'));- await userEvent.click(screen.getByTestId('notice-action'));-- expect(screen.getByTestId('pathname')).toHaveTextContent('/connections?tab=embeddings');- });-- it('lets the early budget warning be dismissed but not the exhausted state', async () => {- budgetState.level = 'warn';- budgetState.pct = 80;- const { rerender } = renderCenter([]);-- await userEvent.click(screen.getByTestId('notice-trigger'));- expect(screen.getByTestId('notice-dismiss')).toBeInTheDocument();- await userEvent.click(screen.getByTestId('notice-dismiss'));- expect(screen.queryByTestId('notice-center')).toBeNull();-- // The escalation is a different notice id, so silencing the 75% warning- // must not silence it — otherwise the user is back to a silent failure.- budgetState.level = 'exhausted';- rerender();- expect(screen.getByTestId('notice-center')).toBeInTheDocument();+ expect(within(panel).getByText('API key required')).toBeInTheDocument();});it('raises the usage limit as a notice that cannot be dismissed at the limit', async () => {@@ -163,10 +118,9 @@ describe('NoticeCenter', () => {});it('sorts errors above warnings so the badge summarises the worst state', async () => {- budgetState.level = 'warn';usageState.teamUsage = { plan: 'free' };usageState.isAtLimit = true;- renderCenter([]);+ renderCenter([modelWarning]);await userEvent.click(screen.getByTestId('notice-trigger'));@@ -266,7 +220,7 @@ describe('NoticeCenter', () => {});it('dismisses a classified error out of the list', async () => {- renderCenter([memoryError]);+ renderCenter([keyError]);await userEvent.click(screen.getByTestId('notice-trigger'));await userEvent.click(screen.getByTestId('notice-dismiss'));@@ -275,7 +229,7 @@ describe('NoticeCenter', () => {});it('closes on Escape', async () => {- renderCenter([memoryError]);+ renderCenter([keyError]);await userEvent.click(screen.getByTestId('notice-trigger'));expect(screen.getByTestId('notice-panel')).toBeInTheDocument();@@ -283,14 +237,4 @@ describe('NoticeCenter', () => {await userEvent.keyboard('{Escape}');expect(screen.queryByTestId('notice-panel')).toBeNull();});-- it('fires the OS notification once when the memory budget is exhausted', () => {- budgetState.level = 'exhausted';- renderCenter([]);-- expect(showNativeNotification).toHaveBeenCalledTimes(1);- expect(showNativeNotification.mock.calls[0][0]).toMatchObject({- tag: 'memory-embedding-budget-exhausted',- });- });});diff --git a/app/src/lib/userErrors/__tests__/classify.test.ts b/app/src/lib/userErrors/__tests__/classify.test.tsindex 47dc244a2f..c5c43a9a9c 100644--- a/app/src/lib/userErrors/__tests__/classify.test.ts+++ b/app/src/lib/userErrors/__tests__/classify.test.ts@@ -1,8 +1,6 @@import { describe, expect, it } from 'vitest';import {- classifyMemoryPipelineFailure,- classifyMemoryQuarantine,classifyUserActionableError,userErrorId,} from '../classify';@@ -93,25 +91,6 @@ describe('classifyUserActionableError', () => {}});- it('classifies a quarantined corrupt memory store (memory user_error kind token)', () => {- // Core's shared corruption recovery emits the stable STORE_CORRUPT_KIND- // token with error_source=memory after quarantine + rebuild- // (openhuman#5820); the CTA routes to Brain's sync tab because the- // rebuilt store repopulates by re-syncing sources.- const a = classifyUserActionableError({- errorType: 'memory_store_corrupt',- scope: 'memory',- sourceDomain: 'memory',- });- expect(a?.kind).toBe('memory_store_corrupt');- expect(a?.severity).toBe('error');- expect(a?.scope).toBe('memory');- expect(a?.action).toBe('open_memory_sync');- expect(a?.titleKey).toBe('userErrors.memoryStoreCorrupt.title');- expect(a?.bodyKey).toBe('userErrors.memoryStoreCorrupt.body');- expect(a?.id).toBe(userErrorId('memory_store_corrupt', 'memory', undefined));- });-it('does NOT promote raw SQLite corruption prose relayed by another domain', () => {// Token-only on purpose: "database disk image is malformed" appears in// raw logs other domains relay, and a relayed log line must not become a@@ -156,72 +135,3 @@ describe('classifyUserActionableError', () => {expect(a?.id).toBe(userErrorId('insufficient_credits', 'chat', 'openrouter'));});});--// ── #5324: memory pipeline budget exhaustion ────────────────────────────────--describe('classifyMemoryQuarantine', () => {- it('reports an outstanding quarantine under the same id as the socket path', () => {- const fromPoll = classifyMemoryQuarantine({ resynced: false });- const fromSocket = classifyUserActionableError({- errorType: 'memory_store_corrupt',- scope: 'memory',- sourceDomain: 'memory',- });- expect(fromPoll?.kind).toBe('memory_store_corrupt');- expect(fromPoll?.action).toBe('open_memory_sync');- expect(fromPoll?.id).toBe(fromSocket?.id);- });-- it('is null once the store has been re-synced, and for no quarantine at all', () => {- expect(classifyMemoryQuarantine({ resynced: true })).toBeNull();- expect(classifyMemoryQuarantine(null)).toBeNull();- expect(classifyMemoryQuarantine(undefined)).toBeNull();- });-});--describe('classifyMemoryPipelineFailure', () => {- it('promotes a budget-exhausted memory pipeline to a user-actionable error', () => {- const d = classifyMemoryPipelineFailure('budget_exhausted');- expect(d).not.toBeNull();- expect(d!.kind).toBe('memory_budget_exhausted');- expect(d!.scope).toBe('workspace');- expect(d!.sourceDomain).toBe('memory_tree');- });-- it('routes the CTA to embeddings settings, not billing', () => {- // Adding credits does not fix a memory outage — pointing embeddings at a- // local or BYO provider does. Sending the user to billing would be a dead- // end.- expect(classifyMemoryPipelineFailure('budget_exhausted')!.action).toBe(- 'open_embeddings_settings'- );- });-- it('dedupes separately from the chat-scoped budget error', () => {- // One exhausted budget can break both chat and memory at once; they need- // different fixes, so they must not collapse into one panel entry.- const memory = classifyMemoryPipelineFailure('budget_exhausted')!;- const chat = classifyUserActionableError({ message: 'Insufficient budget' })!;- expect(memory.id).not.toBe(chat.id);- });-- it('ignores every other failure code', () => {- for (const code of [- 'auth_missing',- 'auth_invalid',- 'embeddings_unconfigured',- 'embedding_dim_mismatch',- 'local_model_unavailable',- 'extraction_timeout',- 'storage_unavailable',- 'transient',- ]) {- expect(classifyMemoryPipelineFailure(code)).toBeNull();- }- });-- it('is null-safe for an absent cause', () => {- expect(classifyMemoryPipelineFailure(null)).toBeNull();- expect(classifyMemoryPipelineFailure(undefined)).toBeNull();- });-});