From 644c4b02db84a70232d774f17ee5ca7a91c32d80 Mon Sep 17 00:00:00 2001 From: Nathan Watkins <8055935+n8watkins@users.noreply.github.com> Date: Sun, 29 Nov 2026 11:47:54 -0800 Subject: [PATCH 01/10] refactor(core): drop the _with suffix from the autostart functions Release-note: skip --- app/src-tauri/src/lib.rs | 4 ++-- crates/scribe-core/src/autostart.rs | 22 +++++++++++----------- crates/scribe-core/src/settings_store.rs | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rs index b2e0fa9..94e0c36 100644 --- a/app/src-tauri/src/lib.rs +++ b/app/src-tauri/src/lib.rs @@ -420,7 +420,7 @@ pub fn run() { // write a missing one, and follow the switch in Windows' Startup // apps list when the user changed it there (see autostart.rs). if let Some(value) = - autostart::reconcile_at_launch_with(host.as_ref(), settings.launch_at_startup) + autostart::reconcile_at_launch(host.as_ref(), settings.launch_at_startup) { settings.launch_at_startup = value; db.save_settings(&settings)?; @@ -1042,7 +1042,7 @@ mod startup_order_tests { let setup = &source[start..end]; let steps = [ "Database::open(", - "autostart::reconcile_at_launch_with(", + "autostart::reconcile_at_launch(", "BackendState::new(", "data_hygiene::run_startup_maintenance_with(", "child_guard::init(", diff --git a/crates/scribe-core/src/autostart.rs b/crates/scribe-core/src/autostart.rs index 0750001..beb52ec 100644 --- a/crates/scribe-core/src/autostart.rs +++ b/crates/scribe-core/src/autostart.rs @@ -9,8 +9,8 @@ //! removing it (the `StartupApproved\Run` value). Scribe follows that switch: //! //! - Scribe writes or switches on the entry only at launch -//! ([`reconcile_at_launch_with`], and only from the installed copy) and when -//! the user flips "Launch at startup" in Scribe ([`apply_with`]). +//! ([`reconcile_at_launch`], and only from the installed copy) and when +//! the user flips "Launch at startup" in Scribe ([`apply`]). //! - It never switches on an entry that Windows has off, with one exception: //! an entry that points at a program that no longer exists (left by a //! release before v0.8.0 renamed `app.exe` to `Scribe.exe`) is rewritten @@ -19,7 +19,7 @@ //! the owner's PC two such entries were switched off by a program 5 ms apart. //! - Otherwise "Launch at startup" mirrors Windows' switch: at launch, when the //! window is focused and when the tray menu is about to open -//! ([`follow_windows_switch_with`], which never writes the entry). +//! ([`follow_windows_switch`], which never writes the entry). //! //! macOS and Linux keep the behaviour they had before: no start flag, and the //! stored setting is applied at launch. @@ -37,7 +37,7 @@ pub const SIGN_IN_FLAG: &str = "--minimized"; /// The publishers whose `Software\\` key may record the /// install folder: the one releases before the publisher change used (the /// installer hooks read it as a fallback, then remove it) and the current one -/// (see [`reconcile_at_launch_with`]). +/// (see [`reconcile_at_launch`]). pub const PREVIOUS_PUBLISHER: &str = "natkins"; pub const PUBLISHER: &str = "n8builds.dev"; @@ -159,7 +159,7 @@ fn dev_build_error() -> CommandError { /// Writes or removes the entry for the setting the user just chose in Scribe /// (the settings switch or the tray menu). Development builds refuse, so they /// never point the entry at a build folder. -pub fn apply_with(host: &dyn Host, enabled: bool) -> Result<(), CommandError> { +pub fn apply(host: &dyn Host, enabled: bool) -> Result<(), CommandError> { if cfg!(debug_assertions) { return Err(dev_build_error()); } @@ -187,7 +187,7 @@ fn write_entry(host: &dyn Host, enabled: bool) -> Result<(), CommandError> { /// and returns the value "Launch at startup" should take when Windows' /// switch differs from `wanted`. Development builds do nothing. #[cfg(windows)] -pub fn reconcile_at_launch_with(host: &dyn Host, wanted: bool) -> Option { +pub fn reconcile_at_launch(host: &dyn Host, wanted: bool) -> Option { if cfg!(debug_assertions) { return None; } @@ -224,7 +224,7 @@ pub fn reconcile_at_launch_with(host: &dyn Host, wanted: bool) -> Option { /// At launch on macOS and Linux, as before this change: the stored setting is /// applied to the login entry. #[cfg(not(windows))] -pub fn reconcile_at_launch_with(host: &dyn Host, wanted: bool) -> Option { +pub fn reconcile_at_launch(host: &dyn Host, wanted: bool) -> Option { if cfg!(debug_assertions) { return None; } @@ -244,7 +244,7 @@ pub fn reconcile_at_launch_with(host: &dyn Host, wanted: bool) -> Option { /// The value "Launch at startup" should take to follow Windows' switch, when /// it differs from `wanted`. Never writes the entry. Always `None` on macOS /// and Linux and in development builds. -pub fn follow_windows_switch_with(host: &dyn Host, wanted: bool) -> Option { +pub fn follow_windows_switch(host: &dyn Host, wanted: bool) -> Option { if cfg!(debug_assertions) || !cfg!(windows) { return None; } @@ -711,10 +711,10 @@ mod tests { #[test] fn a_development_build_leaves_the_entry_alone() { let host = recording_host(); - let error = apply_with(&host, true).unwrap_err(); + let error = apply(&host, true).unwrap_err(); assert_eq!(error.code, "autostart_dev_build"); - assert_eq!(reconcile_at_launch_with(&host, true), None); - assert_eq!(follow_windows_switch_with(&host, false), None); + assert_eq!(reconcile_at_launch(&host, true), None); + assert_eq!(follow_windows_switch(&host, false), None); assert!(host.calls().is_empty()); } diff --git a/crates/scribe-core/src/settings_store.rs b/crates/scribe-core/src/settings_store.rs index a9b2dc4..28a7c6c 100644 --- a/crates/scribe-core/src/settings_store.rs +++ b/crates/scribe-core/src/settings_store.rs @@ -142,7 +142,7 @@ fn sync_launch_at_startup_in( host: &dyn Host, ) -> Result { follow_launch_switch(state, host, |stored| { - crate::autostart::follow_windows_switch_with(host, stored) + crate::autostart::follow_windows_switch(host, stored) }) } @@ -212,7 +212,7 @@ struct AppEffects<'a> { impl SettingsEffects for AppEffects<'_> { fn apply_autostart(&self, enabled: bool) -> Result<(), CommandError> { - crate::autostart::apply_with(self.core.host().as_ref(), enabled) + crate::autostart::apply(self.core.host().as_ref(), enabled) } fn set_transform_enabled(&self, enabled: bool) { @@ -499,7 +499,7 @@ mod tests { } /// Outside a Windows release build there is no Windows switch to follow - /// (`follow_windows_switch_with` answers `None` before it reads the + /// (`follow_windows_switch` answers `None` before it reads the /// host), so syncing keeps the stored settings, announces nothing and /// makes no host call, even when the startup entry differs from them. #[cfg(any(debug_assertions, not(windows)))] @@ -519,7 +519,7 @@ mod tests { assert!(host.calls().is_empty()); } - /// `AppEffects::apply_autostart` reaches `autostart::apply_with`, which in + /// `AppEffects::apply_autostart` reaches `autostart::apply`, which in /// a debug build (every test build) refuses with `autostart_dev_build` /// before it calls the host. The change stops there, before the save: the /// stored setting is unchanged, no `scribe:settings-changed` goes out, the From 0fa43a5d235ab30c71705fc7c7a1fc9ad03d54f8 Mon Sep 17 00:00:00 2001 From: Nathan Watkins <8055935+n8watkins@users.noreply.github.com> Date: Sun, 29 Nov 2026 11:48:20 -0800 Subject: [PATCH 02/10] refactor(core): drop the _with suffix from the audio functions The private body of cancel_recording, which took the same name, is now cancel_recording_on. Release-note: skip --- app/src-tauri/src/commands/audio.rs | 6 ++-- crates/scribe-core/src/audio.rs | 32 +++++++++++----------- crates/scribe-core/src/dictation_worker.rs | 16 +++++------ crates/scribe-core/src/hotkeys.rs | 4 +-- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/app/src-tauri/src/commands/audio.rs b/app/src-tauri/src/commands/audio.rs index 88f9d4b..c5f5e61 100644 --- a/app/src-tauri/src/commands/audio.rs +++ b/app/src-tauri/src/commands/audio.rs @@ -16,7 +16,7 @@ use crate::{ pub async fn list_microphones( core: tauri::State<'_, Core>, ) -> Result, CommandError> { - off_main_core(core.inner().clone(), audio::list_microphones_with).await + off_main_core(core.inner().clone(), audio::list_microphones).await } /// Starts a dictation from the dashboard. Runs on the dictation worker, so it @@ -63,14 +63,14 @@ pub async fn record_test_clip( duration_ms: Option, ) -> Result { off_main_core(core.inner().clone(), move |core| { - audio::record_test_clip_with(core, duration_ms) + audio::record_test_clip(core, duration_ms) }) .await } #[tauri::command] pub async fn get_test_clip_audio(core: tauri::State<'_, Core>) -> Result { - off_main_core(core.inner().clone(), audio::get_test_clip_audio_with).await + off_main_core(core.inner().clone(), audio::get_test_clip_audio).await } /// Transcribes a user-picked audio/video file. Async so the (possibly diff --git a/crates/scribe-core/src/audio.rs b/crates/scribe-core/src/audio.rs index 2b68c5a..206dda3 100644 --- a/crates/scribe-core/src/audio.rs +++ b/crates/scribe-core/src/audio.rs @@ -416,7 +416,7 @@ impl AudioService { } /// The input devices, with the one chosen in Settings marked. -pub fn list_microphones_with(core: &Core) -> Result, CommandError> { +pub fn list_microphones(core: &Core) -> Result, CommandError> { let state = core.backend(); let settings = state.db()?.get_settings()?; let microphones = state @@ -427,7 +427,7 @@ pub fn list_microphones_with(core: &Core) -> Result, Command /// `allow_auto_stop` marks the recording as eligible for silence auto-stop /// (toggle hotkey / tray menu / UI Start). Hold-to-talk passes false. -pub fn start_recording_with( +pub fn start_recording( core: &Core, request: Option, allow_auto_stop: bool, @@ -490,16 +490,16 @@ pub fn start_recording_with( } /// Stops the active recording the way a toggle press does. -pub fn stop_recording_with(core: &Core) -> Result { +pub fn stop_recording(core: &Core) -> Result { stop_recording_with_reason(Parts::of(core), StopReason::Completed, None) } /// Drops the active recording without transcribing it. -pub fn cancel_recording_with(core: &Core) -> Result<(), CommandError> { - cancel_recording(Parts::of(core)) +pub fn cancel_recording(core: &Core) -> Result<(), CommandError> { + cancel_recording_on(Parts::of(core)) } -fn cancel_recording(parts: Parts) -> Result<(), CommandError> { +fn cancel_recording_on(parts: Parts) -> Result<(), CommandError> { let state = parts.backend; let result = state.audio()?.stop(StopReason::Cancelled)?; @@ -528,7 +528,7 @@ fn cancel_recording(parts: Parts) -> Result<(), CommandError> { } /// Records a test clip of a fixed length. -pub fn record_test_clip_with( +pub fn record_test_clip( core: &Core, duration_ms: Option, ) -> Result { @@ -607,7 +607,7 @@ fn emit_recording_stopped(parts: Parts, result: &RecordingResult) { /// Returns the most recent test clip WAV as a base64 string for in-app /// playback. Errors with code "no_test_clip" when no clip is available. -pub fn get_test_clip_audio_with(core: &Core) -> Result { +pub fn get_test_clip_audio(core: &Core) -> Result { test_clip_audio(core.backend()) } @@ -634,7 +634,7 @@ fn no_test_clip() -> CommandError { /// [`StopPolicy`]). Runs on the dictation worker; a no-op when `session_id` is /// no longer the active recording (the user stopped it while this was /// queued), so the transcript is never lost or duplicated. -pub(crate) fn finish_timed_out_recording_with( +pub(crate) fn finish_timed_out_recording( core: &Core, session_id: &str, ) -> Result<(), CommandError> { @@ -653,7 +653,7 @@ pub(crate) fn finish_timed_out_recording_with( Ok(()) } -/// The stop half of [`finish_timed_out_recording_with`]: `None` (and nothing +/// The stop half of [`finish_timed_out_recording`]: `None` (and nothing /// sent) when `session_id` is no longer the active recording. fn stop_timed_out_recording( parts: Parts, @@ -681,7 +681,7 @@ fn stop_timed_out_recording( /// and timeout paths so the app never strands in Recording/Transcribing. If the /// session is already gone (the user stopped first, or a duplicate error /// callback slipped past the guard), it no-ops cleanly. -pub(crate) fn finish_disconnected_recording_with( +pub(crate) fn finish_disconnected_recording( core: &Core, session_id: &str, ) -> Result<(), CommandError> { @@ -699,7 +699,7 @@ pub(crate) fn finish_disconnected_recording_with( } }; - emit_recording_error_with( + emit_recording_error( parts.host.as_ref(), CommandError::new( "microphone_unavailable", @@ -1891,7 +1891,7 @@ pub(crate) fn duration_ms(sample_count: usize, sample_rate: u32) -> u64 { } /// Logs the error and sends `audio://recording-error`. -pub fn emit_recording_error_with(host: &dyn Host, error: CommandError) { +pub fn emit_recording_error(host: &dyn Host, error: CommandError) { log::error!("Recording error {}: {}", error.code, error.message); host.emit(CoreEvent::RecordingError(RecordingErrorEvent { code: error.code, @@ -2341,12 +2341,12 @@ mod tests { let fixture = Fixture::new(); fixture.drive(&[AppEvent::StartRecording]); - cancel_recording(fixture.parts()).unwrap(); + cancel_recording_on(fixture.parts()).unwrap(); assert_eq!(fixture.published_states(), ["Idle"]); assert_eq!(fixture.sent().len(), 1); // Nothing to cancel and nothing recording: nothing is sent. - cancel_recording(fixture.parts()).unwrap(); + cancel_recording_on(fixture.parts()).unwrap(); assert_eq!(fixture.sent().len(), 1); } @@ -2367,7 +2367,7 @@ mod tests { let fixture = Fixture::new(); let host = fixture.host.as_ref(); - emit_recording_error_with( + emit_recording_error( host, CommandError::new("microphone_unavailable", "The mic went away."), ); diff --git a/crates/scribe-core/src/dictation_worker.rs b/crates/scribe-core/src/dictation_worker.rs index c854245..3981e28 100644 --- a/crates/scribe-core/src/dictation_worker.rs +++ b/crates/scribe-core/src/dictation_worker.rs @@ -567,7 +567,7 @@ fn run_job(executor: &E, job: Job, finished: impl FnOnce()) { pub fn submit_with(core: &Core, intent: Intent) { let status = || Ok(core.backend().app_state()?.status().clone()); if let Err(error) = core.dictation_worker().submit_intent(intent, status) { - audio::emit_recording_error_with(core.host().as_ref(), error); + audio::emit_recording_error(core.host().as_ref(), error); } } @@ -596,7 +596,7 @@ impl Executor for AppExecutor { fn report(&self, error: CommandError) { refresh_tray(&self.core); - audio::emit_recording_error_with(self.core.host().as_ref(), error); + audio::emit_recording_error(self.core.host().as_ref(), error); } } @@ -606,13 +606,13 @@ fn execute_with(core: &Core, command: DictationCommand) -> Result Outcome::Started(audio::start_recording_with(core, request, allow_auto_stop)?), + } => Outcome::Started(audio::start_recording(core, request, allow_auto_stop)?), DictationCommand::StartNote => { let request = StartRecordingRequest { is_note: true, ..Default::default() }; - Outcome::Started(audio::start_recording_with(core, Some(request), true)?) + Outcome::Started(audio::start_recording(core, Some(request), true)?) } DictationCommand::StartTransform => { start_transform(core)?; @@ -623,18 +623,18 @@ fn execute_with(core: &Core, command: DictationCommand) -> Result { - audio::cancel_recording_with(core)?; + audio::cancel_recording(core)?; Outcome::Done } DictationCommand::PasteLast => Outcome::Output(output::paste_last_transcript_with(core)?), DictationCommand::FinishTimedOut { session_id } => { - audio::finish_timed_out_recording_with(core, &session_id)?; + audio::finish_timed_out_recording(core, &session_id)?; Outcome::Done } DictationCommand::FinishDisconnected { session_id } => { // The disconnect already told the user what happened; a // failure to salvage the audio is only logged. - if let Err(error) = audio::finish_disconnected_recording_with(core, &session_id) { + if let Err(error) = audio::finish_disconnected_recording(core, &session_id) { log::warn!( "Could not recover from a mid-recording audio stream error: {}", error.message @@ -658,7 +658,7 @@ fn refresh_tray(core: &Core) { /// Stops the active recording and finishes it: a too-short tap is reported as /// "nothing heard"; anything else is transcribed and output. fn stop_and_transcribe(core: &Core) -> Result<(), CommandError> { - let result = audio::stop_recording_with(core)?; + let result = audio::stop_recording(core)?; refresh_tray(core); if result.status == RecordingResultStatus::TooShort { diff --git a/crates/scribe-core/src/hotkeys.rs b/crates/scribe-core/src/hotkeys.rs index e16eb91..49e019c 100644 --- a/crates/scribe-core/src/hotkeys.rs +++ b/crates/scribe-core/src/hotkeys.rs @@ -1293,7 +1293,7 @@ pub(crate) fn run_action_with(target: &(impl ActionTarget + ?Sized), action: Hot }; if let Err(error) = result { - audio::emit_recording_error_with(target.host(), error); + audio::emit_recording_error(target.host(), error); } } @@ -1392,7 +1392,7 @@ pub(crate) fn start_transform_with(core: &Core) -> Result<(), CommandError> { }; // If the recording can't start, `captured` drops here and the clipboard // is put back. - audio::start_recording_with(core, Some(request), true)?; + audio::start_recording(core, Some(request), true)?; core.backend().set_pending_transform(captured); Ok(()) } From 1cfd0124c8e522963d2c335ffa7b5982160a7b17 Mon Sep 17 00:00:00 2001 From: Nathan Watkins <8055935+n8watkins@users.noreply.github.com> Date: Sun, 29 Nov 2026 11:48:59 -0800 Subject: [PATCH 03/10] refactor(core): drop the _with suffix from the data, diagnostics and release-notes functions The database-level pending_version, which took the name, is now pending_version_in. The open_transcript_externally command calls the engine function through its module. Release-note: skip --- app/src-tauri/src/commands/data.rs | 31 +++++++++++-------------- app/src-tauri/src/commands/models.rs | 2 +- app/src-tauri/src/lib.rs | 4 ++-- crates/scribe-core/src/data_hygiene.rs | 30 ++++++++++++------------ crates/scribe-core/src/diagnostics.rs | 2 +- crates/scribe-core/src/model_manager.rs | 2 +- crates/scribe-core/src/release_notes.rs | 24 +++++++++---------- 7 files changed, 45 insertions(+), 50 deletions(-) diff --git a/app/src-tauri/src/commands/data.rs b/app/src-tauri/src/commands/data.rs index 9cbe019..857d56e 100644 --- a/app/src-tauri/src/commands/data.rs +++ b/app/src-tauri/src/commands/data.rs @@ -8,10 +8,7 @@ use tauri::State; use super::{off_main_core, on_dialog_thread}; use crate::{ - data_hygiene::{ - effective_data_dir_with, failed_recordings_dir_with, logs_dir_with, open_folder_with, - open_transcript_externally_with, - }, + data_hygiene::{self, effective_data_dir, failed_recordings_dir, logs_dir, open_folder}, db::transcript_audio_missing, error::CommandError, import::{load_transcript_import, ImportReport, TranscriptImportPreview}, @@ -215,7 +212,7 @@ pub async fn open_transcript_externally( id: String, ) -> Result<(), CommandError> { off_main_core(core.inner().clone(), move |core| { - open_transcript_externally_with(core, &id) + data_hygiene::open_transcript_externally(core, &id) }) .await } @@ -268,7 +265,7 @@ pub async fn refresh_basic_stats(core: State<'_, Core>) -> Result) -> Result<(), CommandError> { off_main_core(core.inner().clone(), move |core| { - open_folder_with(core.host().as_ref(), effective_data_dir_with(core)) + open_folder(core.host().as_ref(), effective_data_dir(core)) }) .await } @@ -278,7 +275,7 @@ pub async fn open_data_folder(core: State<'_, Core>) -> Result<(), CommandError> #[tauri::command] pub async fn get_data_dir(core: State<'_, Core>) -> Result { off_main_core(core.inner().clone(), move |core| { - Ok(effective_data_dir_with(core).to_string_lossy().into_owned()) + Ok(effective_data_dir(core).to_string_lossy().into_owned()) }) .await } @@ -292,7 +289,7 @@ pub async fn pick_data_dir(core: State<'_, Core>) -> Result, Comm on_dialog_thread(core.inner().clone(), move |core| { #[cfg(windows)] { - let start = effective_data_dir_with(core); + let start = effective_data_dir(core); let picked = rfd::FileDialog::new() .set_title("Choose Scribe data folder") .set_directory(&start) @@ -318,7 +315,7 @@ pub async fn pick_data_dir(core: State<'_, Core>) -> Result, Comm pub async fn open_logs_folder(core: State<'_, Core>) -> Result<(), CommandError> { off_main_core(core.inner().clone(), move |core| { let host = core.host().as_ref(); - open_folder_with(host, logs_dir_with(host)) + open_folder(host, logs_dir(host)) }) .await } @@ -327,7 +324,7 @@ pub async fn open_logs_folder(core: State<'_, Core>) -> Result<(), CommandError> /// mirroring get_data_dir. #[tauri::command] pub fn get_logs_dir(core: State<'_, Core>) -> Result { - Ok(logs_dir_with(core.host().as_ref()) + Ok(logs_dir(core.host().as_ref()) .to_string_lossy() .into_owned()) } @@ -337,7 +334,7 @@ pub fn get_logs_dir(core: State<'_, Core>) -> Result { #[tauri::command] pub async fn open_failed_recordings_folder(core: State<'_, Core>) -> Result<(), CommandError> { off_main_core(core.inner().clone(), move |core| { - open_folder_with(core.host().as_ref(), failed_recordings_dir_with(core)) + open_folder(core.host().as_ref(), failed_recordings_dir(core)) }) .await } @@ -346,9 +343,7 @@ pub async fn open_failed_recordings_folder(core: State<'_, Core>) -> Result<(), /// Privacy view, mirroring get_logs_dir. #[tauri::command] pub fn get_failed_recordings_dir(core: State<'_, Core>) -> Result { - Ok(failed_recordings_dir_with(&core) - .to_string_lossy() - .into_owned()) + Ok(failed_recordings_dir(&core).to_string_lossy().into_owned()) } /// Exports transcripts to a local file the user picks via a native save dialog. @@ -428,7 +423,7 @@ pub async fn export_transcripts( #[cfg(windows)] { - let start = effective_data_dir_with(core); + let start = effective_data_dir(core); let picked = rfd::FileDialog::new() .set_title("Export transcripts") .set_directory(&start) @@ -467,7 +462,7 @@ pub async fn preview_transcript_import( on_dialog_thread(core.inner().clone(), move |core| { #[cfg(windows)] { - let start = effective_data_dir_with(core); + let start = effective_data_dir(core); let picked = rfd::FileDialog::new() .set_title("Restore Scribe backup") .set_directory(&start) @@ -585,7 +580,7 @@ pub async fn open_replacements_file(core: State<'_, Core>) -> Result<(), Command /// The version is the host's (the app's own, which Dev builds override). #[tauri::command] pub fn whats_new_pending(core: State<'_, Core>) -> Result, CommandError> { - crate::release_notes::pending_version_with(&core) + crate::release_notes::pending_version(&core) } /// Remembers that the card for `version` was dismissed. @@ -602,5 +597,5 @@ pub fn dismiss_whats_new(core: State<'_, Core>, version: String) -> Result<(), C /// which Dev builds override). #[tauri::command] pub fn collect_diagnostics(core: State<'_, Core>) -> Result { - crate::diagnostics::collect_with(&core) + crate::diagnostics::collect(&core) } diff --git a/app/src-tauri/src/commands/models.rs b/app/src-tauri/src/commands/models.rs index 59919e0..43bf434 100644 --- a/app/src-tauri/src/commands/models.rs +++ b/app/src-tauri/src/commands/models.rs @@ -4,7 +4,7 @@ //! Converted to the engine handle: commands here take the managed [`Core`] //! (docs/CORE-SPLIT.md). `open_models_folder`, `delete_model` and //! `select_model` announce settings through the host (`emit_changed_with`) -//! and open the folder through it (`open_folder_with`). +//! and open the folder through it (`open_folder`). use super::off_main_core; use crate::{error::CommandError, gpu::GpuProbe, model_manager, models::ModelInfo, Core}; diff --git a/app/src-tauri/src/lib.rs b/app/src-tauri/src/lib.rs index 94e0c36..8b3ba51 100644 --- a/app/src-tauri/src/lib.rs +++ b/app/src-tauri/src/lib.rs @@ -442,7 +442,7 @@ pub fn run() { std::thread::Builder::new() .name("data-cleanup".into()) .spawn(move || { - data_hygiene::run_startup_maintenance_with( + data_hygiene::run_startup_maintenance( &cleanup_backend, pre_rebrand_dir, migration_complete, @@ -1044,7 +1044,7 @@ mod startup_order_tests { "Database::open(", "autostart::reconcile_at_launch(", "BackendState::new(", - "data_hygiene::run_startup_maintenance_with(", + "data_hygiene::run_startup_maintenance(", "child_guard::init(", "WarmTranscriber::new_with(", "state_server::start_with(", diff --git a/crates/scribe-core/src/data_hygiene.rs b/crates/scribe-core/src/data_hygiene.rs index 4f97447..6861a9c 100644 --- a/crates/scribe-core/src/data_hygiene.rs +++ b/crates/scribe-core/src/data_hygiene.rs @@ -199,7 +199,7 @@ pub fn clear_files(dir: &Path) -> SweepReport { /// Runs once per launch on a background thread: rebrand repair, failed /// recordings past the retention window, orphaned clips, stale temp /// recordings and leftover editor copies. -pub fn run_startup_maintenance_with( +pub fn run_startup_maintenance( state: &BackendState, pre_rebrand_dir: Option, migration_complete: bool, @@ -363,7 +363,7 @@ fn files_identical(a: &Path, b: &Path) -> bool { /// The directory Scribe treats as its data root: the user-chosen `data_dir` /// when set, otherwise the OS app-data directory. Existing data is never moved /// when this changes; only future data lands in the new location. -pub fn effective_data_dir_with(core: &Core) -> PathBuf { +pub fn effective_data_dir(core: &Core) -> PathBuf { effective_data_dir_from(core.backend()) } @@ -389,7 +389,7 @@ fn effective_data_dir_from(state: &BackendState) -> PathBuf { /// LogDir resolves to app_log_dir()). Unlike the data/models folders this is /// always the OS log dir and is not affected by the custom data_dir setting. /// `DataDirs` has no log folder, so this is the host's (`Paths::log_dir`). -pub fn logs_dir_with(host: &dyn Host) -> PathBuf { +pub fn logs_dir(host: &dyn Host) -> PathBuf { host.paths().log_dir().to_path_buf() } @@ -399,12 +399,12 @@ pub fn logs_dir_with(host: &dyn Host) -> PathBuf { /// subfolder, *not* the custom data_dir — so "Open" always lands on the real /// quarantine folder rather than an empty one. It is the folder the backend's /// `DataDirs` name, which "Clear history" and retention delete from. -pub fn failed_recordings_dir_with(core: &Core) -> PathBuf { +pub fn failed_recordings_dir(core: &Core) -> PathBuf { core.backend().dirs().failed_recordings() } /// Creates `dir` when missing and opens it in the system file manager. -pub fn open_folder_with(host: &dyn Host, dir: PathBuf) -> Result<(), CommandError> { +pub fn open_folder(host: &dyn Host, dir: PathBuf) -> Result<(), CommandError> { std::fs::create_dir_all(&dir).map_err(|error| { CommandError::new( "open_folder_failed", @@ -424,11 +424,11 @@ pub fn open_folder_with(host: &dyn Host, dir: PathBuf) -> Result<(), CommandErro /// backend's `DataDirs`, which "Clear history" and the startup clean-up /// delete from) and opens it with the system's default text app (the /// `open_transcript_externally` command). -pub fn open_transcript_externally_with(core: &Core, id: &str) -> Result<(), CommandError> { +pub fn open_transcript_externally(core: &Core, id: &str) -> Result<(), CommandError> { open_editor_copy(core.backend(), core.host().as_ref(), id) } -/// The body of [`open_transcript_externally_with`], over the parts it uses. +/// The body of [`open_transcript_externally`], over the parts it uses. fn open_editor_copy(state: &BackendState, host: &dyn Host, id: &str) -> Result<(), CommandError> { let transcript = state .db()? @@ -763,8 +763,8 @@ mod tests { choose_data_dir(&state, &chosen.to_string_lossy()); assert_eq!(effective_data_dir_from(&state), chosen); - assert_eq!(logs_dir_with(&host), root.path().join("app-logs")); - // What failed_recordings_dir_with(core) answers. + assert_eq!(logs_dir(&host), root.path().join("app-logs")); + // What failed_recordings_dir(core) answers. let failed = state.dirs().failed_recordings(); assert_eq!(failed, root.path().join("data").join("failed")); assert!(!failed.starts_with(&chosen)); @@ -781,7 +781,7 @@ mod tests { let fresh = dirs.temp_recordings().join("new.wav"); write(&fresh, b"x"); - run_startup_maintenance_with(&state, None, false); + run_startup_maintenance(&state, None, false); assert!(!dirs.editor_copy("t1").exists()); assert!(!stale.exists()); @@ -812,7 +812,7 @@ mod tests { let recent_orphan = dirs.clips().join("saving.wav"); write(&recent_orphan, b"x"); - run_startup_maintenance_with(&state, None, false); + run_startup_maintenance(&state, None, false); assert!(!old_failed.exists()); assert!(new_failed.exists()); @@ -843,7 +843,7 @@ mod tests { write_aged(file, DAY * 30); } - run_startup_maintenance_with(&state, None, false); + run_startup_maintenance(&state, None, false); for file in &files { assert!(file.exists(), "{} was removed", file.display()); @@ -857,13 +857,13 @@ mod tests { let root = tempfile::tempdir().unwrap(); let host = host_in(root.path()); let dir = root.path().join("logs").join("nested"); - open_folder_with(&host, dir.clone()).unwrap(); + open_folder(&host, dir.clone()).unwrap(); assert!(dir.is_dir()); assert_eq!(host.calls(), [HostCall::OpenPath(dir.clone())]); assert!(host.events().is_empty()); host.fail(Failing::OpenPath); - let error = open_folder_with(&host, dir.clone()).unwrap_err(); + let error = open_folder(&host, dir.clone()).unwrap_err(); assert_eq!(error.code, "open_folder_failed"); assert_eq!( error.message, @@ -877,7 +877,7 @@ mod tests { // A folder that cannot be created is never handed to the host. let blocker = root.path().join("a-file"); fs::write(&blocker, b"x").unwrap(); - let error = open_folder_with(&host, blocker.join("below")).unwrap_err(); + let error = open_folder(&host, blocker.join("below")).unwrap_err(); assert_eq!(error.code, "open_folder_failed"); assert!(error.message.starts_with("Could not create folder")); assert_eq!(host.calls().len(), 2); diff --git a/crates/scribe-core/src/diagnostics.rs b/crates/scribe-core/src/diagnostics.rs index 85560a7..13e2e56 100644 --- a/crates/scribe-core/src/diagnostics.rs +++ b/crates/scribe-core/src/diagnostics.rs @@ -74,7 +74,7 @@ const SETTINGS_ALLOW_LIST: &[&str] = &[ ]; /// Builds the diagnostics report (the `collect_diagnostics` command). -pub fn collect_with(core: &Core) -> Result { +pub fn collect(core: &Core) -> Result { collect_from(core.backend(), core.host().as_ref()) } diff --git a/crates/scribe-core/src/model_manager.rs b/crates/scribe-core/src/model_manager.rs index f090844..8e368c5 100644 --- a/crates/scribe-core/src/model_manager.rs +++ b/crates/scribe-core/src/model_manager.rs @@ -749,7 +749,7 @@ fn model_info_for_catalog( /// Opens the models folder of `host` in the system's file manager, creating it /// first when it is missing. pub fn open_models_folder_with(host: &dyn Host) -> Result<(), CommandError> { - crate::data_hygiene::open_folder_with(host, models_dir_with(host)) + crate::data_hygiene::open_folder(host, models_dir_with(host)) } /// The `delete_model` command: deletes the model, and when that cleared the diff --git a/crates/scribe-core/src/release_notes.rs b/crates/scribe-core/src/release_notes.rs index 43d75b7..7d7f53c 100644 --- a/crates/scribe-core/src/release_notes.rs +++ b/crates/scribe-core/src/release_notes.rs @@ -7,13 +7,13 @@ use crate::{backend::BackendState, core::Core, db::Database, error::CommandError, host::Host}; -/// [`pending_version`] for the running app (the `whats_new_pending` +/// [`pending_version_in`] for the running app (the `whats_new_pending` /// command). -pub fn pending_version_with(core: &Core) -> Result, CommandError> { +pub fn pending_version(core: &Core) -> Result, CommandError> { pending_version_on(core.backend(), core.host().as_ref()) } -/// [`pending_version`] for the version `host` runs: the app's own, which Dev +/// [`pending_version_in`] for the version `host` runs: the app's own, which Dev /// and test builds override, so it can differ from this crate's. The version /// is read before the database lock is taken, so the host is never called /// while that lock is held. @@ -22,11 +22,11 @@ fn pending_version_on( host: &dyn Host, ) -> Result, CommandError> { let version = host.app_version(); - pending_version(&*state.db()?, &version) + pending_version_in(&*state.db()?, &version) } /// The version whose card should show now, or `None`. -pub fn pending_version(db: &Database, current: &str) -> Result, CommandError> { +pub fn pending_version_in(db: &Database, current: &str) -> Result, CommandError> { match db.whats_new_seen_version()? { Some(seen) if seen == current => Ok(None), Some(_) => Ok(Some(current.to_string())), @@ -51,13 +51,13 @@ mod tests { #[test] fn a_fresh_install_skips_the_card_and_remembers_its_version() { let db = Database::in_memory().unwrap(); - assert_eq!(pending_version(&db, "0.10.0").unwrap(), None); + assert_eq!(pending_version_in(&db, "0.10.0").unwrap(), None); assert_eq!( db.whats_new_seen_version().unwrap().as_deref(), Some("0.10.0") ); assert_eq!( - pending_version(&db, "0.11.0").unwrap().as_deref(), + pending_version_in(&db, "0.11.0").unwrap().as_deref(), Some("0.11.0") ); } @@ -67,11 +67,11 @@ mod tests { let db = Database::in_memory().unwrap(); db.save_settings(&AppSettings::default()).unwrap(); assert_eq!( - pending_version(&db, "0.10.0").unwrap().as_deref(), + pending_version_in(&db, "0.10.0").unwrap().as_deref(), Some("0.10.0") ); db.set_whats_new_seen_version("0.10.0").unwrap(); - assert_eq!(pending_version(&db, "0.10.0").unwrap(), None); + assert_eq!(pending_version_in(&db, "0.10.0").unwrap(), None); } /// Dev and test builds carry a version the shell overrides (say @@ -80,9 +80,9 @@ mod tests { fn the_card_follows_the_version_passed_in() { let db = Database::in_memory().unwrap(); db.set_whats_new_seen_version("0.16.4-123").unwrap(); - assert_eq!(pending_version(&db, "0.16.4-123").unwrap(), None); + assert_eq!(pending_version_in(&db, "0.16.4-123").unwrap(), None); assert_eq!( - pending_version(&db, "0.16.4-124").unwrap().as_deref(), + pending_version_in(&db, "0.16.4-124").unwrap().as_deref(), Some("0.16.4-124") ); } @@ -138,6 +138,6 @@ mod tests { let db = Database::in_memory().unwrap(); db.set_whats_new_seen_version("0.10.0").unwrap(); db.save_settings(&AppSettings::default()).unwrap(); - assert_eq!(pending_version(&db, "0.10.0").unwrap(), None); + assert_eq!(pending_version_in(&db, "0.10.0").unwrap(), None); } } From 3fc98e6090c0780bc7712f7acee7f1da24c87d0f Mon Sep 17 00:00:00 2001 From: Nathan Watkins <8055935+n8watkins@users.noreply.github.com> Date: Sun, 29 Nov 2026 11:49:10 -0800 Subject: [PATCH 04/10] refactor(core): drop the _with suffix from the model manager functions Release-note: skip --- app/src-tauri/src/commands/models.rs | 12 ++++----- app/src-tauri/tests/models.rs | 2 +- crates/scribe-core/src/dictation.rs | 2 +- crates/scribe-core/src/file_transcribe.rs | 3 +-- crates/scribe-core/src/gpu.rs | 2 +- crates/scribe-core/src/incremental.rs | 4 +-- crates/scribe-core/src/model_manager.rs | 30 +++++++++++------------ crates/scribe-core/src/self_test.rs | 4 +-- crates/scribe-core/src/whisper_server.rs | 2 +- 9 files changed, 30 insertions(+), 31 deletions(-) diff --git a/app/src-tauri/src/commands/models.rs b/app/src-tauri/src/commands/models.rs index 43bf434..349431c 100644 --- a/app/src-tauri/src/commands/models.rs +++ b/app/src-tauri/src/commands/models.rs @@ -12,7 +12,7 @@ use crate::{error::CommandError, gpu::GpuProbe, model_manager, models::ModelInfo #[tauri::command] pub async fn open_models_folder(core: tauri::State<'_, Core>) -> Result<(), CommandError> { off_main_core(core.inner().clone(), move |core| { - model_manager::open_models_folder_with(core.host().as_ref()) + model_manager::open_models_folder(core.host().as_ref()) }) .await } @@ -22,7 +22,7 @@ pub async fn list_models(core: tauri::State<'_, Core>) -> Result, off_main_core(core.inner().clone(), move |core| { let state = core.backend(); let db = state.db()?; - model_manager::list_models_with(core.host().as_ref(), &db, state.model_downloads()) + model_manager::list_models(core.host().as_ref(), &db, state.model_downloads()) }) .await } @@ -33,7 +33,7 @@ pub async fn download_model( model_id: String, ) -> Result { off_main_core(core.inner().clone(), move |core| { - model_manager::download_model_with(core.host().as_ref(), core.backend(), &model_id) + model_manager::download_model(core.host().as_ref(), core.backend(), &model_id) }) .await } @@ -61,7 +61,7 @@ pub async fn retry_model_download( model_id: String, ) -> Result { off_main_core(core.inner().clone(), move |core| { - model_manager::retry_model_download_with(core.host().as_ref(), core.backend(), &model_id) + model_manager::retry_model_download(core.host().as_ref(), core.backend(), &model_id) }) .await } @@ -72,7 +72,7 @@ pub async fn delete_model( model_id: String, ) -> Result { off_main_core(core.inner().clone(), move |core| { - model_manager::delete_model_announced_with( + model_manager::delete_model_announced( core.host().as_ref(), core.backend(), &model_id, @@ -89,7 +89,7 @@ pub async fn select_model( model_id: String, ) -> Result { off_main_core(core.inner().clone(), move |core| { - model_manager::select_model_announced_with( + model_manager::select_model_announced( core.host().as_ref(), core.backend(), &model_id, diff --git a/app/src-tauri/tests/models.rs b/app/src-tauri/tests/models.rs index ea6c703..ce50c96 100644 --- a/app/src-tauri/tests/models.rs +++ b/app/src-tauri/tests/models.rs @@ -37,7 +37,7 @@ fn the_models_folder_is_where_tauri_put_it() { let app = app_for(flavor); let host = RecordingHost::new(resolve_paths(&app).unwrap(), flavor); assert_eq!( - model_manager::models_dir_with(&host), + model_manager::models_dir(&host), app.path().app_data_dir().unwrap().join("models"), "{flavor:?}" ); diff --git a/crates/scribe-core/src/dictation.rs b/crates/scribe-core/src/dictation.rs index 00f92da..41bdce5 100644 --- a/crates/scribe-core/src/dictation.rs +++ b/crates/scribe-core/src/dictation.rs @@ -229,7 +229,7 @@ fn transcribe_recording_inner( let settings = state.db()?.get_settings()?; let (model_id, model_path) = { let db = state.db()?; - model_manager::session_model_path_with(host, &db, &recording.session_id)? + model_manager::session_model_path(host, &db, &recording.session_id)? }; let language = whisper_language(&settings.language); diff --git a/crates/scribe-core/src/file_transcribe.rs b/crates/scribe-core/src/file_transcribe.rs index fa10c27..3d70425 100644 --- a/crates/scribe-core/src/file_transcribe.rs +++ b/crates/scribe-core/src/file_transcribe.rs @@ -48,8 +48,7 @@ pub fn transcribe_file_with(core: &Core, path: &str) -> Result Option { if !cfg!(windows) { return None; } - let model = crate::model_manager::smallest_downloaded_model_path_with(host)?; + let model = crate::model_manager::smallest_downloaded_model_path(host)?; let executable = crate::whisper::resolve_bundled_executable_with(host, "whisper-cli.exe").ok()?; Some(ProbeInputs { model, executable }) diff --git a/crates/scribe-core/src/incremental.rs b/crates/scribe-core/src/incremental.rs index 2e3a3bb..c6fec76 100644 --- a/crates/scribe-core/src/incremental.rs +++ b/crates/scribe-core/src/incremental.rs @@ -532,8 +532,8 @@ fn segment_context( ) -> Result { let db = state.db().map_err(|error| error.message)?; let settings = db.get_settings().map_err(|error| error.message)?; - let (model_id, model_path) = model_manager::session_model_path_with(host, &db, session_id) - .map_err(|error| error.message)?; + let (model_id, model_path) = + model_manager::session_model_path(host, &db, session_id).map_err(|error| error.message)?; Ok(SegmentContext { engine: crate::models::catalog_model(&model_id) diff --git a/crates/scribe-core/src/model_manager.rs b/crates/scribe-core/src/model_manager.rs index 8e368c5..0118abf 100644 --- a/crates/scribe-core/src/model_manager.rs +++ b/crates/scribe-core/src/model_manager.rs @@ -108,7 +108,7 @@ pub struct ModelDownloadProgress { } /// Every catalog model with its status, from the models folder of `host`. -pub fn list_models_with( +pub fn list_models( host: &dyn Host, db: &Database, downloads: &DownloadRegistry, @@ -146,7 +146,7 @@ fn list_models_in( /// to `host`. Blocks for the whole download, so it takes the database lock /// only for each short read or write, never across the network transfer: /// dictation and every other command keep working meanwhile. -pub fn download_model_with( +pub fn download_model( host: &dyn Host, state: &BackendState, model_id: &str, @@ -159,14 +159,14 @@ pub fn download_model_with( } /// Throws away a partial download, then downloads the model again. -pub fn retry_model_download_with( +pub fn retry_model_download( host: &dyn Host, state: &BackendState, model_id: &str, ) -> Result { let catalog_model = catalog_model(model_id)?; let _ = fs::remove_file(ModelFolders::of(host).partial_path(catalog_model)); - download_model_with(host, state, model_id) + download_model(host, state, model_id) } pub fn cancel_model_download( @@ -290,7 +290,7 @@ fn select_model_in( } /// The selected model (the default one when none is selected) and its file. -pub fn selected_model_path_with( +pub fn selected_model_path( host: &dyn Host, db: &Database, ) -> Result<(String, PathBuf), CommandError> { @@ -341,7 +341,7 @@ fn model_path_for_id_in( /// The model a dictation uses: the one it started with, else the selected one. /// In the models folder of `host`. -pub fn session_model_path_with( +pub fn session_model_path( host: &dyn Host, db: &Database, session_id: &str, @@ -748,8 +748,8 @@ fn model_info_for_catalog( /// Opens the models folder of `host` in the system's file manager, creating it /// first when it is missing. -pub fn open_models_folder_with(host: &dyn Host) -> Result<(), CommandError> { - crate::data_hygiene::open_folder(host, models_dir_with(host)) +pub fn open_models_folder(host: &dyn Host) -> Result<(), CommandError> { + crate::data_hygiene::open_folder(host, models_dir(host)) } /// The `delete_model` command: deletes the model, and when that cleared the @@ -758,7 +758,7 @@ pub fn open_models_folder_with(host: &dyn Host) -> Result<(), CommandError> { /// Holds the settings write lock from the read to the announcement, so /// announcements go out in the order the writes happened. Nothing is sent /// when the settings did not change. -pub fn delete_model_announced_with( +pub fn delete_model_announced( host: &dyn Host, state: &BackendState, model_id: &str, @@ -795,7 +795,7 @@ fn delete_model_announced_in( /// speech engine unloads the old model before the new one loads). Holds the /// settings write lock from the write to the announcement. Sends nothing when /// the selection fails. -pub fn select_model_announced_with( +pub fn select_model_announced( host: &dyn Host, state: &BackendState, model_id: &str, @@ -837,7 +837,7 @@ fn announce_selection_in( /// The folder Scribe downloads models into: `models` in the app data folder /// of `host` (Tauri's `app_data_dir()`, not the user-chosen data folder). -pub fn models_dir_with(host: &dyn Host) -> PathBuf { +pub fn models_dir(host: &dyn Host) -> PathBuf { models_dir_in(host.paths()) } @@ -899,7 +899,7 @@ fn resolve_model_file( /// *a* model loaded rather than the user's selected one — e.g. the GPU device /// probe, where device enumeration is model-independent so loading a multi-GB /// model would be pure waste. Returns `None` when nothing is downloaded. -pub fn smallest_downloaded_model_path_with(host: &dyn Host) -> Option { +pub fn smallest_downloaded_model_path(host: &dyn Host) -> Option { smallest_downloaded_model_path_in(&ModelFolders::of(host)) } @@ -1002,7 +1002,7 @@ mod tests { fn models_live_in_the_hosts_data_folder() { let (host, root) = temp_host("folder"); let models = root.join("data").join("models"); - assert_eq!(models_dir_with(&host), models); + assert_eq!(models_dir(&host), models); assert_eq!(ModelFolders::of(&host).app_data, models); } @@ -1163,7 +1163,7 @@ mod tests { let models = root.join("data").join("models"); assert!(!models.exists()); - open_models_folder_with(&host).unwrap(); + open_models_folder(&host).unwrap(); assert!(models.is_dir()); assert_eq!(host.calls(), vec![HostCall::OpenPath(models)]); @@ -1177,7 +1177,7 @@ mod tests { let (host, root) = temp_host("open-fails"); host.fail(Failing::OpenPath); - let error = open_models_folder_with(&host).unwrap_err(); + let error = open_models_folder(&host).unwrap_err(); assert_eq!(error.code, "open_folder_failed"); assert!(error.message.contains(&Failing::OpenPath.message())); diff --git a/crates/scribe-core/src/self_test.rs b/crates/scribe-core/src/self_test.rs index 3c08a5e..ab63c93 100644 --- a/crates/scribe-core/src/self_test.rs +++ b/crates/scribe-core/src/self_test.rs @@ -146,7 +146,7 @@ fn ensure_selected_model( .map_err(|error| error.message)? .selected_model_id .unwrap_or_else(|| crate::models::DEFAULT_MODEL_ID.to_string()); - let present = model_manager::selected_model_path_with(host, &db).is_ok(); + let present = model_manager::selected_model_path(host, &db).is_ok(); (model_id, present) }; result.model_id = Some(model_id.clone()); @@ -154,7 +154,7 @@ fn ensure_selected_model( return Ok(()); } log::info!("Self-test: downloading model {}", model_id); - model_manager::download_model_with(host, state, &model_id) + model_manager::download_model(host, state, &model_id) .map(|_| ()) .map_err(|error| error.message) } diff --git a/crates/scribe-core/src/whisper_server.rs b/crates/scribe-core/src/whisper_server.rs index 90546e0..7c8668b 100644 --- a/crates/scribe-core/src/whisper_server.rs +++ b/crates/scribe-core/src/whisper_server.rs @@ -1258,7 +1258,7 @@ fn desired_config(shared: &Shared, settings: &AppSettings) -> Option Date: Sun, 29 Nov 2026 11:49:29 -0800 Subject: [PATCH 05/10] refactor(core): drop the _with suffix from the replacements, settings, state server, status file, test audio, remote command and dictation state functions state_server::start_with is now start; the sound player's private Dispatcher::start_with keeps its name. Release-note: skip --- app/src-tauri/src/commands/data.rs | 12 ++++----- app/src-tauri/src/commands/hotkeys.rs | 8 +++--- app/src-tauri/src/commands/models.rs | 2 +- app/src-tauri/src/commands/shell.rs | 2 +- app/src-tauri/src/lib.rs | 18 ++++++------- app/src-tauri/src/tray.rs | 4 +-- crates/scribe-core/src/core.rs | 6 ++--- crates/scribe-core/src/dictation_state.rs | 4 +-- crates/scribe-core/src/github_oauth.rs | 4 +-- crates/scribe-core/src/model_manager.rs | 4 +-- crates/scribe-core/src/output.rs | 10 ++++---- crates/scribe-core/src/remote_command.rs | 4 +-- crates/scribe-core/src/replacements_file.rs | 8 +++--- crates/scribe-core/src/settings_store.rs | 28 ++++++++++----------- crates/scribe-core/src/state_server.rs | 14 +++++------ crates/scribe-core/src/status_file.rs | 16 ++++++------ crates/scribe-core/src/test_audio.rs | 2 +- 17 files changed, 72 insertions(+), 74 deletions(-) diff --git a/app/src-tauri/src/commands/data.rs b/app/src-tauri/src/commands/data.rs index 857d56e..2b163b2 100644 --- a/app/src-tauri/src/commands/data.rs +++ b/app/src-tauri/src/commands/data.rs @@ -12,9 +12,9 @@ use crate::{ db::transcript_audio_missing, error::CommandError, import::{load_transcript_import, ImportReport, TranscriptImportPreview}, - replacements_file::{notify_backup_with, open_replacements_file_with, replacements_error}, + replacements_file::{self, notify_backup, replacements_error}, settings::AppSettings, - settings_store::patch_settings_now_with, + settings_store::patch_settings_now, stats::BasicStats, transcript::{Transcript, TranscriptSearchResult, TranscriptSort}, Core, @@ -38,7 +38,7 @@ pub async fn patch_settings( patch: serde_json::Map, ) -> Result { off_main_core(core.inner().clone(), move |core| { - patch_settings_now_with(core, &patch) + patch_settings_now(core, &patch) }) .await } @@ -544,7 +544,7 @@ pub async fn add_replacements( ) -> Result { off_main_core(core.inner().clone(), move |core| { let report = core.replacements().add(&rows).map_err(replacements_error)?; - notify_backup_with(core); + notify_backup(core); Ok(report) }) .await @@ -561,7 +561,7 @@ pub async fn remove_replacement( .replacements() .remove(&row) .map_err(replacements_error)?; - notify_backup_with(core); + notify_backup(core); Ok(info) }) .await @@ -571,7 +571,7 @@ pub async fn remove_replacement( #[tauri::command] pub async fn open_replacements_file(core: State<'_, Core>) -> Result<(), CommandError> { off_main_core(core.inner().clone(), move |core| { - open_replacements_file_with(core) + replacements_file::open_replacements_file(core) }) .await } diff --git a/app/src-tauri/src/commands/hotkeys.rs b/app/src-tauri/src/commands/hotkeys.rs index 9b32199..e7bc6ac 100644 --- a/app/src-tauri/src/commands/hotkeys.rs +++ b/app/src-tauri/src/commands/hotkeys.rs @@ -111,7 +111,7 @@ pub async fn rebind_hotkey( return Err(error); } - settings_store::emit_changed_with(core.host().as_ref(), &settings); + settings_store::emit_changed(core.host().as_ref(), &settings); hotkeys::emit_registration_failures_with(core.host().as_ref(), &failures); hotkeys::status_with(core, &settings.hotkeys) }) @@ -151,7 +151,7 @@ pub async fn set_hotkey_trigger( return Err(error); } - settings_store::emit_changed_with(core.host().as_ref(), &settings); + settings_store::emit_changed(core.host().as_ref(), &settings); hotkeys::emit_registration_failures_with(core.host().as_ref(), &failures); hotkeys::status_with(core, &settings.hotkeys) }) @@ -185,7 +185,7 @@ pub async fn reset_hotkeys_to_defaults( return Err(error); } - settings_store::emit_changed_with(core.host().as_ref(), &settings); + settings_store::emit_changed(core.host().as_ref(), &settings); hotkeys::emit_registration_failures_with(core.host().as_ref(), &failures); hotkeys::status_with(core, &settings.hotkeys) }) @@ -217,7 +217,7 @@ pub async fn load_production_hotkey_defaults( return Err(error); } - settings_store::emit_changed_with(core.host().as_ref(), &settings); + settings_store::emit_changed(core.host().as_ref(), &settings); hotkeys::emit_registration_failures_with(core.host().as_ref(), &failures); hotkeys::status_with(core, &settings.hotkeys) }) diff --git a/app/src-tauri/src/commands/models.rs b/app/src-tauri/src/commands/models.rs index 349431c..3dae047 100644 --- a/app/src-tauri/src/commands/models.rs +++ b/app/src-tauri/src/commands/models.rs @@ -3,7 +3,7 @@ //! //! Converted to the engine handle: commands here take the managed [`Core`] //! (docs/CORE-SPLIT.md). `open_models_folder`, `delete_model` and -//! `select_model` announce settings through the host (`emit_changed_with`) +//! `select_model` announce settings through the host (`emit_changed`) //! and open the folder through it (`open_folder`). use super::off_main_core; diff --git a/app/src-tauri/src/commands/shell.rs b/app/src-tauri/src/commands/shell.rs index f34f381..7135ea2 100644 --- a/app/src-tauri/src/commands/shell.rs +++ b/app/src-tauri/src/commands/shell.rs @@ -28,7 +28,7 @@ pub async fn save_window_size(core: tauri::State<'_, Core>) -> Result { log::info!("Dictation-state interface on {}", server.base_url()); Some(server) @@ -528,7 +528,7 @@ pub fn run() { watch_host.emit(events::CoreEvent::ReplacementsChanged(info.clone())); // Back the edited file up with the notes, when backup is on. if let Some(core) = watch_cell.get() { - replacements_file::notify_backup_with(&core); + replacements_file::notify_backup(&core); } }); } @@ -561,12 +561,12 @@ pub fn run() { // Builds made for the end-to-end tests can record a WAV file in // place of the microphone (see test_audio for the gates). #[cfg(feature = "e2e-audio")] - test_audio::activate_with(host.as_ref()); + test_audio::activate(host.as_ref()); // Seed the on-disk status file with the startup (Idle) state so a // second app (T-Hub) always has a file to read, even before the // first dictation. - status_file::publish_idle_with(host.as_ref()); + status_file::publish_idle(host.as_ref()); // `--self-test-transcribe