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 and reorder imports

Steven Enamakel23f7ba80decd
diff --git a/crates/openhuman-core/src/desktop/notifications/store.rs b/crates/openhuman-core/src/desktop/notifications/store.rs
index c124b5a5fe..efa52d7d97 100644
--- a/crates/openhuman-core/src/desktop/notifications/store.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store.rs
@@ -708,9 +708,9 @@ pub fn get_settings(config: &Config, provider: &str) -> Result<NotificationSetti
})
}
-mod store_rows;
#[path = "store_import.rs"]
pub(super) mod import;
+mod store_rows;
use store_rows::rows_to_notifications;
#[cfg(test)]
diff --git a/crates/openhuman-core/src/integrations/task_sources/store_documents.rs b/crates/openhuman-core/src/integrations/task_sources/store_documents.rs
index 6188391488..ff70c8e180 100644
--- a/crates/openhuman-core/src/integrations/task_sources/store_documents.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/store_documents.rs
@@ -26,8 +26,8 @@ use super::store::{apply_patch, content_hash, IngestedTaskRef};
use super::types::{
FetchReason, FilterSpec, ProviderSlug, SourceTarget, TaskSource, TaskSourcePatch,
};
-use crate::integrations::composio::providers::NormalizedTask;
use crate::config::Config;
+use crate::integrations::composio::providers::NormalizedTask;
use crate::storage::documents::{compare_and_swap, text, Repo};
use crate::storage::local::{self, ImportPlan};
use crate::storage::{DocumentStoreExt, StorageError};
diff --git a/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs b/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
index 871073bac2..04851ceca8 100644
--- a/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/store_import_tests.rs
@@ -90,7 +90,13 @@ fn legacy_sources_and_ledger_are_imported_once_through_the_public_api() {
assert_eq!(got.last_status.as_deref(), Some("periodic: ok"));
assert!(live::was_ingested(&default, &first.id, "t-1").unwrap());
assert!(live::was_ingested(&default, &second.id, "t-1").unwrap());
- assert!(live::is_ingested(&default, &first.id, "t-1", &live::content_hash(&task("t-1", "First"))).unwrap());
+ assert!(live::is_ingested(
+ &default,
+ &first.id,
+ "t-1",
+ &live::content_hash(&task("t-1", "First"))
+ )
+ .unwrap());
let titles: Vec<_> = live::list_ingested(&default, &first.id, 10)
.unwrap()
.into_iter()
@@ -98,7 +104,10 @@ fn legacy_sources_and_ledger_are_imported_once_through_the_public_api() {
.collect();
assert_eq!(titles.len(), 2);
assert!(titles.contains(&"First".to_string()));
- assert_eq!(live::list_ingested_refs(&default, &first.id).unwrap().len(), 2);
+ assert_eq!(
+ live::list_ingested_refs(&default, &first.id).unwrap().len(),
+ 2
+ );
let tables = table_names(&db);
assert!(tables.contains(&"_legacy_task_sources".to_string()));
diff --git a/crates/openhuman-core/src/security/approval/store.rs b/crates/openhuman-core/src/security/approval/store.rs
index 75953ce991..f301a77eb8 100644
--- a/crates/openhuman-core/src/security/approval/store.rs
+++ b/crates/openhuman-core/src/security/approval/store.rs
@@ -208,7 +208,10 @@ pub(super) fn db_path(config: &Config) -> std::path::PathBuf {
/// Open (and migrate) the approval DB, then call `f` with a live
/// connection. Mirrors `notifications/store.rs::with_connection`.
-pub(super) fn with_connection<T>(config: &Config, f: impl FnOnce(&Connection) -> Result<T>) -> Result<T> {
+pub(super) fn with_connection<T>(
+ config: &Config,
+ f: impl FnOnce(&Connection) -> Result<T>,
+) -> Result<T> {
let db_path = db_path(config);
tracing::trace!(
@@ -740,10 +743,10 @@ fn parse_rfc3339(input: &str) -> DateTime<Utc> {
.unwrap_or_else(|_| Utc::now())
}
-#[path = "store_import.rs"]
-pub(super) mod import;
#[path = "store_agent.rs"]
mod agent_rows;
+#[path = "store_import.rs"]
+pub(super) mod import;
pub use agent_rows::{exists, list_pending_for_agent, pending_agent};
#[cfg(test)]
diff --git a/crates/openhuman-core/src/security/approval/store_agent.rs b/crates/openhuman-core/src/security/approval/store_agent.rs
index fd38e1bfdf..61ff8cfa5f 100644
--- a/crates/openhuman-core/src/security/approval/store_agent.rs
+++ b/crates/openhuman-core/src/security/approval/store_agent.rs
@@ -9,8 +9,7 @@ use super::{Config, PendingApproval};
/// Whether the approval store has been created for `config`'s workspace.
/// A configured document store always exists.
pub fn exists(config: &Config) -> bool {
- crate::storage::installed().is_some()
- || super::db_path(config).is_file()
+ crate::storage::installed().is_some() || super::db_path(config).is_file()
}
/// [`list_pending`](super::list_pending) narrowed to the rows of `agent` (see
diff --git a/crates/openhuman-core/src/security/approval/store_import_tests.rs b/crates/openhuman-core/src/security/approval/store_import_tests.rs
index 3282e1dd6b..f1355f1d21 100644
--- a/crates/openhuman-core/src/security/approval/store_import_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_import_tests.rs
@@ -63,7 +63,10 @@ fn legacy_rows_are_imported_once_through_the_public_api() {
ids.sort_unstable();
// Listing expires the stale request, as it always did.
assert_eq!(ids, ["pending-1"]);
- let first = pending.iter().find(|p| p.request_id == "pending-1").unwrap();
+ let first = pending
+ .iter()
+ .find(|p| p.request_id == "pending-1")
+ .unwrap();
assert_eq!(first.tool_name, "composio");
assert_eq!(first.action_summary, "summary pending-1");
assert_eq!(first.args_redacted["id"], "pending-1");
diff --git a/crates/openhuman-core/src/security/devices/store_documents.rs b/crates/openhuman-core/src/security/devices/store_documents.rs
index a51e5a444d..2f2ea65e7e 100644
--- a/crates/openhuman-core/src/security/devices/store_documents.rs
+++ b/crates/openhuman-core/src/security/devices/store_documents.rs
@@ -15,8 +15,8 @@ use chrono::Utc;
use serde_json::{json, Value};
use tinystoragedrivers::{CollectionSpec, Filter, IndexSpec, Precondition, Query, Sort, Versioned};
-use crate::security::devices::types::PairedDevice;
use crate::config::Config;
+use crate::security::devices::types::PairedDevice;
use crate::storage::documents::{compare_and_swap, text, Repo};
use crate::storage::local::{self, ImportPlan};
use crate::storage::DocumentStoreExt;
diff --git a/crates/openhuman-core/src/security/devices/store_import_tests.rs b/crates/openhuman-core/src/security/devices/store_import_tests.rs
index 87d6f5c995..8495469c7e 100644
--- a/crates/openhuman-core/src/security/devices/store_import_tests.rs
+++ b/crates/openhuman-core/src/security/devices/store_import_tests.rs
@@ -44,7 +44,9 @@ fn legacy_devices_are_imported_once_through_the_public_api() {
assert!(!tables.contains(&"paired_devices".to_string()));
let conn = rusqlite::Connection::open(&db).unwrap();
let kept: i64 = conn
- .query_row("SELECT COUNT(*) FROM _legacy_paired_devices", [], |r| r.get(0))
+ .query_row("SELECT COUNT(*) FROM _legacy_paired_devices", [], |r| {
+ r.get(0)
+ })
.unwrap();
assert_eq!(kept, 3);
diff --git a/crates/openhuman-core/src/storage/config_tests.rs b/crates/openhuman-core/src/storage/config_tests.rs
index c38962de54..775b600124 100644
--- a/crates/openhuman-core/src/storage/config_tests.rs
+++ b/crates/openhuman-core/src/storage/config_tests.rs
@@ -64,7 +64,9 @@ fn the_default_url_is_sqlite_on_the_workspace_directory() {
#[tokio::test]
async fn the_default_url_opens_in_directory_mode() {
let dir = tempfile::tempdir().unwrap();
- let backend = crate::storage::open(&default_url(dir.path())).await.unwrap();
+ let backend = crate::storage::open(&default_url(dir.path()))
+ .await
+ .unwrap();
assert_eq!(backend.driver(), "sqlite");
// Directory mode: a named database is its own file in the directory.
backend.database("approvals").unwrap();
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index b5f4a8fc9c..8abc3837f8 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -178,7 +178,11 @@ fn open_default(
}
if let Some(parent) = db_path.parent() {
std::fs::create_dir_all(parent).with_context(|| {
- format!("[{}] create the directory {}", plan.domain, parent.display())
+ format!(
+ "[{}] create the directory {}",
+ plan.domain,
+ parent.display()
+ )
})?;
}
let url = tinystoragedrivers::StorageConfig::parse(&format!("sqlite:{}", db_path.display()))
diff --git a/crates/openhuman-core/src/storage/local_tests.rs b/crates/openhuman-core/src/storage/local_tests.rs
index cea56e8d3a..9eacbf5653 100644
--- a/crates/openhuman-core/src/storage/local_tests.rs
+++ b/crates/openhuman-core/src/storage/local_tests.rs
@@ -28,7 +28,9 @@ fn config(url: Option<&str>) -> Config {
fn plan(path: &std::path::Path) -> Vec<ImportDoc> {
let conn = Connection::open(path).unwrap();
- let mut stmt = conn.prepare("SELECT id, n FROM old_things ORDER BY id").unwrap();
+ let mut stmt = conn
+ .prepare("SELECT id, n FROM old_things ORDER BY id")
+ .unwrap();
stmt.query_map([], |row| {
Ok(ImportDoc {
collection: "things",
diff --git a/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs b/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs
index 0d22b04452..f839f61bea 100644
--- a/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests_catalog_fixture_tests.rs
@@ -41,6 +41,7 @@ fn full_product_features_enabled() -> bool {
("runtime-node", cfg!(feature = "runtime-node")),
("hosting", cfg!(feature = "hosting")),
("tinymemes", cfg!(feature = "tinymemes")),
+ ("storage-sqlite", cfg!(feature = "storage-sqlite")),
];
let declared: std::collections::BTreeSet<_> = include_str!(concat!(
env!("CARGO_MANIFEST_DIR"),