Add the dictation capture and shortcut state machine - #56
Open
vulcanum-app[bot] wants to merge 4 commits into
Open
Add the dictation capture and shortcut state machine#56vulcanum-app[bot] wants to merge 4 commits into
vulcanum-app[bot] wants to merge 4 commits into
Conversation
Author
There was a problem hiding this comment.
CRITICAL
src-tauri/src/app/commands/recordings.rs:24-29checks and releasesdictation_runtimebefore beginning a meeting, whilesrc-tauri/src/dictation/runtime.rs:247-288separately checks for an active meeting before beginning dictation. Concurrent starts can both pass their checks and capture simultaneously, violating the required mutual exclusion. Make admission and the capture-state reservation atomic under shared ownership.src-tauri/src/app/commands/settings.rs:215-220dispatches every press/release in independentspawn_blockingtasks. A push-to-talk release can run before its preceding press, be ignored as stale, and leave the later press capturing indefinitely. Serialize shortcut events before applying the state machine.
WARNINGS
src-tauri/src/dictation/runtime.rs:462-468drops thearboard::Clipboardimmediately after writing. On supported Linux/X11 without a clipboard manager, the owner must remain alive to serve selection requests, so the reported copied dictation cannot be pasted. Retain clipboard ownership for the active app lifetime.src-tauri/src/app/commands/settings.rs:37re-registers shortcuts while a push-to-talk session can be active. Changing the shortcut unregisters the held key before release; changing the mode makes its release use toggle semantics. Either path leaves the session capturing after release. Reject/defer those changes or stop the active session before re-registration.
SUGGESTIONS
- Add integration-level tests for serialized shortcut delivery, concurrent meeting/dictation admission, and the active push-to-talk settings-update path; current tests exercise only the pure transition helpers.
- Local validation passed:
cargo fmt --all --check,cargo clippy --all-targets --all-features -- -Dwarnings,cargo check, andcargo test(72 passed). GitHub CI’s Linux, macOS, and Windows jobs are successful.
Author
There was a problem hiding this comment.
CRITICAL
src-tauri/src/dictation/runtime.rs:275-280deadlocks every dictation start:handle_shortcutalready holdscapture_admissionwhile callingstart_dictation, which locks the same non-reentrant mutex again. The first shortcut press never opens the microphone and keeps future recording/settings operations blocked. Keep a single admission lock acquisition across action selection and start, or remove the nested lock.src-tauri/src/app/commands/recordings.rs:22-25waits forcapture_admissionbefore checking dictation state. Since the dispatcher retains that lock throughstop_and_transcribeand worker transcription, a meeting-start request during dictation blocks until transcription finishes and then starts instead of returning the required active-dictation error. Use nonblocking admission or release the lock once a state reservation is made.src-tauri/src/app/commands/settings.rs:31-42still permits a shortcut/mode update between a PTT press selectingStartandstart_dictationmarking the runtime capturing. The capture starts under the old mode, while its release is processed under the new mode; changing PTT to toggle ignores that release and leaves capture running. Reserve the pending start before settings can pass its guard.
WARNINGS
src-tauri/src/app/commands/settings.rs:203-204registers the meeting shortcut before the dictation shortcut but never validates they differ. The UI accepts equal values; dictation registration then fails after meeting registration succeeds, leaving dictation unavailable for a persisted configuration. Reject duplicate bindings before persistence/registration.src-tauri/src/dictation/runtime.rs:436-438emitsdictation-state-update, butsrc/components/app-shell/hooks/useAppRuntime.hook.ts:208-238has no listener and the frontend does not call dictation status/cancel commands. Capture, failure, copied text, and cancellation states are therefore not observable or actionable in any frontend window.
SUGGESTIONS
- The previous clipboard-ownership change is resolved: the runtime retains
arboard::Clipboard. The event channel also resolves the prior press/release execution-order race, once the admission-lock deadlock is corrected. - Local checks passed:
pnpm ci-run,pnpm type-check,pnpm lint:rust,pnpm lint:py, andpnpm test:all(48 frontend, 72 Rust, 42 Python tests). - Add coverage for admission contention, queued PTT start plus settings update, duplicate shortcuts, and frontend dictation event/command wiring.
Author
There was a problem hiding this comment.
CRITICAL
src-tauri/src/app/commands/settings.rs:28-48permits saving unrelated settings during an active push-to-talk capture, then callsrefresh_global_hotkey, which unconditionally unregisters/re-registers all shortcuts. If release occurs in that interval, theReleasedevent is lost and dictation remains capturing until cancellation or the duration limit. Do not refresh unchanged shortcut registrations during active capture, or reject all settings saves until the key is released.
WARNINGS
src-tauri/src/app/commands/settings.rs:45-49persists settings beforerefresh_global_hotkeyvalidates the dictation-specific shortcut constraints.Space, for example, passes shared settings validation but failsvalidate_dictation_hotkey; it remains persisted whileunregister_allleaves dictation unavailable. Validate dictation registration constraints before persisting, and preserve/recover the prior registration on failure.src/components/app-shell/hooks/useAppRuntime.hook.ts:225-238startsgetDictationStatus()before registering the state listener. A transition after the read resolves but before listener registration is lost, leaving a newly mounted frontend stale without a capture/cancel control. Register first and fetch status afterwards (or fetch again once registered).
SUGGESTIONS
- Previous critical findings are resolved: no nested dictation admission lock remains, pending starts block shortcut-setting changes, duplicate shortcut bindings are rejected, and dictation status/cancel commands now reach the frontend.
- Local validation passed:
pnpm ci-run,pnpm type-check,pnpm lint:rust,pnpm lint:py, andpnpm test:all(48 frontend, 72 Rust, 42 Python tests). - Add tests for unchanged-shortcut saves during PTT, invalid dictation-only shortcut persistence, and the initial event-subscription/status-fetch race.
Author
There was a problem hiding this comment.
CRITICAL
src-tauri/src/dictation/runtime.rs:432-440sendstranscriptionProfile: "dictation", butworker/app/dtos.py:9,163declares the field asLiteral["conservative_vad"]. Every completed dictation is rejected by worker payload validation before transcription, so no text is copied. Sendconservative_vador add a real dictation profile end to end.src-tauri/src/app/commands/settings.rs:45calls the Wayland-rejectingvalidate_dictation_hotkeyfor every settings update. On Wayland, saving unrelated settings such as microphone or output directory now fails even when the dictation shortcut is unchanged. Validate platform-specific dictation registration only when that binding changes, while continuing to reject new unsupported bindings.
WARNINGS
- None
SUGGESTIONS
- Prior shortcut refresh, validation ordering, and frontend status initialization findings are resolved.
- Local validation passed:
pnpm ci-run,pnpm type-check,pnpm lint:rust,pnpm lint:py, andpnpm test:all(48 frontend, 72 Rust, 42 Python tests). - Add a worker-payload contract test for dictation transcription profiles and a Wayland unchanged-settings regression test.
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.
Summary
Validation
Depends on #55.