Skip to content

fix(recording): report failed audio saves and preserve recovery data - #5

Merged
karan68 merged 1 commit into
devtestfrom
fix/failed-audio-save-reporting
Jul 19, 2026
Merged

fix(recording): report failed audio saves and preserve recovery data#5
karan68 merged 1 commit into
devtestfrom
fix/failed-audio-save-reporting

Conversation

@karan68

@karan68 karan68 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Problem

Failed audio finalization (FFmpeg / checkpoint / disk errors) was swallowed and reported to the user as a successful save, even when audio.mp4 was never produced.

Fix (end to end)

  • Typed failure propagation: stop_recording returns a typed StopRecordingError; the recording-stopped event carries recovery_available / audio_file_available so the UI can react accurately (error vs success).
  • Recovery-safe finalization: checkpoints are preserved until audio + transcripts + metadata all succeed. FFmpeg encode/concat run async, are cancellable (kill_on_drop), and publish audio.mp4 atomically after non-empty verification.
  • No tail-audio loss: the accumulation worker is now an awaited JoinHandle, drained at stop after the pipeline closes the channel (replaces a fixed 200ms sleep).
  • Timeout safety: a timed-out transcription worker is abort()-ed and joined before model unload / finalization, so it cannot race the save.
  • Honest persistence: the frontend saves transcripts even when completion is not observed (transcriptionComplete || hasTranscripts) with a distinct warning toast, and retains a durable IndexedDB audio-repair record linked to the existing SQLite meeting (no duplicate on recovery).
  • Path escaping: FFmpeg concat lines escape single quotes, so meeting names with apostrophes (e.g. Karan's Review) no longer fail finalize/recovery.

Validation

  • Rust: crate compiles (0 errors); saver unit tests 4/4 pass, including new concat_escape_handles_single_quotes and failed_finalization_preserves_checkpoints.
  • Frontend: tsc --noEmit exit 0; editor diagnostics clean.

Notes

  • Manual FFmpeg/disk fault-injection in the running desktop app was not performed and is the recommended follow-up verification.

Failed audio finalization was silently reported as success. Now:

- stop_recording returns a typed StopRecordingError; recording-stopped carries recovery metadata (recovery_available, audio_file_available).

- Checkpoints are preserved until audio + transcripts + metadata all succeed; FFmpeg encode/concat run async, are cancellable, and publish audio.mp4 atomically after non-empty verification.

- Accumulation worker is drained (awaited JoinHandle) at stop instead of a fixed sleep, preventing tail-audio loss.

- Timed-out transcription worker is aborted+joined before model unload/finalization.

- Frontend persists transcripts even when completion is unobserved (transcriptionComplete || hasTranscripts) with an honest warning toast; retains a durable IndexedDB audio-repair record linked to the existing SQLite meeting (no duplicate on recovery).

- FFmpeg concat paths escape single quotes so meeting names with apostrophes no longer fail finalize/recovery.
@karan68
karan68 merged commit 998ee40 into devtest Jul 19, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant