Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(desktop): 修正音色加载等待与关闭收尾验证

guyong60f719f5b05c
diff --git a/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts b/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts
index 710424d922..87c91389db 100644
--- a/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts
+++ b/apps/desktop/src/main/__tests__/makerEventHotPathOrdering.test.ts
@@ -877,16 +877,15 @@ describe('maker:event hot path ordering', () => {
expect(wireSessionSource).toContain(
'if (!wasInTurn) advanceSessionTurnBoundaryGeneration(session.id);',
);
- expectOrder(
- closedBlock,
- 'const closedDirectAbortBoundary = getDirectAbortBoundaryForClosingSession(',
- 'cancelDirectAbortReconciliation(session.id);',
- );
- expect(closedBlock).toContain('cancelDirectAbortReconciliation(session.id);');
- expectOrder(
- closedBlock,
- 'cancelDirectAbortReconciliation(session.id);',
- 'pendingFailedTurnAssistantPersistId.delete(session.id);',
+ // Cross-file race wiring guard: the imported close adapter must retain the
+ // real abort/persist stores. Its execution order and captured Goal outcome
+ // are exercised through the lifecycle in sessionBindingLifecycle.test.ts.
+ expect(closedBlock).toMatch(
+ /beforeCloseTeardown:\s*createSessionCloseTeardown<WiredSession>\(\{/,
+ );
+ expect(closedBlock).toMatch(/\bcancelDirectAbortReconciliation\s*,/);
+ expect(closedBlock).toMatch(
+ /clearPendingFailedTurnPersist:\s*sessionId\s*=>\s*\{\s*pendingFailedTurnAssistantPersistId\.delete\(sessionId\);\s*\}/,
);
expect(closedBlock).toContain('sessionTurnBoundaryGenerationById.delete(session.id);');
expectOrder(
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/sessionBindingLifecycle.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/sessionBindingLifecycle.test.ts
index 0850ea62d3..883dc29b19 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/sessionBindingLifecycle.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/sessionBindingLifecycle.test.ts
@@ -8,6 +8,7 @@ import { describe, expect, it, vi } from 'vitest';
import {
createSessionBindingLifecycle,
+ createSessionCloseTeardown,
finalizeSessionClose,
runSessionCloseCleanup,
type SessionBindingLifecycleDeps,
@@ -115,10 +116,18 @@ function harness<S extends Pick<Session, 'id' | 'onStatusChange' | 'setInteracti
cleanupClosedSession: vi.fn((_session: S, captured: typeof context) => {
runSessionCloseCleanup(captured.preserveAutoResumeIntent, actions);
}),
- beforeCloseTeardown: vi.fn<(session: S) => void>(() => {
- order.push('unregister');
- context.settlesDirectAbort = false;
- }),
+ beforeCloseTeardown: vi.fn(createSessionCloseTeardown<S>({
+ clearCompactRuntimeRefresh: vi.fn(),
+ cancelDirectAbortReconciliation: () => {
+ order.push('cancel-abort');
+ context.settlesDirectAbort = false;
+ },
+ clearPendingFailedTurnPersist: () => { order.push('clear-failed-persist'); },
+ isRehydrateCloseSuppressed: () => false,
+ getProviderGroupSwitchHoldId: () => null,
+ hasPendingProviderGroupContinuation: () => false,
+ clearDeferredProductTurnFailure: () => { order.push('unregister'); },
+ })),
finalizeClosedSession: vi.fn((_session: S, captured: typeof context) => {
finalizeSessionClose(captured.settlesDirectAbort, finalActions);
}),
@@ -213,6 +222,8 @@ describe('Desktop Session binding lifecycle', () => {
'reset-retry',
'coordinator',
'runtime',
+ 'cancel-abort',
+ 'clear-failed-persist',
'unregister',
'dispose',
'idle',
diff --git a/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsx b/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsx
index 9356456079..a5093c0c49 100644
--- a/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsx
+++ b/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsx
@@ -1174,9 +1174,9 @@ it('allows model configuration but disables preview before a canonical conversat
),
);
expect(screen.getByText('bots.voiceMode.previewNeedsChat')).toBeTruthy();
- expect(
- screen.getByRole('button', { name: 'bots.voiceMode.preview' }).hasAttribute('disabled'),
- ).toBe(true);
+ // Linux CI can enable model configuration before the voice catalog resolves.
+ const preview = await screen.findByRole('button', { name: 'bots.voiceMode.preview' });
+ expect(preview.hasAttribute('disabled')).toBe(true);
expect(start).not.toHaveBeenCalled();
});