Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style: apply rustfmt formatting across storage and session store code

Steven Enamakelcc5fb8d2f53a
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
index 60fac79fa2..fad0200a4a 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod_tests.rs
@@ -49,11 +49,9 @@ async fn the_module_defers_a_summary_until_requested() {
.await;
assert_eq!(output.summarized_from_bytes, None);
- assert!(
- !output
- .text
- .contains("the rate limit is 60 requests a minute")
- );
+ assert!(!output
+ .text
+ .contains("the rate limit is 60 requests a minute"));
assert!(
output.text.contains(tinyjuice_bus::tools::RETRIEVE),
"the original stays retrievable: {}",
@@ -217,7 +215,10 @@ fn install_request_handle_mode_follows_every_switch_it_needs() {
config.tokenjuice.repl_save_enabled = true;
let request = install_request(&config);
assert!(!request.options.repl_handle);
- assert!(!request.options.repl_handle, "no handle means no copy is written");
+ assert!(
+ !request.options.repl_handle,
+ "no handle means no copy is written"
+ );
}
}
diff --git a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
index 9c5b1adeeb..1db6f12f31 100644
--- a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
+++ b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
@@ -173,9 +173,7 @@ async fn files_a_blob_backed_generated_artifact() {
let workspace = root.path().join("workspace");
let files_dir = root.path().join("Files");
let backend = crate::storage::test_support::memory_backend();
- let scoped = backend
- .for_scope(&crate::storage::Scope::local())
- .unwrap();
+ let scoped = backend.for_scope(&crate::storage::Scope::local()).unwrap();
let blobs: Arc<dyn BlobStore> = Arc::clone(scoped.blobs());
let _output = MediaOutput::new(root.path(), Arc::clone(&blobs));
let wrapped = MediaArtifactTool::new(
@@ -293,11 +291,13 @@ async fn removes_partial_destination_when_blob_read_fails() {
let reader: tinyagents_storage_kit::blob::BlobReader = Box::pin(futures_util::stream::iter([
Ok(bytes::Bytes::from_static(b"partial media")),
- Err(tinystoragedrivers_types::StorageError::backend("reader failed")),
+ Err(tinystoragedrivers_types::StorageError::backend(
+ "reader failed",
+ )),
]));
let error = copy_blob_to_file(&mut reader, &dest, "generated-media/fail.png")
- .await
- .unwrap_err();
+ .await
+ .unwrap_err();
assert!(error.contains("failed to copy generated media blob"));
assert!(!dest.exists());
@@ -308,9 +308,7 @@ async fn keeps_source_blob_when_artifact_finalization_fails() {
let root = tempfile::tempdir().unwrap();
let workspace = root.path().join("workspace");
let backend = crate::storage::test_support::memory_backend();
- let scoped = backend
- .for_scope(&crate::storage::Scope::local())
- .unwrap();
+ let scoped = backend.for_scope(&crate::storage::Scope::local()).unwrap();
let blobs: Arc<dyn BlobStore> = Arc::clone(scoped.blobs());
let key = "generated-media/finalize-failure.png";
blobs
diff --git a/crates/openhuman-core/src/profiles/storage_schema_tests.rs b/crates/openhuman-core/src/profiles/storage_schema_tests.rs
index 4095f1e7a5..dd3a062835 100644
--- a/crates/openhuman-core/src/profiles/storage_schema_tests.rs
+++ b/crates/openhuman-core/src/profiles/storage_schema_tests.rs
@@ -1,8 +1,8 @@
use super::*;
use crate::storage::test_support::sqlite_backend;
+use crate::storage::Scope;
use serde_json::json;
use std::sync::Arc;
-use crate::storage::Scope;
use tinystoragedrivers::{Meta, Precondition};
#[test]
@@ -104,8 +104,13 @@ async fn migrate_cluster_moves_v1_leases_into_tsd_leases_and_keeps_their_epoch()
// The host's lease store reads the moved records: alice is still held,
// bob's released record is taken over cleanly at the next epoch.
- let b = DocumentLeases::cluster(backend.as_ref(), "node-b", None, std::time::Duration::from_secs(1))
- .unwrap();
+ let b = DocumentLeases::cluster(
+ backend.as_ref(),
+ "node-b",
+ None,
+ std::time::Duration::from_secs(1),
+ )
+ .unwrap();
let held = b.holder("alice").await.unwrap().unwrap();
assert_eq!((held.owner.as_str(), held.epoch), ("node-a", 4));
assert!(b.acquire("alice", 1_000).await.is_err());
diff --git a/crates/openhuman-core/src/storage/mod.rs b/crates/openhuman-core/src/storage/mod.rs
index 9f0b3cd0fe..6ab4f7dbee 100644
--- a/crates/openhuman-core/src/storage/mod.rs
+++ b/crates/openhuman-core/src/storage/mod.rs
@@ -54,12 +54,12 @@ pub mod state_kv;
pub mod test_support;
pub use scope::{
- ParsedScope, Principal, Scope, Tenant, scope_for_agent, scope_for_module, scope_for_profile,
- tenant_scope,
+ scope_for_agent, scope_for_module, scope_for_profile, tenant_scope, ParsedScope, Principal,
+ Scope, Tenant,
};
use std::future::Future;
-use std::sync::{Arc, LazyLock, Mutex, OnceLock, RwLock, mpsc};
+use std::sync::{mpsc, Arc, LazyLock, Mutex, OnceLock, RwLock};
/// SQLite bindings re-exported by the storage driver crate, for the two
/// consumers that open a SQLite file that is not a storage backend: the
@@ -190,8 +190,8 @@ impl Blocking {
}
}
-use crate::config::Config;
use crate::config::schema::storage::redact_url;
+use crate::config::Config;
/// The environment variable that overrides `[storage] url`.
pub const STORAGE_URL_VAR: &str = "OPENHUMAN_STORAGE_URL";
diff --git a/crates/openhuman-core/src/storage/scope_move_tests.rs b/crates/openhuman-core/src/storage/scope_move_tests.rs
index 41c7e3a4ec..c84dcf66c6 100644
--- a/crates/openhuman-core/src/storage/scope_move_tests.rs
+++ b/crates/openhuman-core/src/storage/scope_move_tests.rs
@@ -209,20 +209,18 @@ async fn canonical_cluster_scope_import_converts_profiles_and_leases_in_place()
assert_eq!(lease.meta.expires_ms, Some(10_000));
let operator = backend.for_scope(&crate::storage::Scope::local()).unwrap();
- assert!(
- operator
- .documents()
- .get("profiles.registry", "alice")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(operator
+ .documents()
+ .get("profiles.registry", "alice")
+ .await
+ .unwrap()
+ .is_none());
}
#[cfg(feature = "legacy-import")]
#[test]
fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
- use crate::storage::layout::{Target, legacy};
+ use crate::storage::layout::{legacy, Target};
use crate::storage::{self, CollectionSpec, DocumentStoreExt, Precondition, Scope};
use tinystoragedrivers::Query;
diff --git a/crates/openhuman-rpc/src/session_store/mod.rs b/crates/openhuman-rpc/src/session_store/mod.rs
index 405fca6a10..8132ac1e58 100644
--- a/crates/openhuman-rpc/src/session_store/mod.rs
+++ b/crates/openhuman-rpc/src/session_store/mod.rs
@@ -185,8 +185,8 @@ async fn provider_for_url_with(
let backend = crate::core_host::storage::open(&url)
.await
.context("opening the configured storage backend")?;
- let recover = recover_on_open
- .unwrap_or_else(|| !crate::core_host::storage::driver_is_shared(driver));
+ let recover =
+ recover_on_open.unwrap_or_else(|| !crate::core_host::storage::driver_is_shared(driver));
let provider = ReboundSessionStores::new(Arc::clone(&backend), recover)
.context("starting the session store bridge")?;
// Only a fully working bridge makes the backend the process's storage.
diff --git a/crates/openhuman-rpc/src/session_store/mod_tests.rs b/crates/openhuman-rpc/src/session_store/mod_tests.rs
index b7fa5ece06..2fa7298d48 100644
--- a/crates/openhuman-rpc/src/session_store/mod_tests.rs
+++ b/crates/openhuman-rpc/src/session_store/mod_tests.rs
@@ -33,7 +33,10 @@ async fn a_storage_url_installs_the_driver_backed_store() {
provider.destination_key()
);
assert!(crate::core_host::storage::installed().is_some());
- assert_eq!(crate::core_host::storage::installed_url().as_deref(), Some("memory"));
+ assert_eq!(
+ crate::core_host::storage::installed_url().as_deref(),
+ Some("memory")
+ );
// Agents are kept apart in the shared backend.
let alice = provider.for_agent("alice");
alice
@@ -65,7 +68,10 @@ async fn driver_backed_store_keeps_agents_apart(url: String) {
install_for_url(Some(url.clone())).await.unwrap();
assert!(crate::core_host::storage::installed().is_some());
- assert_eq!(crate::core_host::storage::installed_url().as_deref(), Some(url.as_str()));
+ assert_eq!(
+ crate::core_host::storage::installed_url().as_deref(),
+ Some(url.as_str())
+ );
let provider = crate::core_host::agent::session_store::installed().unwrap();
let alice = provider.for_agent("alice");
alice
@@ -155,7 +161,11 @@ async fn provider_for_url_returns_the_store_without_installing_it() {
.is_some_and(|key| key.starts_with("memory://")),
"{backed_key:?}"
);
- assert_eq!(installed_url.as_deref(), Some("memory"), "the backend is installed");
+ assert_eq!(
+ installed_url.as_deref(),
+ Some("memory"),
+ "the backend is installed"
+ );
assert!(
left_uninstalled,
"the provider is handed back, not installed"