fix(meeting): save the recording when the app quits while a stop is still flushing

Quitting during the few seconds a stop waits for the last caption skipped
the shutdown save, so the in-memory audio and every sentence since the last
checkpoint were lost. Shutdown now saves unless post-processing already
wrote the final result.
This commit is contained in:
Yun Chan 2026-10-20 16:29:29 +09:00
parent 32cf826290
commit cf37fd5281
2 changed files with 24 additions and 1 deletions

View file

@ -162,6 +162,24 @@ describe('앱 종료·중단 복구', () => {
expect(meeting.getState()).toBe('idle')
})
it('정지 처리(마지막 문장 대기) 중에 종료돼도 지금까지의 전사를 저장한다', async () => {
const meeting = getMeetingModeService()
const { sessionId } = await meeting.startRecording()
caption.bus?.emit('segment', { id: 'seg-b', text: '정지 직전 문장', timestamp: Date.now(), isFinal: true } satisfies CaptionSegment)
let release = (): void => undefined
caption.gate = new Promise<void>((resolve) => { release = resolve })
const stopping = meeting.stopRecording()
await meeting.shutdown()
const saved = row(sessionId)
expect(saved?.status).toBe('completed')
expect(saved?.rawTranscript).toContain('정지 직전 문장')
release()
caption.gate = null
await stopping.catch(() => undefined)
})
it('남은 recording/processing 행을 닫는다 — 전사가 있으면 completed, 없으면 error', () => {
insertSession('stuck-with-text', { status: 'recording', rawTranscript: '[00:01] 저장된 부분' })
// 전사가 없는 행은 이 기기에서 시작한 녹음(원장 표식)일 때만 닫는다 — redteam r3: 폰의 진행 중 회의 보호