Skip to content

Keep failed recordings in Library for retry, not deletion - #363

Merged
alexkroman merged 11 commits into
mainfrom
claude/dazzling-mccarthy-igixzs
Nov 25, 2026
Merged

alexkroman merged 11 commits into
mainfrom
claude/dazzling-mccarthy-igixzs

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

What & why

When a recording's live transcript is empty or its async transcription fails, the app now saves it to the Library with no transcript yet (needsTranscription), rather than deleting the file. This preserves the audio so users can:

  • Retry transcription later via "Try Again" on the failure page
  • Find the file in Finder to inspect or move it
  • Have the recording transcribed when opened from the Library

The change adds a retry field to the .failed state to pass the SavedTranscript entry to the UI, enabling the retry flow. New methods keepUntranscribed(), retranscribe(), and fillIn() manage the lifecycle: save with empty text → transcribe → fill in the result or delete if no speech found.

How it was tested

  • Added unit test needsTranscriptionRule() covering the new needsTranscription property

  • Existing tests pass; no test changes needed for the state machine logic (covered by integration)

  • scripts/check.sh passes

  • scripts/check.sh passes (or CI will, if I'm not on a Mac)

  • I read AGENTS.md and this doesn't reintroduce anything deliberately removed

  • Docs updated if behavior changed (comments updated to reflect new save-then-retry flow)

…gain

When a Record session heard nothing live and the async pass then failed
(offline, a 5xx, a timeout), the audio was left on disk with no entry
pointing at it: dismiss the error and the recording was unreachable.

Now the failure saves the recording as an entry with no text yet
(SavedTranscript.needsTranscription), shown in the Library as
"Recording · Not transcribed". The failure page offers Try Again and
Show in Finder, and opening the entry from the Library transcribes it
again, filling the same entry in rather than adding another. Untitled
entries without text are skipped by the title pass.

Fixes #331

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7Z9V8SZ8X1CBBS7q
…le is gone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7Z9V8SZ8X1CBBS7q
…orphan it

Abandoning the async pass (Back on Transcribing…, or a file dropped over
it) cancelled it before the failure branch could save anything. The entry
now exists first and the pass fills it in, deletes it on no speech, or
keeps it on failure. A success for an entry deleted meanwhile no longer
re-adds it, and Try Again on a deleted entry does nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7Z9V8SZ8X1CBBS7q
Quitting (⌘Q, logout, a Sparkle relaunch) runs no deinit and resumes no
task, so an active Record session left an unfinalized, unplayable .m4a,
its live transcript was never saved, and any change in the 300 ms save
debounce was lost.

- AppDelegate.applicationWillTerminate calls TranscriptsModel.prepareForExit,
  which stops the recorder (closing the file), saves the live transcript as
  a recording entry, and writes the history synchronously, merging the
  saved file first if it hasn't been loaded yet.
- History writes go through one serial queue, so an earlier detached write
  can no longer finish its rename after a later one and resurrect deleted
  entries or drop new ones. The exit flush queues behind any write in
  flight, so it lands last.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1RyMwLTuh8iqUWfZ7i
With no output device the drain waits out its whole deadline (0.05 s of
audio plus drainSlack, 2 s), so a flat 3 s bound left under a second of
scheduler room and a loaded runner overshot it (3.39 s on PR #357's check
job). Bound it as the sibling test does: deadline plus slack plus 2 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1RyMwLTuh8iqUWfZ7i
waitUntil (engine) and until (iPhone) polled against 5 s and 3 s wall-clock
budgets. On a loaded runner the whole parallel run can stall for seconds —
every engine test in one run took ~6 s — and two SelectionSpeechRouter tests
lost their budget to the stall; under the address sanitizer the iPhone's
watchdog-release test ran out before its .noTarget landed. Every caller
expects its condition to hold, so a passing test never waits out the
timeout: it only bounds a hang, and 30 s does that without the flake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7Z9V8SZ8X1CBBS7q
tapMic() lifted with micUp(), which times the finger from the wall clock.
Finger down writes the press, and under the address sanitizer on a busy
runner that alone outlasted the 350 ms hold threshold: the tap became a
hold, its lift queued the stop, and the answer sent it, so the dictation
went straight to stopping. That failed "a settled phase settles the gate
only when it answers the press" on PR #357's ios-sanitizers (address)
job, and a hands-free press or a status-line tap could do the same on a
slow device. tapMic() now lifts at the touch's own stamp.

Adds a test that jumps the model's clock past the hold threshold while
the press is written: before the fix the tap sent a release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1RyMwLTuh8iqUWfZ7i
…ffer no Copy

Carried over from #360. An untranscribed recording opens by transcribing,
so its action reads Transcribe and its VoiceOver hint says so; it has no
text, so Copy is left out of its menus and Edit › Copy dims (a nil
onCopyCommand) — as it now also does with nothing selected, where it used
to stay enabled and copy nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alexkroman
alexkroman added this pull request to the merge queue Nov 24, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to invalid changes in the merge commit Nov 25, 2026
@alexkroman
alexkroman enabled auto-merge November 25, 2026 00:06
…transcribed

prepareForExit (#357) left a recording with no live transcript as a file
with no Library entry; with #363 every recording keeps an entry, so this
one is saved untranscribed (needsTranscription) for the Library to offer
again, as a failed pass's is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude and others added 2 commits November 25, 2026 00:45
…ging #357

Merging #357 brought the file to 401 lines and swiftlint's file_length
failed check. Tightens transcribe's doc comment rather than the merged code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1V7Z9V8SZ8X1CBBS7q
# Conflicts:
#	App/Blurt/Blurt/Wizard/TranscriptsModel+Recording.swift
@alexkroman
alexkroman added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit cd53505 Nov 25, 2026
13 checks passed
@alexkroman
alexkroman deleted the claude/dazzling-mccarthy-igixzs branch November 25, 2026 02:28
alexkroman pushed a commit that referenced this pull request Nov 25, 2026
… CI run

Recent multi-commit PRs (#410, #413, #414, #416, #420, #422, #423, #425, #426)
mostly spent their extra ~37-minute runs on things nothing caught before CI:

- scripts/check-swift-lint-lite.sh: a toolchain-free text match for the opt-in
  SwiftLint/swift-format rules it can see (modifier_order, no_empty_block,
  NoBlockComments, swift-format's `catch  where`). Run by check.sh (so
  --portable and --lint-only) and the swift-budgets edit hook; would have
  flagged the pre-fix files of #414, #422 and #425.
- .claude/hooks/push-gate.sh: a PreToolUse hook that runs
  `check.sh --portable` (~20 s) before any `git push` and blocks a red one —
  jscpd clones (#420, #422) and post-merge size overruns (#363, #378) were
  pushes that skipped the documented portable run.
- AGENTS.md / CLAUDE.md: a "Rules only CI catches" list for the rest
  (variable_shadowing, one_declaration_per_file, type_contents_order,
  multiline_function_chains, MemberImportVisibility, one argument per line),
  and the new hook and script in the hooks table and permissions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DS5B1UDUZXyuF6g7GUmmNu
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.

3 participants