From bbdf38018b47328b5faa2cef635c37095045be72 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 12 Jun 2026 01:54:21 +0200 Subject: feat(server): Really make users stateless (with tests) This commit also remove another load of unneeded features. --- crates/turtle/src/command/client/history.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'crates/turtle/src/command/client/history.rs') diff --git a/crates/turtle/src/command/client/history.rs b/crates/turtle/src/command/client/history.rs index e533759b..693098c0 100644 --- a/crates/turtle/src/command/client/history.rs +++ b/crates/turtle/src/command/client/history.rs @@ -21,7 +21,7 @@ use serde::Serialize; use crate::atuin_daemon::history::{HistoryEventKind, TailHistoryReply}; use crate::atuin_client::{ - database::{Database, Sqlite, current_context}, + database::{ClientSqlite, current_context}, encryption, history::{History, store::HistoryStore}, record::sqlite_store::SqliteStore, @@ -411,7 +411,7 @@ fn normalize_command_for_storage<'a>(command: &'a str, settings: &Settings) -> & } async fn handle_start( - db: &impl Database, + db: &ClientSqlite, settings: &Settings, command: &str, author: Option<&str>, @@ -484,7 +484,7 @@ async fn handle_daemon_start( #[expect(unused_variables)] async fn handle_end( - db: &impl Database, + db: &ClientSqlite, store: SqliteStore, history_store: HistoryStore, settings: &Settings, @@ -527,7 +527,7 @@ async fn handle_end( db.update(&h).await?; history_store.push(h).await?; - if settings.should_sync().await? { + if settings.sync.should_sync().await? { let (_, downloaded) = record::sync::sync(settings, &store, &history_store.encryption_key).await?; Settings::save_sync_time().await?; @@ -564,7 +564,7 @@ pub(super) async fn start_history_entry( } let db_path = PathBuf::from(settings.db_path.as_str()); - let db = Sqlite::new(db_path, settings.local_timeout).await?; + let db = ClientSqlite::new(db_path, settings.local_timeout).await?; handle_start(&db, settings, command, author, intent).await } @@ -582,7 +582,7 @@ pub(super) async fn end_history_entry( let db_path = PathBuf::from(settings.db_path.as_str()); let record_store_path = PathBuf::from(settings.record_store_path.as_str()); - let db = Sqlite::new(db_path, settings.local_timeout).await?; + let db = ClientSqlite::new(db_path, settings.local_timeout).await?; let store = SqliteStore::new(record_store_path, settings.local_timeout).await?; let encryption_key: [u8; 32] = encryption::load_key(settings) @@ -922,7 +922,7 @@ impl Cmd { #[expect(clippy::too_many_arguments)] #[expect(clippy::fn_params_excessive_bools)] async fn handle_list( - db: &impl Database, + db: &ClientSqlite, settings: &Settings, context: crate::atuin_client::database::Context, session: bool, @@ -964,7 +964,7 @@ impl Cmd { } async fn handle_prune( - db: &impl Database, + db: &ClientSqlite, settings: &Settings, store: SqliteStore, context: crate::atuin_client::database::Context, @@ -1017,7 +1017,7 @@ impl Cmd { } async fn handle_dedup( - db: &impl Database, + db: &ClientSqlite, settings: &Settings, store: SqliteStore, before: i64, @@ -1119,7 +1119,7 @@ impl Cmd { let db_path = PathBuf::from(settings.db_path.as_str()); let record_store_path = PathBuf::from(settings.record_store_path.as_str()); - let db = Sqlite::new(db_path, settings.local_timeout).await?; + let db = ClientSqlite::new(db_path, settings.local_timeout).await?; let store = SqliteStore::new(record_store_path, settings.local_timeout).await?; let encryption_key: [u8; 32] = encryption::load_key(settings) @@ -1233,7 +1233,7 @@ mod tests { #[tokio::test] async fn handle_start_saves_trimmed_command() { - let db = Sqlite::new("sqlite::memory:", 2.0).await.unwrap(); + let db = ClientSqlite::new("sqlite::memory:", 2.0).await.unwrap(); let settings = Settings::utc(); handle_start(&db, &settings, "ls \t", None, None) @@ -1251,7 +1251,7 @@ mod tests { #[tokio::test] async fn handle_start_can_keep_trailing_whitespace() { - let db = Sqlite::new("sqlite::memory:", 2.0).await.unwrap(); + let db = ClientSqlite::new("sqlite::memory:", 2.0).await.unwrap(); let settings = Settings { strip_trailing_whitespace: false, ..Settings::utc() -- cgit v1.3.1