Repository navigation
journal log: preflight the transcriber toolchain at record-start, not after recording - #88
Merged
Merged
Conversation
journal log's mic-toggle flow already preflights ffmpeg before recording, but a missing whisper.cpp binary or model file was only discovered inside Transcribe(), after the recording had already finished — spending a recording just to lose it to a toolchain error. Add internal/log.CheckAvailable (binary + model file, no transcription) and wire an injectable checkTranscriberAvailable check into runLogStartRecording alongside checkFfmpegAvailable. On failure, the recorder is never spawned, no lockfile is written, and the same actionable error (`journal models pull` / whisper.cpp install hint) is surfaced via terminal output and a desktop notification. Closes #82
Contributor
Author
|
Retro: no durable lesson (merged clean / one-off). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Agent-Generated PR
Closes #82
Agent Used: Claude Code
Complexity: medium
Summary
journal log's mic-toggle/hotkey flow preflighted ffmpeg before recording but only discovered a missing whisper.cpp binary or model file after the recording finished (insideTranscribe()), wasting the recording. This adds a transcriber preflight to the record-start path, mirroring the existing ffmpeg preflight.Implementation Notes
internal/log.CheckAvailable(modelDir, model string) error, which performs the same two checksWhisperCPP.Transcribedoes (model fileos.Stat, binaryfindWhisperBinlookup) but without running transcription.Transcribeitself is untouched to avoid any risk to the existing transcription path.checkTranscriberAvailablevar incmd/log.go, mirroring the existingcheckFfmpegAvailablepattern, so tests never depend on a real whisper.cpp install/model.runLogStartRecordingright after the ffmpeg check and before the recorder is spawned / lockfile is written.run \journal models pull`/ whisper.cpp install hint) and additionally sends a desktop notification (✕ journal log failed`) — the ffmpeg preflight's existing behavior (terminal-only, no notification) is left unchanged, per the issue's acceptance criteria.journal log <audio.wav>path is untouched — it already surfaces transcription errors inline.Changes
internal/log/transcribe.go: addCheckAvailable.cmd/log.go: addcheckTranscriberAvailablevar, call it inrunLogStartRecording.internal/log/transcribe_test.go: table test forCheckAvailablecovering present / missing-binary / missing-model.cmd/log_test.go: addstubTranscriberAvailablehelper, wire it into existing start/toggle tests, and add new tests covering the fail-fast behavior (no spawn, no lockfile, notification sent) and the pass-through (available) case.Testing
Automated:
Manual testing performed:
make fmt vet,go build ./..., andgo test -p 1 ./...locally — all green.golangci-lintisn't available in this environment; CI will run it on the PR.Review Checklist
Correctness
Code Quality
Security
Performance
Tests
Reviewer Notes
Out of scope per the issue: bundling whisper.cpp or auto-pulling models — not touched.