fix(sync): don't let a pull wipe the checkpointed transcript of a meeting this device is recording

Checkpoints stay local until stop, so a pull during recording replaced the
saved transcript with the server's empty one; a crash then recovered the
meeting as an error with nothing in it. Status, transcript, end time and
duration of a locally recording meeting are now kept on pull.
This commit is contained in:
Yun Chan 2026-10-20 16:31:08 +09:00
parent cf37fd5281
commit 69c4307eee
2 changed files with 82 additions and 1 deletions

View file

@ -19,6 +19,7 @@ import { getRAGService } from '../RAGService'
import { deleteHistoryLocally } from '../history-deletion'
import { purgeRemoteAudio } from './audio-sync'
import { pushMeetingSegments } from './transcript-sync'
import { syncStateRecordingLedger } from '../meeting/local-recording-ledger'
import { dropEntry } from './sync-outbox'
import {
SyncRemoteError,
@ -502,16 +503,29 @@ const meetingsAdapter: SyncAdapter = {
errorMessage: str(row.error_message),
updatedAt,
}
// 이 기기에서 녹음 중인 회의: 주기 저장한 전사는 정지 때에야 올라간다. 그 전에 pull 이 서버의
// 빈 전사·'recording' 행으로 덮으면, 그사이 앱이 죽었을 때 복구할 전사가 사라졌다.
const set = syncStateRecordingLedger.isLocal(id) ? omitRecordingProgress(values) : values
getDatabase()
.insert(meetingSessions)
.values({ id, ...values, createdAt: ms(row.created_at, updatedAt) })
.onConflictDoUpdate({ target: meetingSessions.id, set: values })
.onConflictDoUpdate({ target: meetingSessions.id, set })
.run()
return true
},
deleteLocal: deleteMeetingLocally,
}
const RECORDING_PROGRESS_FIELDS = ['status', 'rawTranscript', 'endedAt', 'durationMs'] as const
function omitRecordingProgress<T extends Record<(typeof RECORDING_PROGRESS_FIELDS)[number], unknown>>(
values: T
): Partial<T> {
const rest: Partial<T> = { ...values }
for (const field of RECORDING_PROGRESS_FIELDS) delete rest[field]
return rest
}
// ── meeting_memos ───────────────────────────────────────
function hasLocalMeeting(id: string): boolean {