fix(voice): stop mic-test ref stealing, unblock action queue, keep tail audio, and move context/LLM routing behind ports and pure policies

This commit is contained in:
Yun Chan 2026-09-28 02:16:16 +09:00
parent 2cd462333f
commit 2f94d24c99
13 changed files with 1672 additions and 353 deletions

View file

@ -38,6 +38,19 @@ vi.mock('../../../src/main/services/PremiumLLMService', () => ({
getPremiumLLMService: vi.fn(),
}))
// 활성 창 조회는 koffi FFI 리더(ForegroundWindowPort)로 한다 — 자식 프로세스를 띄우지 않는다.
const foregroundReader = vi.hoisted(() => ({
getForegroundWindowInfo: vi.fn(() => ({
hwnd: 1,
title: 'Test window',
processId: 1,
appName: 'TestApp.exe',
appPath: null,
})),
}))
vi.mock('../../../src/main/utils/win32-foreground', () => foregroundReader)
function createProcess(args: unknown[]): EventEmitter & {
stdout: EventEmitter
stderr: EventEmitter
@ -128,8 +141,8 @@ describe('Windows child process visibility', () => {
expectWindowsHideOnAllCalls(childProcess.exec)
})
// 장치 목록·활성 창 조회는 win32 분기에서만 PowerShell 을 부른다.
it.skipIf(process.platform !== 'win32')('hides Windows device discovery and active-window PowerShell calls', async () => {
// 장치 목록 조회는 win32 분기에서만 PowerShell 을 부른다. 활성 창 조회는 FFI 로 하므로 프로세스가 없다.
it.skipIf(process.platform !== 'win32')('hides Windows device discovery and spawns no process for the active window', async () => {
const audioModule = await import('../../../src/main/services/AudioCaptureService')
const audioService = audioModule.getAudioCaptureService() as unknown as {
_getDevicesWindows(): Promise<unknown>
@ -145,10 +158,9 @@ describe('Windows child process visibility', () => {
timeout: 3000,
windowsHide: true,
})
expect(childProcess.execFileAsync.mock.calls[0]?.[2]).toMatchObject({
timeout: 3000,
windowsHide: true,
})
expect(foregroundReader.getForegroundWindowInfo).toHaveBeenCalled()
expect(childProcess.execFileAsync).not.toHaveBeenCalled()
expect(childProcess.execFile).not.toHaveBeenCalled()
})
it('declares hidden ffmpeg processes for conversion, duration, and chunk extraction', () => {