Skip to content

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

chore(storage): reorder imports and wrap long lines

Steven Enamakel949f3ca88c5c
diff --git a/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs b/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs
index c99efe138b..f9caeeb6fb 100644
--- a/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs
+++ b/crates/openhuman-core/src/agent/harness/artifact_offload/artifact_offload_tests.rs
@@ -17,8 +17,8 @@ use std::sync::Arc;
use super::*;
use crate::security::{AutonomyLevel, SecurityPolicy, TrustedAccess, TrustedRoot};
use tinyagents_harness::artifacts::{
- ARTIFACT_POINTER_PREFIX, ArtifactKind, ArtifactPathPolicy, DEFAULT_OFFLOAD_THRESHOLD_BYTES,
- extract_artifact_paths,
+ extract_artifact_paths, ArtifactKind, ArtifactPathPolicy, ARTIFACT_POINTER_PREFIX,
+ DEFAULT_OFFLOAD_THRESHOLD_BYTES,
};
/// Policy with disjoint action/workspace roots, the shipped default layout
diff --git a/crates/openhuman-core/src/agent/multimodal.rs b/crates/openhuman-core/src/agent/multimodal.rs
index bcbd32a6df..6b22fccc69 100644
--- a/crates/openhuman-core/src/agent/multimodal.rs
+++ b/crates/openhuman-core/src/agent/multimodal.rs
@@ -14,15 +14,15 @@ use std::time::Duration;
use async_trait::async_trait;
use reqwest::Client;
-use crate::config::{MultimodalConfig, build_runtime_proxy_client_with_timeouts};
+use crate::config::{build_runtime_proxy_client_with_timeouts, MultimodalConfig};
use tinyagents_session::transcript::{TranscriptMessage, TranscriptPart};
use tinyagents_harness::multimodal::{
- BlobAttachmentStash,
config::ImageLimits,
markers,
payload::sha256_prefix,
- resolve::{TextExtractor, resolve_image},
+ resolve::{resolve_image, TextExtractor},
+ BlobAttachmentStash,
};
/// Hard upper bound on how long the `tinydocs` module may spend extracting a
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
index f6f30aa3aa..877d128f67 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/mod.rs
@@ -9,11 +9,11 @@ mod tiny_port;
mod types;
pub use ops::{
- DriverTaskCancellation, action_root_key, cancel_driver_job_by_task,
- cancel_driver_job_for_observed_session, cancel_driver_jobs_for_thread, close_if_current,
- find_reusable, list_for_parent, mark_driver_pause_cancelled, mark_failed, mark_finished,
- normalize_task_key, resolve_lifecycle_key, reuse_decision, task_title_from_prompt,
- upsert_running,
+ action_root_key, cancel_driver_job_by_task, cancel_driver_job_for_observed_session,
+ cancel_driver_jobs_for_thread, close_if_current, find_reusable, list_for_parent,
+ mark_driver_pause_cancelled, mark_failed, mark_finished, normalize_task_key,
+ resolve_lifecycle_key, reuse_decision, task_title_from_prompt, upsert_running,
+ DriverTaskCancellation,
};
pub(crate) use tiny_port::OpenHumanTinySubagentSessionStore;
pub use types::{
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
index dde83b8e15..b4df1624e4 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
@@ -29,12 +29,12 @@ use serde_json::Value;
use tinyagents_session::transcript::TranscriptMessage;
use tinystoragedrivers::{CollectionSpec, Query, Sort};
-use super::storage_schema::{SESSIONS, spec};
+use super::storage_schema::{spec, SESSIONS};
use super::types::{DurableSubagentSession, DurableSubagentStatus};
-use crate::storage::DocumentStoreExt;
use crate::storage::documents::Repo;
use crate::storage::import_state;
use crate::storage::schema_support::{key_of, ms_rfc3339, rfc3339_ms};
+use crate::storage::DocumentStoreExt;
/// The `tsd.migrations` owner of the legacy-file import.
const OWNER: &str = "subagents";
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
index 519af37a66..be659a39a7 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
@@ -68,7 +68,9 @@ fn save_upserts_sessions_and_keeps_the_others() {
#[test]
fn scopes_do_not_see_each_others_sessions() {
let storage = memory_backend();
- docs_in(storage.as_ref(), "alice").save(&[session("a")]).unwrap();
+ docs_in(storage.as_ref(), "alice")
+ .save(&[session("a")])
+ .unwrap();
assert!(docs_in(storage.as_ref(), "bob").load().unwrap().is_empty());
assert_eq!(docs_in(storage.as_ref(), "alice").load().unwrap().len(), 1);
}
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs
index e7fb3ea25b..7ad6088515 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle_storage_adoption_tests.rs
@@ -150,7 +150,8 @@ fn legacy_host_kv_pause_is_converted_without_rewriting_the_source_record() {
fn owner_file_pause_is_imported_and_the_original_bytes_stay_unchanged() {
let workspace = tempfile::tempdir().unwrap();
let key = task();
- let adapter = super::super::persistence::OpenHumanPersistence::new(workspace.path().to_path_buf());
+ let adapter =
+ super::super::persistence::OpenHumanPersistence::new(workspace.path().to_path_buf());
let file = adapter.legacy_pause_path(&key);
std::fs::create_dir_all(file.parent().unwrap()).unwrap();
let bytes = serde_json::to_vec(&paused(&key)).unwrap();
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rs
index dd25237156..c7489444c2 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops/graph_policy_tests.rs
@@ -40,7 +40,7 @@ impl<S: tracing::Subscriber> tracing_subscriber::Layer<S> for WarnLayer {
let mut message = Message(None);
event.record(&mut message);
if let Some(text) = message.0 {
- self.0.0.lock().unwrap().push(text);
+ self.0 .0.lock().unwrap().push(text);
}
}
}
diff --git a/crates/openhuman-core/src/artifacts/mod.rs b/crates/openhuman-core/src/artifacts/mod.rs
index 515bb2ccd4..5712fa5c6c 100644
--- a/crates/openhuman-core/src/artifacts/mod.rs
+++ b/crates/openhuman-core/src/artifacts/mod.rs
@@ -17,11 +17,11 @@ pub mod types;
pub mod version_documents;
pub(crate) use files::resolve_ready_file_meta;
-pub use files::{FileRoots, resolve_ready_file};
-pub use migrate::{MigrationReport, migrate_legacy_artifacts};
+pub use files::{resolve_ready_file, FileRoots};
+pub use migrate::{migrate_legacy_artifacts, MigrationReport};
pub use publisher_slot::{
- ArtifactPublisherFactory, artifact_publisher, register_artifact_publisher,
- register_artifact_publisher_in, unregister_artifact_publisher,
+ artifact_publisher, register_artifact_publisher, register_artifact_publisher_in,
+ unregister_artifact_publisher, ArtifactPublisherFactory,
};
pub use schemas::{
all_controller_schemas as all_artifacts_controller_schemas,
diff --git a/crates/openhuman-core/src/artifacts/store_documents_tests.rs b/crates/openhuman-core/src/artifacts/store_documents_tests.rs
index 2641ac5cb8..ce018bee73 100644
--- a/crates/openhuman-core/src/artifacts/store_documents_tests.rs
+++ b/crates/openhuman-core/src/artifacts/store_documents_tests.rs
@@ -66,8 +66,17 @@ fn scopes_do_not_see_each_others_artifacts() {
docs_in(storage.as_ref(), "alice")
.put_meta(&meta("a", 1, None))
.unwrap();
- assert!(docs_in(storage.as_ref(), "bob").list_meta().unwrap().is_empty());
- assert_eq!(docs_in(storage.as_ref(), "alice").list_meta().unwrap().len(), 1);
+ assert!(docs_in(storage.as_ref(), "bob")
+ .list_meta()
+ .unwrap()
+ .is_empty());
+ assert_eq!(
+ docs_in(storage.as_ref(), "alice")
+ .list_meta()
+ .unwrap()
+ .len(),
+ 1
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs b/crates/openhuman-core/src/artifacts/tiny_store_tests.rs
index 73cbcf0acb..d726beb6fc 100644
--- a/crates/openhuman-core/src/artifacts/tiny_store_tests.rs
+++ b/crates/openhuman-core/src/artifacts/tiny_store_tests.rs
@@ -154,20 +154,16 @@ async fn deleting_an_artifact_removes_its_card() {
.await
.unwrap();
let id = saved.record.id;
- assert!(
- super::super::store::get_artifact(&workspace, &id)
- .await
- .is_ok()
- );
+ assert!(super::super::store::get_artifact(&workspace, &id)
+ .await
+ .is_ok());
let (removed, notice) = artifacts.delete(&id).await.unwrap();
assert!(removed);
assert!(notice.is_none(), "{notice:?}");
- assert!(
- super::super::store::get_artifact(&workspace, &id)
- .await
- .is_err()
- );
+ assert!(super::super::store::get_artifact(&workspace, &id)
+ .await
+ .is_err());
}
struct NoopPublisher;
diff --git a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs
index 0b041f249a..54c6ba363d 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/delivery_import.rs
@@ -18,12 +18,12 @@
use std::collections::BTreeMap;
use std::path::Path;
-use crate::storage::{Scope, documents::Repo};
-use serde_json::{Value, json};
+use crate::storage::{documents::Repo, Scope};
+use serde_json::{json, Value};
use sha2::Digest;
use tinychannels_bus::module_delivery::{
- DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES, DELIVERY_RESULT_CAPACITY,
- DELIVERY_RESULT_TTL_SECONDS, DeliveryQueueEntry, DeliveryTerminalResult,
+ DeliveryQueueEntry, DeliveryTerminalResult, DELIVERY_PENDING_CAPACITY, DELIVERY_RECORD_BYTES,
+ DELIVERY_RESULT_CAPACITY, DELIVERY_RESULT_TTL_SECONDS,
};
use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition, StorageBackend};
@@ -143,10 +143,7 @@ async fn import_into(
Ok(claimed.unwrap_or(Outcome::InProgress))
}
-async fn import_payload(
- scoped: &crate::storage::Storage,
- path: &Path,
-) -> anyhow::Result<Outcome> {
+async fn import_payload(scoped: &crate::storage::Storage, path: &Path) -> anyhow::Result<Outcome> {
let bytes = match tokio::fs::read(path).await {
Ok(bytes) => bytes,
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(Outcome::NoSource),
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index 96654596a8..8215283109 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -3,9 +3,9 @@
//! Split into submodules; this module re-exports the main `Config` and all public types.
pub mod cloud_providers;
-pub use cloud_providers::{AuthStyle, CloudProviderCreds, generate_provider_id, is_slug_reserved};
+pub use cloud_providers::{generate_provider_id, is_slug_reserved, AuthStyle, CloudProviderCreds};
pub mod ephemeral_route;
-pub use ephemeral_route::{EPHEMERAL_ROUTE_SLUG, EphemeralRoute};
+pub use ephemeral_route::{EphemeralRoute, EPHEMERAL_ROUTE_SLUG};
pub mod resolved_endpoints;
pub use resolved_endpoints::ResolvedEndpoints;
mod agent;
@@ -32,7 +32,7 @@ pub use hosting::HostingConfig;
pub mod storage;
pub use storage::StorageConfig;
pub mod profile_layout;
-pub use profile_layout::{ProfileLayout, users_dir};
+pub use profile_layout::{users_dir, ProfileLayout};
mod identity_cost;
mod inbound_debounce;
pub(crate) mod load;
@@ -41,11 +41,11 @@ pub(crate) use load::source::storage_schema::collection_specs as config_storage_
#[cfg(feature = "legacy-import")]
pub(crate) use load::source::storage_schema::upgrade_records as upgrade_config_records;
pub use load::{
- PRE_LOGIN_USER_ID, action_dir_env_override, active_user_marker_path, active_workspace_dir,
+ action_dir_env_override, active_user_marker_path, active_workspace_dir,
active_workspace_dir_cached, active_workspace_snapshot, clear_active_user, default_action_dir,
default_files_dir, default_projects_dir, default_root_openhuman_dir, pre_login_user_dir,
read_active_user_id, resolve_action_dir, resolve_files_dir, user_openhuman_dir,
- write_active_user_id,
+ write_active_user_id, PRE_LOGIN_USER_ID,
};
// Crate-internal: the invalidation half of the cached active workspace. The
// marker writers in `load_user_state` call it from outside `load`; the
@@ -104,18 +104,19 @@ pub use inbound_debounce::{InboundDebounceConfig, InboundDebounceOverride};
pub use local_ai::{LocalAiConfig, LocalAiUsage};
pub use memes::MemesConfig;
pub use memory::{
- MEMORY_CORTEXDB_KEY_NAME, MemoryAgentConfig, MemoryConfig, MemoryConversationsConfig,
+ migrate_legacy_source, MemoryAgentConfig, MemoryConfig, MemoryConversationsConfig,
MemoryEngineSettings, MemoryLayoutMode, MemorySourceConfig, MemorySourceKind, RecallSettings,
- migrate_legacy_source,
+ MEMORY_CORTEXDB_KEY_NAME,
};
pub use modules::{
- MODULE_SOURCE_ENV, ModuleOverride, ModuleSourceMode, ModulesConfig, module_source_env_for,
+ module_source_env_for, ModuleOverride, ModuleSourceMode, ModulesConfig, MODULE_SOURCE_ENV,
};
pub use observability::{AgentTracingBackend, AgentTracingConfig, ObservabilityConfig};
pub use privacy::{PrivacyConfig, PrivacyMode};
pub use proxy::{
- ProxyConfig, ProxyScope, apply_runtime_proxy_to_builder, build_runtime_proxy_client,
+ apply_runtime_proxy_to_builder, build_runtime_proxy_client,
build_runtime_proxy_client_with_timeouts, runtime_proxy_config, set_runtime_proxy_config,
+ ProxyConfig, ProxyScope,
};
pub use routes::{EmbeddingRouteConfig, ModelRouteConfig};
pub use runtime::{
@@ -126,17 +127,17 @@ pub use scheduler_gate::{PauseReason, Policy, SchedulerGateConfig, SchedulerGate
pub use task_sources::TaskSourcesConfig;
pub use tokenjuice::TokenjuiceConfig;
pub use tools::{
- BrowserComputerUseConfig, BrowserConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,
- COMPOSIO_MODE_DISABLED, ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential,
- CurlConfig, GitbooksConfig, HttpHeader, HttpRequestConfig, IntegrationToggle,
- IntegrationsConfig, LegacySearchInputs, MANAGED_SEARCH_PROVIDERS, McpAuthConfig,
- McpClientConfig, McpClientIdentityConfig, McpServerConfig, McpToolExposure, MultimodalConfig,
- MultimodalFileConfig, PresentationMode, ProviderRoute, SEARCH_ENGINE_BRAVE,
- SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL,
- SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLE_ANSWER,
- SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, SEARCH_ROLES, SearchConfig, SearchEngineCredentials,
+ BrowserComputerUseConfig, BrowserConfig, ComposioConfig, ComposioDirectBaseUrls,
+ ComposioHostCredential, CurlConfig, GitbooksConfig, HttpHeader, HttpRequestConfig,
+ IntegrationToggle, IntegrationsConfig, LegacySearchInputs, McpAuthConfig, McpClientConfig,
+ McpClientIdentityConfig, McpServerConfig, McpToolExposure, MultimodalConfig,
+ MultimodalFileConfig, PresentationMode, ProviderRoute, SearchConfig, SearchEngineCredentials,
SearchHostCredential, SearchProviderSettings, SearxngConfig, SecretsConfig, SeltzConfig,
- UnknownKeyedSearchProvider, WebSearchConfig,
+ UnknownKeyedSearchProvider, WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,
+ COMPOSIO_MODE_DISABLED, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED,
+ SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT,
+ SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS,
+ SEARCH_ROLE_SEARCH,
};
pub use update::{UpdateConfig, UpdateRestartStrategy};
pub use web_chat_config::WebChatConfig;
@@ -146,8 +147,8 @@ pub mod voice_live;
pub mod voice_providers;
pub use voice_live::LiveVoiceConfig;
pub use voice_providers::{
- BUILTIN_VOICE_PROVIDERS, BuiltinVoiceProvider, VoiceCapability, VoiceProviderCreds,
- generate_voice_provider_id, is_voice_slug_reserved,
+ generate_voice_provider_id, is_voice_slug_reserved, BuiltinVoiceProvider, VoiceCapability,
+ VoiceProviderCreds, BUILTIN_VOICE_PROVIDERS,
};
mod types;
pub(crate) use types::ConfigDocumentSnapshot;
diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rs
index 9a17d89f7f..5e8be50cc1 100644
--- a/crates/openhuman-core/src/core/all.rs
+++ b/crates/openhuman-core/src/core/all.rs
@@ -12,8 +12,8 @@ use std::{
use serde_json::{Map, Value};
-use crate::core::ControllerSchema;
use crate::core::runtime::DispatchCtx;
+use crate::core::ControllerSchema;
/// A pinned, boxed future returned by a controller handler.
pub type ControllerFuture = Pin<Box<dyn Future<Output = Result<Value, String>> + Send + 'static>>;
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index a3490471ae..816f190c2d 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -142,7 +142,6 @@ struct WorkspaceBinding {
}
impl CoreContext {
-
/// The host that constructed this context (Tauri shell / CLI / Docker).
pub fn host_kind(&self) -> HostKind {
self.host_kind
diff --git a/crates/openhuman-core/src/cron/documents_port.rs b/crates/openhuman-core/src/cron/documents_port.rs
index 19707fb02d..bc04661ad6 100644
--- a/crates/openhuman-core/src/cron/documents_port.rs
+++ b/crates/openhuman-core/src/cron/documents_port.rs
@@ -24,7 +24,7 @@ use std::path::PathBuf;
use std::sync::{Arc, LazyLock};
use anyhow::{Context, Result};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinybus::Result as BusResult;
use tinyflows_bus::schedule::CallbackAddress;
use tinystoragedrivers::StorageBackend;
diff --git a/crates/openhuman-core/src/cron/documents_port_tests.rs b/crates/openhuman-core/src/cron/documents_port_tests.rs
index 35ee7a86fc..e0202d7494 100644
--- a/crates/openhuman-core/src/cron/documents_port_tests.rs
+++ b/crates/openhuman-core/src/cron/documents_port_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::storage::{Scope, StorageBackend, test_support::memory_backend};
+use crate::storage::{test_support::memory_backend, Scope, StorageBackend};
use serde_json::json;
use tinyflows_bus::schedule::{DOCUMENT_INTERFACE, DOCUMENT_METHOD};
@@ -188,12 +188,11 @@ async fn shared_schedule_records_are_owner_scoped_and_never_scanned() {
)
.await;
assert!(record.get("error").is_none(), "{record}");
- assert!(
- docs.get("tsd.counters", "cron/runs")
- .await
- .unwrap()
- .is_some()
- );
+ assert!(docs
+ .get("tsd.counters", "cron/runs")
+ .await
+ .unwrap()
+ .is_some());
let requests = [
json!({"op":"get","collection":"tsd.counters","id":"other/runs"}),
diff --git a/crates/openhuman-core/src/desktop/notifications/storage_schema.rs b/crates/openhuman-core/src/desktop/notifications/storage_schema.rs
index de715531b0..0a89f119cf 100644
--- a/crates/openhuman-core/src/desktop/notifications/storage_schema.rs
+++ b/crates/openhuman-core/src/desktop/notifications/storage_schema.rs
@@ -18,8 +18,8 @@ use serde_json::Value;
use tinystoragedrivers::{CollectionSpec, IndexSpec};
use crate::storage::schema_support::{
- Body, LegacySourceRecord as SourceRecord, LegacyTargetRecord as TargetRecord, key_of,
- key_of_parts, map_legacy_collection, time_ms,
+ key_of, key_of_parts, map_legacy_collection, time_ms, Body, LegacySourceRecord as SourceRecord,
+ LegacyTargetRecord as TargetRecord,
};
pub(super) const NOTIFICATIONS: &str = "notifications.integration";
diff --git a/crates/openhuman-core/src/desktop/notifications/store_documents.rs b/crates/openhuman-core/src/desktop/notifications/store_documents.rs
index e36034a374..3010bd8d51 100644
--- a/crates/openhuman-core/src/desktop/notifications/store_documents.rs
+++ b/crates/openhuman-core/src/desktop/notifications/store_documents.rs
@@ -31,7 +31,7 @@ use std::sync::Arc;
use anyhow::{Context, Result};
use chrono::{DateTime, Duration, Utc};
-use serde_json::{Map, Value, json};
+use serde_json::{json, Map, Value};
use sha2::{Digest, Sha256};
use tinystoragedrivers::{CollectionSpec, ErrorKind, Filter, Precondition, Query, Sort, Versioned};
@@ -40,13 +40,13 @@ use super::types::{
NotificationStatus,
};
use crate::config::Config;
-use crate::storage::documents::{Repo, compare_and_swap, text, update_or_insert};
+use crate::storage::documents::{compare_and_swap, text, update_or_insert, Repo};
use crate::storage::{DocumentStore, DocumentStoreExt, StorageError};
#[cfg(feature = "legacy-import")]
use super::storage_schema::legacy_collections;
use super::storage_schema::specs;
-pub(super) use super::storage_schema::{CORE, DEDUP, NOTIFICATIONS, SETTINGS, core_id};
+pub(super) use super::storage_schema::{core_id, CORE, DEDUP, NOTIFICATIONS, SETTINGS};
use crate::storage::schema_support::key_of;
/// The `workspace` key of core notifications in the per-workspace default
diff --git a/crates/openhuman-core/src/doctor/checks/storage.rs b/crates/openhuman-core/src/doctor/checks/storage.rs
index d9b21a7dd5..a35ab35bd6 100644
--- a/crates/openhuman-core/src/doctor/checks/storage.rs
+++ b/crates/openhuman-core/src/doctor/checks/storage.rs
@@ -116,7 +116,10 @@ async fn inspect_storage_config(check_id: &str, config: StorageConfig) -> Vec<Fi
}
fn sqlite_probe(path: &std::path::Path) -> bool {
- let file = if path.extension().is_some_and(|ext| ext == "db" || ext == "sqlite") {
+ let file = if path
+ .extension()
+ .is_some_and(|ext| ext == "db" || ext == "sqlite")
+ {
path.to_path_buf()
} else {
path.join("storage.db")
diff --git a/crates/openhuman-core/src/inbound/settings.rs b/crates/openhuman-core/src/inbound/settings.rs
index 0085fe5f8e..a00ab649ae 100644
--- a/crates/openhuman-core/src/inbound/settings.rs
+++ b/crates/openhuman-core/src/inbound/settings.rs
@@ -10,7 +10,7 @@
use std::path::Path;
use std::sync::{Arc, RwLock};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinyeventqueues_bus::storage::{SHIPPED_PIPELINE_JSON, SHIPPED_QUEUES_JSON};
use tinyeventqueues_bus::{Lane, PipelineConfig};
use tinystoragedrivers::QueueConfig;
diff --git a/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs b/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs
index 9f191ad70e..9e1d89f61f 100644
--- a/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs
+++ b/crates/openhuman-core/src/inference/schemas/claude_code_handlers.rs
@@ -6,8 +6,8 @@ use serde::Deserialize;
use serde_json::{Map, Value};
use super::{deserialize_params, to_json};
-use crate::core::Outcome;
use crate::core::all::ControllerFuture;
+use crate::core::Outcome;
#[derive(Debug, Deserialize)]
pub(super) struct InferenceClaudeCodeSetFullAccessParams {
diff --git a/crates/openhuman-core/src/inference/tokenjuice/focus.rs b/crates/openhuman-core/src/inference/tokenjuice/focus.rs
index 568c4301a5..636669d56b 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/focus.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/focus.rs
@@ -8,7 +8,7 @@
use serde_json::Value;
-use tinyjuice_bus::tools::{SUMMARY_FOCUS_ARG, summary_focus_property};
+use tinyjuice_bus::tools::{summary_focus_property, SUMMARY_FOCUS_ARG};
/// Whether a tool's parameter schema declares TinyJuice's `summary_focus`,
/// as opposed to a parameter of its own that happens to share the name.
diff --git a/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs b/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs
index 351fc7c29f..33180e7a1c 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/focus_tests.rs
@@ -33,12 +33,10 @@ fn arguments_without_a_focus_are_untouched() {
fn the_property_is_an_optional_string() {
let property = summary_focus_property();
assert_eq!(property["type"], "string");
- assert!(
- property["description"]
- .as_str()
- .unwrap()
- .contains("summarized")
- );
+ assert!(property["description"]
+ .as_str()
+ .unwrap()
+ .contains("summarized"));
}
#[test]
diff --git a/crates/openhuman-core/src/inference/tokenjuice/tools.rs b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
index 44de5738b8..e757e6e143 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/tools.rs
@@ -9,7 +9,7 @@
//! Read-only, no side effects, no path/network access.
use async_trait::async_trait;
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinytools::{PermissionLevel, Tool, ToolResult};
use {tinyjuice_bus::wire::RangeUnit, tinyjuice_bus::wire::RetrieveRange};
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
index ad4eed6b52..54bc34c774 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
@@ -25,14 +25,14 @@
use std::path::Path;
use anyhow::Result;
-use serde::Serialize;
use serde::de::DeserializeOwned;
+use serde::Serialize;
use serde_json::Value;
use tinystoragedrivers_types::{Capability, Query, StorageError};
use crate::storage::documents::Repo;
use crate::storage::import_state;
-use crate::storage::{DocumentStoreExt, Storage, state_kv::StateKv};
+use crate::storage::{state_kv::StateKv, DocumentStoreExt, Storage};
/// The `tsd.kv` owner and namespace of the state values.
const KV_OWNER: &str = "composio";
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
index 79f94d59ca..915278d137 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents_tests.rs
@@ -1,8 +1,8 @@
use super::*;
use crate::config::Config;
-use crate::storage::Scope;
use crate::storage::state_kv::StateKv;
use crate::storage::test_support::memory_backend;
+use crate::storage::Scope;
use std::collections::BTreeMap;
use std::sync::Arc;
@@ -165,10 +165,9 @@ fn the_import_marker_is_a_migrations_entry_and_stops_a_second_import() {
let storage = crate::storage::test_support::sqlite_backend().unwrap();
let docs = docs_in(&storage.backend, &Scope::local());
assert!(!docs.legacy_imported(path()).unwrap());
- assert!(
- docs.import_if_absent(path(), serde_json::json!({ "gmail": 5 }))
- .unwrap()
- );
+ assert!(docs
+ .import_if_absent(path(), serde_json::json!({ "gmail": 5 }))
+ .unwrap());
assert!(docs.legacy_imported(path()).unwrap());
let loaded: BTreeMap<String, u32> = docs.load(path()).unwrap();
assert_eq!(loaded["gmail"], 5);
diff --git a/crates/openhuman-core/src/integrations/task_sources/storage_schema.rs b/crates/openhuman-core/src/integrations/task_sources/storage_schema.rs
index d81c6b8e36..48388f489b 100644
--- a/crates/openhuman-core/src/integrations/task_sources/storage_schema.rs
+++ b/crates/openhuman-core/src/integrations/task_sources/storage_schema.rs
@@ -15,8 +15,8 @@ use serde_json::Value;
use tinystoragedrivers::{CollectionSpec, IndexSpec};
use crate::storage::schema_support::{
- Body, LegacySourceRecord as SourceRecord, LegacyTargetRecord as TargetRecord, key_of,
- key_of_parts, map_legacy_collection, time_ms,
+ key_of, key_of_parts, map_legacy_collection, time_ms, Body, LegacySourceRecord as SourceRecord,
+ LegacyTargetRecord as TargetRecord,
};
pub(super) const SOURCES: &str = "task_sources.sources";
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index d5bedcb5b4..43bd122440 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -10,21 +10,20 @@ use std::time::Duration;
use std::{
path::PathBuf,
sync::{
- Arc,
atomic::{AtomicBool, Ordering},
+ Arc,
},
};
use async_trait::async_trait;
-use serde::{Serialize, de::DeserializeOwned};
+use serde::{de::DeserializeOwned, Serialize};
use serde_json::{Map, Value};
use tinymcp_bus::{
- McpRemoteTool, ScrubStaticToolsRequest, ServerArgumentsValidation, SupervisorBatch,
- ValidateServerArgumentsRequest,
agent_tools::{McpToolPresentation, PrepareAgentToolsRequest},
client_lifecycle::{CleanupAction, ConfiguredLifecycle, Fault, Poll, Retire, Step},
config::{McpClientConfig, OpenConfiguredRequest, OpenConfiguredResponse, TransitionStatus},
- names,
+ names, McpRemoteTool, ScrubStaticToolsRequest, ServerArgumentsValidation, SupervisorBatch,
+ ValidateServerArgumentsRequest,
};
use crate::config::Config;
diff --git a/crates/openhuman-core/src/media/generation/artifact_tool.rs b/crates/openhuman-core/src/media/generation/artifact_tool.rs
index d1adab1a67..e39cf65e22 100644
--- a/crates/openhuman-core/src/media/generation/artifact_tool.rs
+++ b/crates/openhuman-core/src/media/generation/artifact_tool.rs
@@ -30,21 +30,21 @@ use std::sync::Arc;
use async_trait::async_trait;
use futures_util::StreamExt;
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinytools::{
PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolContent, ToolPolicy, ToolResult,
ToolRunContext, ToolScope, ToolTimeout,
};
use tokio::io::AsyncWriteExt;
-use crate::artifacts::ArtifactKind;
use crate::artifacts::production::Production;
+use crate::artifacts::ArtifactKind;
use crate::security::approval::ApprovalChatContext;
use crate::tools::host_extensions::tool_call_id;
use tinyagents_harness::tinyinference_video::ProgressFn;
use tinystoragedrivers_api::BlobStore;
-use super::progress::{JobStateSlot, video_status_observer};
+use super::progress::{video_status_observer, JobStateSlot};
const FILE_REFERENCE_FIELDS: [&str; 8] = [
"references",
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 8cb592421c..813013e9c3 100644
--- a/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
+++ b/crates/openhuman-core/src/media/generation/artifact_tool_tests.rs
@@ -289,12 +289,13 @@ async fn removes_partial_destination_when_blob_read_fails() {
let dest = root.path().join("partial.png");
std::fs::write(&dest, b"reserved placeholder").unwrap();
- let mut 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",
- )),
- ]));
+ let mut 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",
+ )),
+ ]));
let error = copy_blob_to_file(&mut reader, &dest, "generated-media/fail.png")
.await
.unwrap_err();
diff --git a/crates/openhuman-core/src/media/generation/tools.rs b/crates/openhuman-core/src/media/generation/tools.rs
index 983b2844aa..87d8361229 100644
--- a/crates/openhuman-core/src/media/generation/tools.rs
+++ b/crates/openhuman-core/src/media/generation/tools.rs
@@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex};
use std::time::Duration;
use async_trait::async_trait;
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinyagents_harness::media::{GenerateImageTool, GenerateVideoTool, MediaOutput};
use tinyagents_harness::tinyinference_image::ImageGenerator;
use tinyagents_harness::tinyinference_video::{VideoGenerator, WaitPolicy};
diff --git a/crates/openhuman-core/src/media/generation/tools_tests.rs b/crates/openhuman-core/src/media/generation/tools_tests.rs
index 6b676e14ef..998dab33e7 100644
--- a/crates/openhuman-core/src/media/generation/tools_tests.rs
+++ b/crates/openhuman-core/src/media/generation/tools_tests.rs
@@ -8,7 +8,7 @@ use tinyagents_harness::tinyinference_video::{MockVideoGenerator, MockVideoScrip
use tinytools::{PermissionLevel, Tool, ToolCategory};
use super::{
- IMAGE_TOOL_NAME, LIST_MODELS_TOOL_NAME, VIDEO_TOOL_NAME, media_tools_from, reference_policy,
+ media_tools_from, reference_policy, IMAGE_TOOL_NAME, LIST_MODELS_TOOL_NAME, VIDEO_TOOL_NAME,
};
use crate::media::generation::MediaGenerators;
diff --git a/crates/openhuman-core/src/modules/site_memory_host.rs b/crates/openhuman-core/src/modules/site_memory_host.rs
index f507c8037b..3deb65543e 100644
--- a/crates/openhuman-core/src/modules/site_memory_host.rs
+++ b/crates/openhuman-core/src/modules/site_memory_host.rs
@@ -20,8 +20,8 @@ use std::time::UNIX_EPOCH;
use tinybus::ObjectPath;
use tinycomputer_bus::site_memory::{
- ForgetSiteRequest, ForgetSiteResponse, INTERFACE, LoadSiteRequest, LoadSiteResponse,
- OBJECT_PATH, SaveSiteRequest, SaveSiteResponse, SiteMemory,
+ ForgetSiteRequest, ForgetSiteResponse, LoadSiteRequest, LoadSiteResponse, SaveSiteRequest,
+ SaveSiteResponse, SiteMemory, INTERFACE, OBJECT_PATH,
};
/// Largest site file read or written: anything bigger was not written here.
diff --git a/crates/openhuman-core/src/modules/site_memory_host_tests.rs b/crates/openhuman-core/src/modules/site_memory_host_tests.rs
index c3a1f15df5..c88ba44421 100644
--- a/crates/openhuman-core/src/modules/site_memory_host_tests.rs
+++ b/crates/openhuman-core/src/modules/site_memory_host_tests.rs
@@ -22,12 +22,10 @@ async fn saved_memory_loads_back_and_empty_save_removes_the_site() {
let back = store.load("example.com").await.unwrap();
assert_eq!(back, memory());
let _: &SavedHint = &back.hints[0];
- assert!(
- store
- .save("example.com", &SiteMemory::default())
- .await
- .unwrap()
- );
+ assert!(store
+ .save("example.com", &SiteMemory::default())
+ .await
+ .unwrap());
assert!(store.load("example.com").await.unwrap().is_empty());
}
diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
index 2e02a993aa..be6b3b2d81 100644
--- a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
@@ -1,5 +1,5 @@
use super::*;
-use crate::modules::storage_grants::{Denied, Object, Plan, authorize, declared};
+use crate::modules::storage_grants::{authorize, declared, Denied, Object, Plan};
use serde_json::json;
fn allowed(
diff --git a/crates/openhuman-core/src/modules/storage_host_linked_tests.rs b/crates/openhuman-core/src/modules/storage_host_linked_tests.rs
index f5e847869d..c24755db2e 100644
--- a/crates/openhuman-core/src/modules/storage_host_linked_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_host_linked_tests.rs
@@ -1,11 +1,11 @@
use super::*;
+use crate::storage::{Scope, StorageBackend, StorageError};
use async_trait::async_trait;
use serde_json::json;
use tinybus::broker::Broker;
use tinybus::transport::memory::MemoryBus;
use tinybus::{BusName, Connection};
use tinystoragedrivers::secrets::{DerivedKeys, KeyProvider};
-use crate::storage::{Scope, StorageBackend, StorageError};
use tinystoragedrivers_bus::{SecretNameRequest, SecretValue, SetSecretRequest};
use tinystoragedrivers_testkit::MemoryBackend as MemoryStorage;
use zeroize::Zeroizing;
diff --git a/crates/openhuman-core/src/modules/storage_import_support.rs b/crates/openhuman-core/src/modules/storage_import_support.rs
index 4d1edbb5d7..cfe11bcf32 100644
--- a/crates/openhuman-core/src/modules/storage_import_support.rs
+++ b/crates/openhuman-core/src/modules/storage_import_support.rs
@@ -10,7 +10,7 @@ use std::path::Path;
use std::sync::Arc;
use crate::storage::{DocumentStore, Precondition, Storage};
-use anyhow::{Result, anyhow};
+use anyhow::{anyhow, Result};
use serde_json::Value;
use sha2::Digest;
use tinystoragedrivers::ErrorKind;
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
index 858f543896..c43c2dad58 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
@@ -26,7 +26,7 @@
use std::path::Path;
use crate::storage::{CollectionSpec, Storage};
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
use serde_json::Value;
use tinystoragedrivers_types::WriteOptions;
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
index cdb44c450d..a8e4eef67e 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::storage::test_support::memory_backend;
-use crate::storage::{Precondition, Storage, scope_for_module};
+use crate::storage::{scope_for_module, Precondition, Storage};
use serde_json::json;
use sha2::Digest;
@@ -97,12 +97,11 @@ async fn preferences_and_the_trigger_archive_move_into_the_modules_storage() {
slack.doc,
json!({tinyconnectors_bus::storage::NON_OBJECT_FIELD: true})
);
- assert!(
- docs.get(PREFS_COLLECTION, "broken")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(docs
+ .get(PREFS_COLLECTION, "broken")
+ .await
+ .unwrap()
+ .is_none());
let streams = scoped.streams();
let first = streams
@@ -151,14 +150,12 @@ async fn a_second_run_is_a_noop_even_after_the_module_changed_the_data() {
.unwrap(),
Outcome::AlreadyDone
);
- assert!(
- scoped
- .documents()
- .get(PREFS_COLLECTION, "gmail")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(scoped
+ .documents()
+ .get(PREFS_COLLECTION, "gmail")
+ .await
+ .unwrap()
+ .is_none());
}
#[tokio::test]
@@ -246,14 +243,12 @@ async fn an_unreadable_preference_file_is_retried_instead_of_marked_done() {
.await
.is_err()
);
- assert!(
- scoped
- .documents()
- .get(PREFS_COLLECTION, "gmail")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(scoped
+ .documents()
+ .get(PREFS_COLLECTION, "gmail")
+ .await
+ .unwrap()
+ .is_none());
std::fs::remove_file(legacy.path().join(PREFS_DIR).join("bad.json")).unwrap();
assert!(matches!(
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs
index a5c9b35a13..7a20be01ef 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice.rs
@@ -23,7 +23,7 @@
use std::path::Path;
use std::time::{Duration, SystemTime};
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
use tinystoragedrivers_types::Capability;
use crate::storage::Storage;
diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
index 3180758755..70d9e72275 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp.rs
@@ -32,8 +32,8 @@ use std::sync::Arc;
#[cfg(test)]
use crate::storage::StorageBackend;
use crate::storage::{CollectionSpec, DocumentStore, Precondition, Storage};
-use anyhow::{Context, Result, anyhow};
-use serde_json::{Value, json};
+use anyhow::{anyhow, Context, Result};
+use serde_json::{json, Value};
use sha2::Digest;
use tinystoragedrivers::ErrorKind;
use tinystoragedrivers_api::SecretStore;
diff --git a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs
index be1d0e81fd..ae9aadb16f 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinymcp_tests.rs
@@ -2,8 +2,8 @@ use super::*;
use crate::storage::lease::LeaseStore as _;
use crate::storage::{Scope, Storage};
use std::sync::Arc;
-use tinystoragedrivers::StorageBackend;
use tinystoragedrivers::secrets::{DerivedKeys, KeyProvider, SecretStore};
+use tinystoragedrivers::StorageBackend;
use zeroize::Zeroizing;
/// The first-generation schema: no `transport`, `deployment_url`, `enabled` or
@@ -138,13 +138,12 @@ async fn servers_env_and_audit_rows_move_into_the_modules_storage() {
let env: std::collections::BTreeMap<String, String> = serde_json::from_slice(&stored).unwrap();
assert_eq!(env["API_KEY"], "sk-secret");
assert_eq!(env["REGION"], "eu");
- assert!(
- rig.secrets()
- .get("mcp_client_env/srv-2")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(rig
+ .secrets()
+ .get("mcp_client_env/srv-2")
+ .await
+ .unwrap()
+ .is_none());
let audit = scoped
.streams()
@@ -189,12 +188,10 @@ async fn the_legacy_files_are_left_untouched() {
import(&rig, legacy.path()).await.unwrap();
let after = [CLIENTS_DB, AUDIT_DB].map(|path| digest(&legacy.path().join(path)));
assert_eq!(before, after);
- assert!(
- !legacy
- .path()
- .join("mcp_clients/mcp_clients.db-wal")
- .exists()
- );
+ assert!(!legacy
+ .path()
+ .join("mcp_clients/mcp_clients.db-wal")
+ .exists());
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
index 37074e680a..218dab55e3 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinywallet.rs
@@ -23,7 +23,7 @@
use std::path::Path;
use crate::storage::Storage;
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
use super::storage_grant_schemas::tinywallet::{MODULE_ID, PAYMENTS_STREAM};
use super::storage_import_support as support;
diff --git a/crates/openhuman-core/src/platform/cost/mod.rs b/crates/openhuman-core/src/platform/cost/mod.rs
index 658c3c8750..277b14edd4 100644
--- a/crates/openhuman-core/src/platform/cost/mod.rs
+++ b/crates/openhuman-core/src/platform/cost/mod.rs
@@ -19,7 +19,7 @@ pub use global::{
init_global, rebind_global, record_embedding_usage, record_provider_usage,
record_provider_usage_scoped, seed_tenant_tracker, try_global,
};
-pub use route::{CostRoute, route_for_model};
+pub use route::{route_for_model, CostRoute};
pub use schemas::{
all_controller_schemas as all_cost_controller_schemas,
all_registered_controllers as all_cost_registered_controllers,
diff --git a/crates/openhuman-core/src/profiles/lease.rs b/crates/openhuman-core/src/profiles/lease.rs
index f03553276e..5e77c93c91 100644
--- a/crates/openhuman-core/src/profiles/lease.rs
+++ b/crates/openhuman-core/src/profiles/lease.rs
@@ -83,7 +83,10 @@ pub(crate) fn store_for(
) -> Result<Arc<dyn LeaseStore>, String> {
match backend {
Some(backend) => {
- log::info!("[profiles][lease] cluster leases on configured storage node={node} ttl_ms={}", ttl.as_millis());
+ log::info!(
+ "[profiles][lease] cluster leases on configured storage node={node} ttl_ms={}",
+ ttl.as_millis()
+ );
if !crate::storage::backend_has_cross_process_cas(backend.as_ref()) {
log::warn!("[profiles][lease] configured storage does not claim SharedAcrossProcesses: its leases exclude only this process");
}
diff --git a/crates/openhuman-core/src/profiles/mod.rs b/crates/openhuman-core/src/profiles/mod.rs
index 5d4955bfc3..6f48dfd60f 100644
--- a/crates/openhuman-core/src/profiles/mod.rs
+++ b/crates/openhuman-core/src/profiles/mod.rs
@@ -48,7 +48,7 @@ pub mod tools;
pub mod turn_gate;
pub mod types;
-pub use host::{Profile, ProfileHost, current};
+pub use host::{current, Profile, ProfileHost};
pub use layout::ProfileLayout;
pub use lease::OpenError;
pub use registry::ProfileRegistry;
diff --git a/crates/openhuman-core/src/profiles/recovery_tests.rs b/crates/openhuman-core/src/profiles/recovery_tests.rs
index d6701ae3fc..f25644f214 100644
--- a/crates/openhuman-core/src/profiles/recovery_tests.rs
+++ b/crates/openhuman-core/src/profiles/recovery_tests.rs
@@ -13,9 +13,8 @@ fn profile() -> ProfileId {
/// session store (no workspace files), as a SaaS host installs.
fn context_with_store() -> (Arc<CoreContext>, Arc<dyn SessionStoreProvider>) {
let backend = memory_backend();
- let provider: Arc<dyn SessionStoreProvider> = Arc::new(
- crate::storage::sessions::TenantSessionStores::new(backend, false).unwrap(),
- );
+ let provider: Arc<dyn SessionStoreProvider> =
+ Arc::new(crate::storage::sessions::TenantSessionStores::new(backend, false).unwrap());
let mut overrides = crate::agent::host_overrides::HostOverrides::default();
overrides.session_store = Some(Arc::clone(&provider));
let overlay = ContextOverlay::new(
diff --git a/crates/openhuman-core/src/profiles/storage_schema.rs b/crates/openhuman-core/src/profiles/storage_schema.rs
index c6d24d95bd..2ac481a359 100644
--- a/crates/openhuman-core/src/profiles/storage_schema.rs
+++ b/crates/openhuman-core/src/profiles/storage_schema.rs
@@ -17,8 +17,8 @@ use serde_json::Value;
use tinystoragedrivers::{CollectionSpec, Storage};
use crate::storage::schema_support::{
- Body, LegacySourceRecord as SourceRecord, LegacyTargetRecord as TargetRecord, key_of,
- key_of_parts, map_legacy_collection,
+ key_of, key_of_parts, map_legacy_collection, Body, LegacySourceRecord as SourceRecord,
+ LegacyTargetRecord as TargetRecord,
};
/// The v2 collection: one document per profile.
diff --git a/crates/openhuman-core/src/security/approval/storage_schema.rs b/crates/openhuman-core/src/security/approval/storage_schema.rs
index 845e89a4ed..69a48328ee 100644
--- a/crates/openhuman-core/src/security/approval/storage_schema.rs
+++ b/crates/openhuman-core/src/security/approval/storage_schema.rs
@@ -17,8 +17,8 @@ use serde_json::Value;
use tinystoragedrivers::{CollectionSpec, IndexSpec};
use crate::storage::schema_support::{
- Body, LegacySourceRecord as SourceRecord, LegacyTargetRecord as TargetRecord, key_of,
- key_of_parts, map_legacy_collection, time_ms,
+ key_of, key_of_parts, map_legacy_collection, time_ms, Body, LegacySourceRecord as SourceRecord,
+ LegacyTargetRecord as TargetRecord,
};
/// The v2 request collection: one document per request id.
diff --git a/crates/openhuman-core/src/security/approval/store_documents.rs b/crates/openhuman-core/src/security/approval/store_documents.rs
index 73226915a9..dcc095ea83 100644
--- a/crates/openhuman-core/src/security/approval/store_documents.rs
+++ b/crates/openhuman-core/src/security/approval/store_documents.rs
@@ -24,21 +24,21 @@
use std::sync::Arc;
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
use chrono::{DateTime, Utc};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use crate::config::Config;
use crate::storage::documents::compare_and_swap;
use crate::storage::local;
use crate::storage::schema_support::fresh_key;
-use crate::storage::{DocumentStore, DocumentStoreExt, Storage, StorageError, block_on};
+use crate::storage::{block_on, DocumentStore, DocumentStoreExt, Storage, StorageError};
use tinystoragedrivers::{CollectionSpec, ErrorKind, Filter, Precondition, Query, Sort, Versioned};
#[cfg(feature = "legacy-import")]
use super::storage_schema::legacy_collections;
use super::storage_schema::specs;
-pub(super) use super::storage_schema::{APPROVALS, FLOW_TRUST, trust_id};
+pub(super) use super::storage_schema::{trust_id, APPROVALS, FLOW_TRUST};
use super::types::{
ApprovalAuditEntry, ApprovalDecision, ApprovalSourceContext, ExecutionOutcome, PendingApproval,
diff --git a/crates/openhuman-core/src/security/secret_storage/adapter_tests.rs b/crates/openhuman-core/src/security/secret_storage/adapter_tests.rs
index d4b85220d5..187849efff 100644
--- a/crates/openhuman-core/src/security/secret_storage/adapter_tests.rs
+++ b/crates/openhuman-core/src/security/secret_storage/adapter_tests.rs
@@ -8,14 +8,23 @@ use tinystoragedrivers::secrets::crypto;
const KEY: [u8; 32] = [7; 32];
fn secrets_tempdir() -> tempfile::TempDir {
- #[cfg(target_os = "macos")]
- {
- tempfile::tempdir_in("/private/tmp").expect("canonical macOS temp directory")
- }
- #[cfg(not(target_os = "macos"))]
+ let dir = {
+ #[cfg(target_os = "macos")]
+ {
+ tempfile::tempdir_in("/private/tmp").expect("canonical macOS temp directory")
+ }
+ #[cfg(not(target_os = "macos"))]
+ {
+ tempfile::tempdir().expect("tempdir")
+ }
+ };
+ #[cfg(unix)]
{
- tempfile::tempdir().expect("tempdir")
+ use std::os::unix::fs::PermissionsExt;
+ std::fs::set_permissions(dir.path(), std::fs::Permissions::from_mode(0o700))
+ .expect("make secret fixture directory private");
}
+ dir
}
fn write_private_file(path: &std::path::Path, bytes: &[u8]) {
diff --git a/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend_tests.rs b/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend_tests.rs
index c78fb21284..81527b98c1 100644
--- a/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend_tests.rs
+++ b/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend_tests.rs
@@ -2,14 +2,23 @@ use super::*;
use std::collections::HashMap;
fn secrets_tempdir() -> tempfile::TempDir {
- #[cfg(target_os = "macos")]
- {
- tempfile::tempdir_in("/private/tmp").expect("canonical macOS temp directory")
- }
- #[cfg(not(target_os = "macos"))]
+ let dir = {
+ #[cfg(target_os = "macos")]
+ {
+ tempfile::tempdir_in("/private/tmp").expect("canonical macOS temp directory")
+ }
+ #[cfg(not(target_os = "macos"))]
+ {
+ tempfile::tempdir().expect("tempdir")
+ }
+ };
+ #[cfg(unix)]
{
- tempfile::tempdir().expect("tempdir")
+ use std::os::unix::fs::PermissionsExt;
+ std::fs::set_permissions(dir.path(), std::fs::Permissions::from_mode(0o700))
+ .expect("make secret fixture directory private");
}
+ dir
}
fn legacy_secret_map() -> HashMap<String, String> {
diff --git a/crates/openhuman-core/src/security/secret_storage/ops_adoption_tests.rs b/crates/openhuman-core/src/security/secret_storage/ops_adoption_tests.rs
index 84a2ebbfea..a1f9b5950c 100644
--- a/crates/openhuman-core/src/security/secret_storage/ops_adoption_tests.rs
+++ b/crates/openhuman-core/src/security/secret_storage/ops_adoption_tests.rs
@@ -102,9 +102,12 @@ fn adopted_secrets_do_not_cross_scopes() {
let os = MockBackend::new();
os.set("u:k", "v").unwrap();
let storage = memory_backend();
- get_adopting(storage_secrets_in(storage.as_ref(), "alice"), "u:k", "k", || {
- os.get("u:k").ok().flatten()
- })
+ get_adopting(
+ storage_secrets_in(storage.as_ref(), "alice"),
+ "u:k",
+ "k",
+ || os.get("u:k").ok().flatten(),
+ )
.unwrap();
let other = storage_secrets_in(storage.as_ref(), "bob");
assert_eq!(
diff --git a/crates/openhuman-core/src/skills/run_log.rs b/crates/openhuman-core/src/skills/run_log.rs
index 8db6ccd070..b29ce90484 100644
--- a/crates/openhuman-core/src/skills/run_log.rs
+++ b/crates/openhuman-core/src/skills/run_log.rs
@@ -23,7 +23,7 @@ use tokio_util::sync::CancellationToken;
use crate::progress::AgentProgress;
use crate::storage::StorageError;
-pub use tinyskills::run_log::{RunLogSlice, RunOutcome, detect_repeated_line};
+pub use tinyskills::run_log::{detect_repeated_line, RunLogSlice, RunOutcome};
use tinyskills::run_log::{parse_runs, parse_terminal_outcome, short, truncate};
type RunLogStore = tinyskills_drivers::StreamRunLogStore;
diff --git a/crates/openhuman-core/src/skills/run_log_tests.rs b/crates/openhuman-core/src/skills/run_log_tests.rs
index 234ee6a386..2d67ac8695 100644
--- a/crates/openhuman-core/src/skills/run_log_tests.rs
+++ b/crates/openhuman-core/src/skills/run_log_tests.rs
@@ -16,21 +16,17 @@ fn run_cancel_registry_roundtrip() {
#[test]
fn noisy_events_are_skipped_steps_are_kept() {
- assert!(
- format_event(&AgentProgress::TextDelta {
- delta: "hi".into(),
- iteration: 1
- })
- .is_none()
- );
+ assert!(format_event(&AgentProgress::TextDelta {
+ delta: "hi".into(),
+ iteration: 1
+ })
+ .is_none());
// Content (prompt/reply) rides its own event and is never logged here.
- assert!(
- format_event(&AgentProgress::TurnContent {
- input: Some("secret prompt".into()),
- output: Some("secret reply".into()),
- })
- .is_none()
- );
+ assert!(format_event(&AgentProgress::TurnContent {
+ input: Some("secret prompt".into()),
+ output: Some("secret reply".into()),
+ })
+ .is_none());
let line = format_event(&AgentProgress::ToolCallStarted {
call_id: "c1".into(),
tool_name: "memory_search".into(),
diff --git a/crates/openhuman-core/src/storage/agents.rs b/crates/openhuman-core/src/storage/agents.rs
index 53d2d6bf71..94cd568d8c 100644
--- a/crates/openhuman-core/src/storage/agents.rs
+++ b/crates/openhuman-core/src/storage/agents.rs
@@ -28,11 +28,11 @@ use std::collections::{BTreeMap, HashSet};
use std::future::Future;
use std::sync::{Arc, LazyLock, Mutex};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use tinystoragedrivers::{CollectionSpec, Precondition, Query};
use super::schema_support::key_of;
-use super::{DocumentStoreExt, StorageBackend, block_on, installed};
+use super::{block_on, installed, DocumentStoreExt, StorageBackend};
use crate::core::runtime::{AgentContextRegistry, CoreContext, DispatchCtx};
/// The `local`-scope collection recording which agents have their own scope.
diff --git a/crates/openhuman-core/src/storage/agents_tests.rs b/crates/openhuman-core/src/storage/agents_tests.rs
index edf97d48d3..0ed391184b 100644
--- a/crates/openhuman-core/src/storage/agents_tests.rs
+++ b/crates/openhuman-core/src/storage/agents_tests.rs
@@ -120,12 +120,10 @@ fn reset_recorded_empties_the_cache() {
let backend = memory_backend();
record_in(Arc::clone(&backend), "agents-test-reset");
reset_recorded();
- assert!(
- !RECORDED
- .lock()
- .unwrap()
- .contains(&(backend_key(&backend), "agents-test-reset".to_string()))
- );
+ assert!(!RECORDED
+ .lock()
+ .unwrap()
+ .contains(&(backend_key(&backend), "agents-test-reset".to_string())));
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/storage/blob_sweep.rs b/crates/openhuman-core/src/storage/blob_sweep.rs
index c985a86c55..01b320cef9 100644
--- a/crates/openhuman-core/src/storage/blob_sweep.rs
+++ b/crates/openhuman-core/src/storage/blob_sweep.rs
@@ -17,8 +17,8 @@ use std::time::Duration;
use tinystoragedrivers::{Scope, StorageBackend};
use tinystoragedrivers_api::BlobStore;
use tinystoragedrivers_types::{
- BlobListPage, MAX_BLOB_LIST_PAGE_ITEMS, Result as StorageResult, SEALED_BLOB_PREFIX,
- StorageError, is_reserved_blob_key,
+ is_reserved_blob_key, BlobListPage, Result as StorageResult, StorageError,
+ MAX_BLOB_LIST_PAGE_ITEMS, SEALED_BLOB_PREFIX,
};
/// How often the sweeper wakes. Lapsed blobs are already invisible to readers,
diff --git a/crates/openhuman-core/src/storage/blob_sweep_tests.rs b/crates/openhuman-core/src/storage/blob_sweep_tests.rs
index 78c33c5ef8..23c0cc691e 100644
--- a/crates/openhuman-core/src/storage/blob_sweep_tests.rs
+++ b/crates/openhuman-core/src/storage/blob_sweep_tests.rs
@@ -226,7 +226,12 @@ impl StorageBackend for HungSweep {
async fn a_hung_scope_sweep_times_out_and_counts_as_zero() {
let inner = backend_with_clock();
let hung = HungSweep(inner);
- let removed = sweep_scope_within(&hung, &Scope::new("local").unwrap(), Duration::from_secs(30)).await;
+ let removed = sweep_scope_within(
+ &hung,
+ &Scope::new("local").unwrap(),
+ Duration::from_secs(30),
+ )
+ .await;
assert_eq!(removed, 0);
}
diff --git a/crates/openhuman-core/src/storage/config.rs b/crates/openhuman-core/src/storage/config.rs
index 7ef6a48ec6..e5f5b424cc 100644
--- a/crates/openhuman-core/src/storage/config.rs
+++ b/crates/openhuman-core/src/storage/config.rs
@@ -26,8 +26,8 @@
use std::path::Path;
-use crate::config::Config;
use crate::config::schema::profile_layout::{LayoutVersion, ProfileLayout};
+use crate::config::Config;
/// The directory under the workspace the v1 default backend lives in.
pub const DEFAULT_DIR: &str = "storage";
diff --git a/crates/openhuman-core/src/storage/documents.rs b/crates/openhuman-core/src/storage/documents.rs
index 0b494a9c9e..bc85ce177a 100644
--- a/crates/openhuman-core/src/storage/documents.rs
+++ b/crates/openhuman-core/src/storage/documents.rs
@@ -12,13 +12,13 @@ use std::collections::HashMap;
use std::future::Future;
use std::sync::{Arc, LazyLock, Mutex, PoisonError, Weak};
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
use serde_json::Value;
use tinystoragedrivers::WriteCondition;
use tinystoragedrivers::{CollectionSpec, ErrorKind, Precondition, Versioned};
use super::{
- DocumentStore, Scope, Storage, StorageBackend, StorageError, block_on, current_scope, installed,
+ block_on, current_scope, installed, DocumentStore, Scope, Storage, StorageBackend, StorageError,
};
/// Collections already declared, per process: `(backend address, scope,
diff --git a/crates/openhuman-core/src/storage/documents_tests.rs b/crates/openhuman-core/src/storage/documents_tests.rs
index 54fc178571..18012dae43 100644
--- a/crates/openhuman-core/src/storage/documents_tests.rs
+++ b/crates/openhuman-core/src/storage/documents_tests.rs
@@ -186,10 +186,9 @@ fn one_time_work_runs_once_per_backend_and_scope_and_retries_failures() {
};
let first = backend();
let repo = repo_on(&first, "once");
- assert!(
- repo.once_per_backend("k", || Err(anyhow::anyhow!("boom")))
- .is_err()
- );
+ assert!(repo
+ .once_per_backend("k", || Err(anyhow::anyhow!("boom")))
+ .is_err());
repo.once_per_backend("k", count).unwrap();
repo.once_per_backend("k", count).unwrap();
assert_eq!(runs.get(), 1, "a failure is retried, a success is recorded");
diff --git a/crates/openhuman-core/src/storage/fence.rs b/crates/openhuman-core/src/storage/fence.rs
index 786de7cb55..6a50ef819a 100644
--- a/crates/openhuman-core/src/storage/fence.rs
+++ b/crates/openhuman-core/src/storage/fence.rs
@@ -59,8 +59,8 @@ use std::sync::{Arc, LazyLock, Mutex, PoisonError, Weak};
use tinystoragedrivers_types::WriteCondition;
-use super::StorageError;
use super::lease::LeaseStore;
+use super::StorageError;
/// Why a fenced write was refused.
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
diff --git a/crates/openhuman-core/src/storage/fenced_ports.rs b/crates/openhuman-core/src/storage/fenced_ports.rs
index 36b831c972..863965476c 100644
--- a/crates/openhuman-core/src/storage/fenced_ports.rs
+++ b/crates/openhuman-core/src/storage/fenced_ports.rs
@@ -20,8 +20,8 @@ use tinystoragedrivers_types::{
};
use super::{
- StorageError,
fence::{FenceRegistry, LeaseFence},
+ StorageError,
};
fn check(fence: &LeaseFence, clock: &FenceRegistry) -> Result<()> {
diff --git a/crates/openhuman-core/src/storage/import/layout_db_tests.rs b/crates/openhuman-core/src/storage/import/layout_db_tests.rs
index cdb47bc62b..2ca8d863af 100644
--- a/crates/openhuman-core/src/storage/import/layout_db_tests.rs
+++ b/crates/openhuman-core/src/storage/import/layout_db_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::storage::layout::test_fixtures::{fixture_docs, v1_profile};
-use crate::storage::layout::{Target, legacy};
+use crate::storage::layout::{legacy, Target};
use tempfile::TempDir;
#[test]
diff --git a/crates/openhuman-core/src/storage/import/mod.rs b/crates/openhuman-core/src/storage/import/mod.rs
index bfe21e887a..eeeedfd53a 100644
--- a/crates/openhuman-core/src/storage/import/mod.rs
+++ b/crates/openhuman-core/src/storage/import/mod.rs
@@ -77,20 +77,20 @@ use std::sync::Arc;
use anyhow::Result;
#[cfg(feature = "legacy-import")]
-use anyhow::{Context, anyhow};
+use anyhow::{anyhow, Context};
#[cfg(feature = "legacy-import")]
use sha2::Digest;
use tinystoragedrivers::CollectionSpec;
#[cfg(feature = "legacy-import")]
use tinystoragedrivers::{ErrorKind, Precondition, WriteOptions};
-use super::StorageBackend;
#[cfg(feature = "legacy-import")]
use super::block_on;
#[cfg(feature = "legacy-import")]
use super::documents::Repo;
#[cfg(feature = "legacy-import")]
use super::rusqlite;
+use super::StorageBackend;
use crate::config::Config;
#[cfg(feature = "legacy-import")]
use rusqlite::Connection;
@@ -288,9 +288,7 @@ pub fn run_all(backend: &Arc<dyn StorageBackend>, config: &Config) -> Vec<Report
let mut reports = run_with(backend, config, &sources());
reports.extend(tinyflows::run_with(backend, config));
reports.extend(sessions::run_with(backend, config));
- reports.push(crate::storage::scope_move::run_from_config(
- backend, config,
- ));
+ reports.push(crate::storage::scope_move::run_from_config(backend, config));
reports
}
diff --git a/crates/openhuman-core/src/storage/import/mod_tests.rs b/crates/openhuman-core/src/storage/import/mod_tests.rs
index 724ad15572..8a891b84c2 100644
--- a/crates/openhuman-core/src/storage/import/mod_tests.rs
+++ b/crates/openhuman-core/src/storage/import/mod_tests.rs
@@ -2,7 +2,7 @@
use super::*;
use crate::storage::rusqlite;
-use crate::storage::test_support::{SqliteBackend, sqlite_backend};
+use crate::storage::test_support::{sqlite_backend, SqliteBackend};
#[path = "profile_fixture_tests.rs"]
mod profile_fixture_tests;
@@ -253,7 +253,7 @@ fn a_marker_row_an_older_build_wrote_counts_as_a_finished_import() {
#[cfg(feature = "storage-sqlite")]
#[tokio::test(flavor = "multi_thread")]
async fn historical_profile_fixture_conversation_survives_layout_copy_and_owner_migration() {
- use crate::storage::layout::{Target, db};
+ use crate::storage::layout::{db, Target};
use crate::storage::{self, Scope};
use tinyagents_session::threads::{ConversationPersistence, DriverConversationStore};
use tinyagents_storage_kit::{MigrateOptions, Registry, ScopedStorage};
@@ -351,18 +351,16 @@ fn processes_importing_one_workspace_at_once_import_it_once() {
.filter(|o| matches!(o, Outcome::Imported { .. }))
.count();
assert_eq!(imports, 1, "exactly one process imports: {outcomes:?}");
- assert!(
- outcomes
- .iter()
- .all(|o| !matches!(o, Outcome::Imported { .. })
- || matches!(
- o,
- Outcome::Imported {
- found: 20,
- written: 20
- }
- ))
- );
+ assert!(outcomes
+ .iter()
+ .all(|o| !matches!(o, Outcome::Imported { .. })
+ || matches!(
+ o,
+ Outcome::Imported {
+ found: 20,
+ written: 20
+ }
+ )));
assert!(is_done(&backend, &config, &source).unwrap());
assert_eq!(dump(&backend, &source, "devices.paired").len(), 20);
}
@@ -530,11 +528,9 @@ async fn without_an_installed_backend_the_host_import_does_nothing() {
legacy_device(&config, "chan-a", "Phone", false);
assert!(crate::storage::installed().is_none());
- assert!(
- run(&crate::core::runtime::DispatchCtx::unbound(), &config)
- .await
- .is_empty()
- );
+ assert!(run(&crate::core::runtime::DispatchCtx::unbound(), &config)
+ .await
+ .is_empty());
}
#[test]
diff --git a/crates/openhuman-core/src/storage/import/profile_fixture_tests.rs b/crates/openhuman-core/src/storage/import/profile_fixture_tests.rs
index d08902ca31..735e0739bc 100644
--- a/crates/openhuman-core/src/storage/import/profile_fixture_tests.rs
+++ b/crates/openhuman-core/src/storage/import/profile_fixture_tests.rs
@@ -3,7 +3,7 @@ use super::*;
#[tokio::test(flavor = "multi_thread")]
async fn historical_profile_fixture_boots_into_typed_owner_records_without_resurrection() {
use crate::profiles::{ProfileId, ProfileRegistry};
- use crate::storage::layout::{Target, legacy};
+ use crate::storage::layout::{legacy, Target};
use crate::storage::{self, Scope};
use tinystoragedrivers::Query;
@@ -124,11 +124,10 @@ async fn historical_profile_fixture_boots_into_typed_owner_records_without_resur
assert_eq!(cost.len(), 1);
let mut cost_body = cost[0].doc.clone();
let cost_ms = cost_body["ts_ms"].as_i64().unwrap();
- cost_body["usage"]["timestamp"] = serde_json::json!(
- chrono::DateTime::from_timestamp_millis(cost_ms)
+ cost_body["usage"]["timestamp"] =
+ serde_json::json!(chrono::DateTime::from_timestamp_millis(cost_ms)
.unwrap()
- .to_rfc3339()
- );
+ .to_rfc3339());
let cost_record: crate::platform::cost::types::CostRecord =
serde_json::from_value(cost_body).unwrap();
assert_eq!(cost_record.id, "cost-0001");
@@ -141,11 +140,10 @@ async fn historical_profile_fixture_boots_into_typed_owner_records_without_resur
assert_eq!(artifact.len(), 1);
let mut artifact_body = artifact[0].doc.clone();
let created_ms = artifact_body["created_ms"].as_i64().unwrap();
- artifact_body["created_at"] = serde_json::json!(
- chrono::DateTime::from_timestamp_millis(created_ms)
+ artifact_body["created_at"] =
+ serde_json::json!(chrono::DateTime::from_timestamp_millis(created_ms)
.unwrap()
- .to_rfc3339()
- );
+ .to_rfc3339());
let artifact_meta: crate::artifacts::types::ArtifactMeta =
serde_json::from_value(artifact_body).unwrap();
assert_eq!(artifact_meta.id, "artifact-1");
diff --git a/crates/openhuman-core/src/storage/import/schemas.rs b/crates/openhuman-core/src/storage/import/schemas.rs
index b3114aff7c..66cb2187fe 100644
--- a/crates/openhuman-core/src/storage/import/schemas.rs
+++ b/crates/openhuman-core/src/storage/import/schemas.rs
@@ -3,10 +3,10 @@
use crate::core::runtime::DispatchCtx;
use serde::Deserialize;
-use serde_json::{Map, Value, json};
+use serde_json::{json, Map, Value};
-use crate::core::Outcome;
use crate::core::all::{ControllerFuture, RegisteredController};
+use crate::core::Outcome;
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
#[derive(Debug, Deserialize, Default)]
diff --git a/crates/openhuman-core/src/storage/import/scope_move.rs b/crates/openhuman-core/src/storage/import/scope_move.rs
index 421dc70c12..c7af393689 100644
--- a/crates/openhuman-core/src/storage/import/scope_move.rs
+++ b/crates/openhuman-core/src/storage/import/scope_move.rs
@@ -9,7 +9,7 @@ use std::collections::HashSet;
use std::path::Path;
use crate::storage::rusqlite::{self, Connection, OpenFlags};
-use anyhow::{Context, Result, bail};
+use anyhow::{bail, Context, Result};
use serde_json::Value;
use tinystoragedrivers::Meta;
diff --git a/crates/openhuman-core/src/storage/import/session_db.rs b/crates/openhuman-core/src/storage/import/session_db.rs
index f50428c278..56c2090e42 100644
--- a/crates/openhuman-core/src/storage/import/session_db.rs
+++ b/crates/openhuman-core/src/storage/import/session_db.rs
@@ -6,9 +6,9 @@
use std::path::Path;
-use anyhow::{Context, Result, bail};
+use anyhow::{bail, Context, Result};
use serde::de::DeserializeOwned;
-use serde_json::{Map, Number, Value, json};
+use serde_json::{json, Map, Number, Value};
use tinyagents_session::run_ledger::tool_effects::{ToolEffectRow, ToolEffectStatus};
use tinyagents_session::run_ledger::{
AgentRun, AgentTeam, AgentTeamMember, AgentTeamTask, RunEvent, RunTelemetry, WorkflowRun,
diff --git a/crates/openhuman-core/src/storage/import/session_db_tests.rs b/crates/openhuman-core/src/storage/import/session_db_tests.rs
index 46f0ca3b4f..e43bc11d48 100644
--- a/crates/openhuman-core/src/storage/import/session_db_tests.rs
+++ b/crates/openhuman-core/src/storage/import/session_db_tests.rs
@@ -2,7 +2,7 @@ use super::*;
use std::path::Path;
-use crate::storage::rusqlite::{Connection, params};
+use crate::storage::rusqlite::{params, Connection};
fn classic_session_file(path: &Path) {
let connection = Connection::open(path).unwrap();
@@ -124,9 +124,7 @@ fn rejects_a_database_without_classic_session_tables() {
let error = SessionDatabase::read(&path).unwrap_err();
- assert!(
- error
- .to_string()
- .contains("none of the classic session database tables")
- );
+ assert!(error
+ .to_string()
+ .contains("none of the classic session database tables"));
}
diff --git a/crates/openhuman-core/src/storage/import/sessions.rs b/crates/openhuman-core/src/storage/import/sessions.rs
index 557414b019..7ab60863f1 100644
--- a/crates/openhuman-core/src/storage/import/sessions.rs
+++ b/crates/openhuman-core/src/storage/import/sessions.rs
@@ -32,21 +32,21 @@ use std::path::{Path, PathBuf};
use std::sync::Arc;
use anyhow::{Context, Result};
-use tinyagents_session::DriverSessionStores;
use tinyagents_session::port::{SessionStoreProvider, TurnStates};
use tinyagents_session::run_ledger::RunLedgerStore;
use tinyagents_session::run_ledger::{ImportCounts, LegacyDatabaseReport, LegacySessionImport};
use tinyagents_session::transcript::{
- DisplayMessage, DisplayRecord, SessionRef, TranscriptHistory, TranscriptMessage,
- TranscriptMeta, TranscriptPartial, TranscriptTurn, decode_transcript_jsonl, session_stem,
+ decode_transcript_jsonl, session_stem, DisplayMessage, DisplayRecord, SessionRef,
+ TranscriptHistory, TranscriptMessage, TranscriptMeta, TranscriptPartial, TranscriptTurn,
};
use tinyagents_session::turn_state::TurnState;
+use tinyagents_session::DriverSessionStores;
use super::tinyflows::{finish, marked};
use super::{Outcome, Report, Snapshot};
use crate::config::Config;
-use crate::storage::StorageBackend;
use crate::storage::sessions::DEFAULT_AGENT;
+use crate::storage::StorageBackend;
/// The marker name of the session import.
pub const SESSIONS_DOMAIN: &str = "sessions";
diff --git a/crates/openhuman-core/src/storage/import/tinyflows.rs b/crates/openhuman-core/src/storage/import/tinyflows.rs
index 376f2fbf6c..67c72eb918 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows.rs
@@ -27,7 +27,7 @@ use std::sync::{LazyLock, Mutex, Weak};
use anyhow::{Context, Result};
-use super::{MARKER_OWNER, Outcome, Report, marker_spec, marker_step};
+use super::{marker_spec, marker_step, Outcome, Report, MARKER_OWNER};
use crate::config::Config;
use crate::storage::documents::Repo;
use crate::storage::import_state;
diff --git a/crates/openhuman-core/src/storage/import/tinyflows_reader/flow_reader.rs b/crates/openhuman-core/src/storage/import/tinyflows_reader/flow_reader.rs
index abfe4b32ef..3989529f1c 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows_reader/flow_reader.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows_reader/flow_reader.rs
@@ -11,7 +11,7 @@ use tinyflows_bus::catalog::{
MAX_IMPORT_RECORD_PAYLOAD_BYTES,
};
-use super::legacy_db::{LegacyDb, column_or};
+use super::legacy_db::{column_or, LegacyDb};
/// Reads legacy flow database rows and draft files as bounded ordered batches.
///
@@ -120,9 +120,9 @@ async fn page_rows<T, ToRecord, F, Fut>(
what: &'static str,
query: &str,
decode: impl Fn(&crate::storage::rusqlite::Row<'_>) -> crate::storage::rusqlite::Result<T>
- + Send
- + Sync
- + 'static,
+ + Send
+ + Sync
+ + 'static,
to_record: ToRecord,
batches: &mut BatchSender,
send: &mut F,
diff --git a/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_cron.rs b/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_cron.rs
index 91c49084f4..a07016a216 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_cron.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows_reader/legacy_cron.rs
@@ -14,7 +14,7 @@
use std::collections::HashSet;
use std::path::Path;
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
use chrono::{DateTime, Utc};
use std::collections::HashMap;
use tinyflows_bus::schedule::types::{
@@ -22,7 +22,7 @@ use tinyflows_bus::schedule::types::{
SessionTarget,
};
-use super::legacy_db::{LegacyDb, column_or};
+use super::legacy_db::{column_or, LegacyDb};
use super::report::ImportReport;
/// What `jobs.db` held, decoded.
diff --git a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
index bd57522b33..a68a113147 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs
@@ -1,16 +1,16 @@
use super::*;
use crate::cron::client::testing as cron_store;
+use crate::storage::test_support::{sqlite_backend, SqliteBackend};
use crate::storage::Scope;
-use crate::storage::test_support::{SqliteBackend, sqlite_backend};
-use serde_json::Value;
use serde_json::json;
+use serde_json::Value;
use sha2::Digest;
use std::collections::BTreeMap;
use std::ops::Deref;
use tempfile::TempDir;
use tinyflows::engine::Checkpointer;
-use tinyflows_drivers::DriverCheckpointer;
use tinyflows_drivers::catalog::FlowCatalogDocuments;
+use tinyflows_drivers::DriverCheckpointer;
fn fixtures() -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR")).join("src/storage/import/fixtures/tinyflows")
@@ -535,22 +535,18 @@ async fn catalog_and_schedule_owner_migrations_cover_existing_scopes() {
for scope in [Scope::local(), profile] {
let scoped = backend.for_scope(&scope).unwrap();
- assert!(
- scoped
- .documents()
- .get("flows.definitions", "missing")
- .await
- .unwrap()
- .is_none()
- );
- assert!(
- scoped
- .documents()
- .get("cron.jobs", "missing")
- .await
- .unwrap()
- .is_none()
- );
+ assert!(scoped
+ .documents()
+ .get("flows.definitions", "missing")
+ .await
+ .unwrap()
+ .is_none());
+ assert!(scoped
+ .documents()
+ .get("cron.jobs", "missing")
+ .await
+ .unwrap()
+ .is_none());
}
}
diff --git a/crates/openhuman-core/src/storage/import_state.rs b/crates/openhuman-core/src/storage/import_state.rs
index c439513f1e..cc9d978452 100644
--- a/crates/openhuman-core/src/storage/import_state.rs
+++ b/crates/openhuman-core/src/storage/import_state.rs
@@ -14,7 +14,7 @@ use tinystoragedrivers::{
StorageBackend, StorageError, Versioned, WriteCondition, WriteOp,
};
-use super::{DocumentStoreExt, documents::Repo};
+use super::{documents::Repo, DocumentStoreExt};
/// How long a claim blocks other processes before it can be taken over.
pub const CLAIM_TTL_MS: i64 = 10 * 60 * 1000;
diff --git a/crates/openhuman-core/src/storage/journal_maintenance.rs b/crates/openhuman-core/src/storage/journal_maintenance.rs
index 3d47ba95ce..945552f3c2 100644
--- a/crates/openhuman-core/src/storage/journal_maintenance.rs
+++ b/crates/openhuman-core/src/storage/journal_maintenance.rs
@@ -277,8 +277,8 @@ async fn maintain_scope(
/// by another host. Cluster scope is intentionally excluded: harness run
/// journals have historically been tenant/local data, not cluster data.
#[cfg(test)]
-fn known_scopes()
--> Result<(Vec<Arc<crate::profiles::Profile>>, Vec<Scope>), crate::storage::StorageError> {
+fn known_scopes(
+) -> Result<(Vec<Arc<crate::profiles::Profile>>, Vec<Scope>), crate::storage::StorageError> {
let mut scopes = BTreeSet::new();
if !crate::core::runtime::mode::is_saas() {
scopes.insert(Scope::local());
diff --git a/crates/openhuman-core/src/storage/layout/credentials.rs b/crates/openhuman-core/src/storage/layout/credentials.rs
index f1c0f18e73..3a3eb35b25 100644
--- a/crates/openhuman-core/src/storage/layout/credentials.rs
+++ b/crates/openhuman-core/src/storage/layout/credentials.rs
@@ -21,9 +21,9 @@ use std::path::Path;
#[cfg(feature = "legacy-import")]
use tinystoragedrivers::secrets::SecretStore as _;
+use super::state::LayoutError;
#[cfg(feature = "legacy-import")]
use super::Target;
-use super::state::LayoutError;
use crate::security::credentials::http_creds::{self, STORAGE_SECRET_NAME, STORE_FILENAME};
use crate::security::credentials::profiles::{self, PROFILES_FILENAME, PROFILES_SECRET_NAME};
#[cfg(feature = "legacy-import")]
diff --git a/crates/openhuman-core/src/storage/layout/credentials_tests.rs b/crates/openhuman-core/src/storage/layout/credentials_tests.rs
index 8c93253a37..e4e8499d88 100644
--- a/crates/openhuman-core/src/storage/layout/credentials_tests.rs
+++ b/crates/openhuman-core/src/storage/layout/credentials_tests.rs
@@ -1,9 +1,9 @@
use super::*;
use crate::security::secret_storage::{
- MasterKeySource, SecretStorageError, clear_master_key_source, install_master_key_source,
+ clear_master_key_source, install_master_key_source, MasterKeySource, SecretStorageError,
};
-use crate::storage::layout::test_fixtures::{Fixture, v1_profile, write};
-use crate::storage::layout::{Options, Outcome, migrate, restore};
+use crate::storage::layout::test_fixtures::{v1_profile, write, Fixture};
+use crate::storage::layout::{migrate, restore, Options, Outcome};
use std::sync::Arc;
use tinystoragedrivers::secrets::DerivedKeys;
use zeroize::Zeroizing;
diff --git a/crates/openhuman-core/src/storage/layout/db.rs b/crates/openhuman-core/src/storage/layout/db.rs
index 4f4ac45686..ac49f061d6 100644
--- a/crates/openhuman-core/src/storage/layout/db.rs
+++ b/crates/openhuman-core/src/storage/layout/db.rs
@@ -4,4 +4,4 @@
//! the `legacy-import` feature. Layout migration code depends on this narrow
//! wrapper and does not open or query SQLite itself.
-pub use crate::storage::import::layout_db::{Counts, DbCopy, checkpoint, copy, table_counts};
+pub use crate::storage::import::layout_db::{checkpoint, copy, table_counts, Counts, DbCopy};
diff --git a/crates/openhuman-core/src/storage/layout/legacy_tests.rs b/crates/openhuman-core/src/storage/layout/legacy_tests.rs
index 36467ab966..11ebdeeabd 100644
--- a/crates/openhuman-core/src/storage/layout/legacy_tests.rs
+++ b/crates/openhuman-core/src/storage/layout/legacy_tests.rs
@@ -4,10 +4,12 @@ use crate::storage::layout::test_fixtures::{fixture_docs, v1_profile};
#[tokio::test(flavor = "multi_thread")]
async fn the_import_brings_legacy_files_into_the_v1_database() {
let fx = v1_profile();
- let summary = import(&fx.target, &fx.config).await.unwrap_or_else(|error| {
- eprintln!("profile legacy import failed: {error:#}");
- panic!("profile legacy import did not complete");
- });
+ let summary = import(&fx.target, &fx.config)
+ .await
+ .unwrap_or_else(|error| {
+ eprintln!("profile legacy import failed: {error:#}");
+ panic!("profile legacy import did not complete");
+ });
assert_eq!(summary.memory_state, vec!["jobs".to_owned()]);
assert!(
summary.domains >= 3,
diff --git a/crates/openhuman-core/src/storage/layout/mod.rs b/crates/openhuman-core/src/storage/layout/mod.rs
index c17a26b4b1..cec9162abe 100644
--- a/crates/openhuman-core/src/storage/layout/mod.rs
+++ b/crates/openhuman-core/src/storage/layout/mod.rs
@@ -57,15 +57,15 @@ use std::path::{Path, PathBuf};
use serde::Serialize;
#[cfg(feature = "legacy-import")]
-pub use run::{Options, auto_migrate, migrate, restore};
+pub use run::{auto_migrate, migrate, restore, Options};
pub use state::{LayoutError, Step};
#[cfg(feature = "legacy-import")]
-pub use status::{Status, status};
+pub use status::{status, Status};
-use crate::config::Config;
use crate::config::schema::profile_layout::{
PROFILE_FILES_DIR, PROFILE_STORAGE_FILE, PROFILE_WORKSPACE_DIR,
};
+use crate::config::Config;
/// Directory under the root that holds the archives.
pub const BACKUPS_DIR: &str = "backups";
diff --git a/crates/openhuman-core/src/storage/layout/plan_tests.rs b/crates/openhuman-core/src/storage/layout/plan_tests.rs
index c351f88897..b78fd97b25 100644
--- a/crates/openhuman-core/src/storage/layout/plan_tests.rs
+++ b/crates/openhuman-core/src/storage/layout/plan_tests.rs
@@ -67,12 +67,10 @@ fn scan_classifies_a_v1_workspace_and_totals_it() {
#[test]
fn a_missing_workspace_is_an_empty_plan() {
let dir = tempfile::TempDir::new().unwrap();
- assert!(
- scan(&dir.path().join("workspace"))
- .unwrap()
- .entries
- .is_empty()
- );
+ assert!(scan(&dir.path().join("workspace"))
+ .unwrap()
+ .entries
+ .is_empty());
}
#[test]
diff --git a/crates/openhuman-core/src/storage/layout/run.rs b/crates/openhuman-core/src/storage/layout/run.rs
index 6f444a1124..bd7c53f6ef 100644
--- a/crates/openhuman-core/src/storage/layout/run.rs
+++ b/crates/openhuman-core/src/storage/layout/run.rs
@@ -5,9 +5,9 @@ use std::path::{Path, PathBuf};
use super::archive::{self, Source};
use super::plan::{self, Action, Plan};
use super::state::{LayoutError, LayoutState, Lock, Step};
-use super::{DryRun, Noop, Outcome, Report, Target, db, legacy};
-use crate::config::Config;
+use super::{db, legacy, DryRun, Noop, Outcome, Report, Target};
use crate::config::schema::profile_layout::{LayoutVersion, PROFILE_LAYOUT_MARKER};
+use crate::config::Config;
/// How a migration runs.
#[derive(Debug, Clone, Default)]
diff --git a/crates/openhuman-core/src/storage/layout/run_tests.rs b/crates/openhuman-core/src/storage/layout/run_tests.rs
index 05a6c52609..080ea6d1b6 100644
--- a/crates/openhuman-core/src/storage/layout/run_tests.rs
+++ b/crates/openhuman-core/src/storage/layout/run_tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::storage::layout::state::STATE_FILE;
-use crate::storage::layout::test_fixtures::{Fixture, fixture_docs, tree, v1_profile, write};
+use crate::storage::layout::test_fixtures::{fixture_docs, tree, v1_profile, write, Fixture};
fn opts() -> Options {
Options::default()
@@ -107,11 +107,9 @@ fn assert_migrated(fx: &Fixture) {
] {
assert!(paths.contains(&want), "{want} not archived: {paths:?}");
}
- assert!(
- !paths
- .iter()
- .any(|p| p.contains("mystery") || p.contains("notes.tmp"))
- );
+ assert!(!paths
+ .iter()
+ .any(|p| p.contains("mystery") || p.contains("notes.tmp")));
// the config layer now reads it as v2
let layout = crate::config::schema::ProfileLayout::resolve_at(profile.clone());
assert_eq!(
diff --git a/crates/openhuman-core/src/storage/layout/schemas.rs b/crates/openhuman-core/src/storage/layout/schemas.rs
index c248311e13..d7fec8253d 100644
--- a/crates/openhuman-core/src/storage/layout/schemas.rs
+++ b/crates/openhuman-core/src/storage/layout/schemas.rs
@@ -5,7 +5,7 @@
use serde_json::{Map, Value};
-use super::{Options, Target, migrate, restore, status};
+use super::{migrate, restore, status, Options, Target};
use crate::core::all::{ControllerFuture, RegisteredController};
use crate::core::runtime::DispatchCtx;
use crate::core::{ControllerSchema, FieldSchema, TypeSchema};
diff --git a/crates/openhuman-core/src/storage/layout/schemas_tests.rs b/crates/openhuman-core/src/storage/layout/schemas_tests.rs
index 5c99792414..94eeda7166 100644
--- a/crates/openhuman-core/src/storage/layout/schemas_tests.rs
+++ b/crates/openhuman-core/src/storage/layout/schemas_tests.rs
@@ -15,17 +15,13 @@ fn the_three_controllers_are_registered_under_storage() {
]
);
assert_eq!(all_controller_schemas().len(), 3);
- assert!(
- schemas("restore")
- .inputs
- .iter()
- .any(|f| f.name == "archive" && f.required)
- );
- assert!(
- schemas("migrate")
- .inputs
- .iter()
- .any(|f| f.name == "dry_run" && !f.required)
- );
+ assert!(schemas("restore")
+ .inputs
+ .iter()
+ .any(|f| f.name == "archive" && f.required));
+ assert!(schemas("migrate")
+ .inputs
+ .iter()
+ .any(|f| f.name == "dry_run" && !f.required));
assert_eq!(schemas("nope").function, "unknown");
}
diff --git a/crates/openhuman-core/src/storage/layout/status.rs b/crates/openhuman-core/src/storage/layout/status.rs
index 0a941ab653..4919940827 100644
--- a/crates/openhuman-core/src/storage/layout/status.rs
+++ b/crates/openhuman-core/src/storage/layout/status.rs
@@ -3,9 +3,9 @@
use serde::{Deserialize, Serialize};
use super::state::{LayoutError, LayoutState, Step};
-use super::{Target, legacy};
-use crate::config::Config;
+use super::{legacy, Target};
use crate::config::schema::profile_layout::LayoutVersion;
+use crate::config::Config;
/// The schema version one owner has reached in the profile's database.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
diff --git a/crates/openhuman-core/src/storage/layout/test_fixtures.rs b/crates/openhuman-core/src/storage/layout/test_fixtures.rs
index c7b0678170..d7962a16b8 100644
--- a/crates/openhuman-core/src/storage/layout/test_fixtures.rs
+++ b/crates/openhuman-core/src/storage/layout/test_fixtures.rs
@@ -7,7 +7,7 @@ use std::path::Path;
use sha2::Digest;
use tempfile::TempDir;
-use super::{Target, legacy};
+use super::{legacy, Target};
use crate::config::Config;
use crate::storage::{self, DocumentStoreExt, Precondition, Scope};
diff --git a/crates/openhuman-core/src/storage/lease_documents.rs b/crates/openhuman-core/src/storage/lease_documents.rs
index 0f9d3c6ed7..cdc9a432df 100644
--- a/crates/openhuman-core/src/storage/lease_documents.rs
+++ b/crates/openhuman-core/src/storage/lease_documents.rs
@@ -14,10 +14,10 @@ use tinystoragedrivers_types::{
Filter, Scope as DriverScope, Version, Versioned, WriteCondition, WriteOptions,
};
-use super::StorageError;
use super::lease::{
- CLUSTER_SCOPE, LEASE_COLLECTION, LeaseError, LeaseGrant, LeaseRecord, LeaseStore, validate_key,
+ validate_key, LeaseError, LeaseGrant, LeaseRecord, LeaseStore, CLUSTER_SCOPE, LEASE_COLLECTION,
};
+use super::StorageError;
/// The owner namespace of the host's process-placement lease documents.
pub const LEASE_OWNER: &str = "profiles";
@@ -403,13 +403,23 @@ impl LeaseStore for DocumentLeases {
async fn holder_readonly(&self, key: &str) -> Result<Option<LeaseRecord>, LeaseError> {
validate_key(key)?;
- match self.docs.validate_collection_spec(&CollectionSpec::new(LEASE_COLLECTION)).await {
+ match self
+ .docs
+ .validate_collection_spec(&CollectionSpec::new(LEASE_COLLECTION))
+ .await
+ {
Ok(()) => {}
Err(error) if error.kind() == ErrorKind::NotFound => {
- match self.docs.validate_collection_spec(&CollectionSpec::new("leases")).await {
- Ok(()) => return Err(LeaseError::Storage(StorageError::backend(
- "legacy profile leases require explicit storage migration",
- ))),
+ match self
+ .docs
+ .validate_collection_spec(&CollectionSpec::new("leases"))
+ .await
+ {
+ Ok(()) => {
+ return Err(LeaseError::Storage(StorageError::backend(
+ "legacy profile leases require explicit storage migration",
+ )))
+ }
Err(error) if error.kind() == ErrorKind::NotFound => return Ok(None),
Err(error) => return Err(LeaseError::Storage(error.into())),
}
diff --git a/crates/openhuman-core/src/storage/lease_documents_tests.rs b/crates/openhuman-core/src/storage/lease_documents_tests.rs
index 73bcc3abf8..a47b8dc0ad 100644
--- a/crates/openhuman-core/src/storage/lease_documents_tests.rs
+++ b/crates/openhuman-core/src/storage/lease_documents_tests.rs
@@ -4,8 +4,8 @@ use super::*;
use std::time::Duration;
-use crate::storage::test_support::SqliteBackend;
use crate::storage::test_support::memory_backend;
+use crate::storage::test_support::SqliteBackend;
use tinystoragedrivers_types::{CollectionSpec, Precondition, Scope};
const TTL: Duration = Duration::from_millis(1_000);
@@ -29,13 +29,15 @@ async fn doctor_holder_inspection_does_not_declare_the_lease_collection() {
.unwrap();
let spec = CollectionSpec::new(LEASE_COLLECTION);
- assert!(documents.documents()
+ assert!(documents
+ .documents()
.validate_collection_spec(&spec)
.await
.is_err());
assert!(leases.holder_readonly("alice").await.unwrap().is_none());
assert!(
- documents.documents()
+ documents
+ .documents()
.validate_collection_spec(&spec)
.await
.is_err(),
diff --git a/crates/openhuman-core/src/storage/lease_local.rs b/crates/openhuman-core/src/storage/lease_local.rs
index 0a2fbbf140..0ae5ac188d 100644
--- a/crates/openhuman-core/src/storage/lease_local.rs
+++ b/crates/openhuman-core/src/storage/lease_local.rs
@@ -25,8 +25,8 @@ use async_trait::async_trait;
use fs2::FileExt;
use tinystoragedrivers::Version;
+use super::lease::{local_dir, validate_key, LeaseError, LeaseGrant, LeaseRecord, LeaseStore};
use super::StorageError;
-use super::lease::{LeaseError, LeaseGrant, LeaseRecord, LeaseStore, local_dir, validate_key};
const LOCK_FILE: &str = ".lease";
const RECORD_FILE: &str = ".lease.json";
diff --git a/crates/openhuman-core/src/storage/local.rs b/crates/openhuman-core/src/storage/local.rs
index e459f6f426..dcb01f8494 100644
--- a/crates/openhuman-core/src/storage/local.rs
+++ b/crates/openhuman-core/src/storage/local.rs
@@ -21,9 +21,9 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::{Arc, LazyLock, Mutex, PoisonError};
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
-use super::{Scope, Storage, StorageBackend, current_scope, installed};
+use super::{current_scope, installed, Scope, Storage, StorageBackend};
/// A backend and the scope a store's records live under in it.
#[derive(Clone)]
diff --git a/crates/openhuman-core/src/storage/rebind.rs b/crates/openhuman-core/src/storage/rebind.rs
index a9858ed728..36ea57fd9d 100644
--- a/crates/openhuman-core/src/storage/rebind.rs
+++ b/crates/openhuman-core/src/storage/rebind.rs
@@ -21,8 +21,8 @@ use std::sync::Arc;
use anyhow::{Context, Result};
-use super::StorageBackend;
use super::import;
+use super::StorageBackend;
use crate::config::Config;
/// What a rebind did.
diff --git a/crates/openhuman-core/src/storage/scope_move.rs b/crates/openhuman-core/src/storage/scope_move.rs
index ecdbedde16..51a31b30ea 100644
--- a/crates/openhuman-core/src/storage/scope_move.rs
+++ b/crates/openhuman-core/src/storage/scope_move.rs
@@ -151,9 +151,9 @@ pub struct MoveReport {
#[path = "scope_move_boot.rs"]
mod boot;
+pub use boot::run_from_config;
#[cfg(test)]
pub(crate) use boot::IMPORT_DOMAIN;
-pub use boot::run_from_config;
/// Copies the rows in a source inventory to their mapped v2 scopes.
///
diff --git a/crates/openhuman-core/src/storage/scope_tests.rs b/crates/openhuman-core/src/storage/scope_tests.rs
index 14d36825de..96a8b6daf8 100644
--- a/crates/openhuman-core/src/storage/scope_tests.rs
+++ b/crates/openhuman-core/src/storage/scope_tests.rs
@@ -52,9 +52,7 @@ fn hashed_segments_use_the_stable_lowercase_base32_alphabet() {
let segment = first.as_str().strip_prefix("u:~").unwrap();
assert_eq!(segment.len(), 26);
assert_eq!(segment, "sxpjfw7gwtcgocxriok7rbxl7t");
- assert!(
- segment
- .bytes()
- .all(|byte| byte.is_ascii_lowercase() || (b'2'..=b'7').contains(&byte))
- );
+ assert!(segment
+ .bytes()
+ .all(|byte| byte.is_ascii_lowercase() || (b'2'..=b'7').contains(&byte)));
}
diff --git a/crates/openhuman-core/src/storage/secrets.rs b/crates/openhuman-core/src/storage/secrets.rs
index de65b2f34f..4fa587a80f 100644
--- a/crates/openhuman-core/src/storage/secrets.rs
+++ b/crates/openhuman-core/src/storage/secrets.rs
@@ -21,7 +21,7 @@ use std::sync::{Arc, OnceLock};
use tinystoragedrivers::secrets::{DerivedKeys, DocumentSecrets, KeyProvider};
use zeroize::Zeroizing;
-use super::{Scope, Storage, StorageError, current_scope, current_scoped};
+use super::{current_scope, current_scoped, Scope, Storage, StorageError};
/// The key provider every scope's secrets use, built once per process.
pub(crate) fn keys() -> Result<Arc<dyn KeyProvider>, StorageError> {
diff --git a/crates/openhuman-core/src/storage/sessions/mod.rs b/crates/openhuman-core/src/storage/sessions/mod.rs
index 280fe74272..8fdef7bb4c 100644
--- a/crates/openhuman-core/src/storage/sessions/mod.rs
+++ b/crates/openhuman-core/src/storage/sessions/mod.rs
@@ -22,13 +22,13 @@ mod rebound;
mod tenant_router;
mod workspace;
-pub use rebound::{ReboundSessionStores, StoreRegistry, rebind_all};
+pub use rebound::{rebind_all, ReboundSessionStores, StoreRegistry};
pub use tenant_router::TenantSessionStores;
pub use workspace::{
- WorkspaceSessionStores, artifact_blobs_for, attachment_stash_for, current_documents_for,
- default_turn_states_for, ledger_for, provider_for_workspace, release_workspace,
- release_workspace_defaults, require_ledger, session_scope, status_store_for, stores_for,
- stores_or_ephemeral, turn_states_for, with_ledger, with_ledger_async,
+ artifact_blobs_for, attachment_stash_for, current_documents_for, default_turn_states_for,
+ ledger_for, provider_for_workspace, release_workspace, release_workspace_defaults,
+ require_ledger, session_scope, status_store_for, stores_for, stores_or_ephemeral,
+ turn_states_for, with_ledger, with_ledger_async, WorkspaceSessionStores,
};
static PROVIDER: LazyLock<RwLock<Option<Arc<dyn SessionStoreProvider>>>> =
diff --git a/crates/openhuman-core/src/storage/state_kv_tests.rs b/crates/openhuman-core/src/storage/state_kv_tests.rs
index d5824b2b26..0538d3fb71 100644
--- a/crates/openhuman-core/src/storage/state_kv_tests.rs
+++ b/crates/openhuman-core/src/storage/state_kv_tests.rs
@@ -260,13 +260,8 @@ fn typed_quarantine_validation_is_cached_per_backend_scope_name_and_type() {
std::fs::write(&second_legacy, r#"{"ok":true}"#).unwrap();
let backend = crate::storage::test_support::sqlite_backend().unwrap();
- let local = StateKv::on_backend(
- &backend.backend,
- &Scope::local(),
- "test_owner",
- "state",
- )
- .unwrap();
+ let local =
+ StateKv::on_backend(&backend.backend, &Scope::local(), "test_owner", "state").unwrap();
local
.import_file_quarantining::<CountedA>("first", &first_legacy)
.unwrap();
diff --git a/crates/openhuman-core/src/threads/store/legacy_import.rs b/crates/openhuman-core/src/threads/store/legacy_import.rs
index 2032a064eb..0ec1c38361 100644
--- a/crates/openhuman-core/src/threads/store/legacy_import.rs
+++ b/crates/openhuman-core/src/threads/store/legacy_import.rs
@@ -11,7 +11,7 @@
use std::collections::BTreeMap;
use std::path::Path;
-use anyhow::{Context, Result, anyhow};
+use anyhow::{anyhow, Context, Result};
use serde::Deserialize;
use sha2::{Digest, Sha256};
use tinyagents_session::threads::{
diff --git a/crates/openhuman-core/src/threads/store/mod.rs b/crates/openhuman-core/src/threads/store/mod.rs
index 7d65da2ddb..2cb13e3ae0 100644
--- a/crates/openhuman-core/src/threads/store/mod.rs
+++ b/crates/openhuman-core/src/threads/store/mod.rs
@@ -71,15 +71,15 @@ impl From<types::ConversationPurgeStats> for ConversationPurgeStats {
pub(crate) use bus::claim_channel_turn;
pub use bus::register_conversation_persistence_subscriber;
pub use store::{
- ConversationStore, append_message, delete_messages_from, delete_thread, ensure_thread,
- list_threads, purge_threads, update_message, update_thread_labels, update_thread_title,
- update_thread_working_dir,
+ append_message, delete_messages_from, delete_thread, ensure_thread, list_threads,
+ purge_threads, update_message, update_thread_labels, update_thread_title,
+ update_thread_working_dir, ConversationStore,
};
pub(crate) use transcript_key::bind_transcript_key;
pub use types::{
- ConversationThread, CreateConversationThread, CrossThreadHit,
- ThreadMessage as ConversationMessage, ThreadMessagePatch as ConversationMessagePatch,
- is_deterministic_message_id, reply_run_id, run_reply_message_id,
+ is_deterministic_message_id, reply_run_id, run_reply_message_id, ConversationThread,
+ CreateConversationThread, CrossThreadHit, ThreadMessage as ConversationMessage,
+ ThreadMessagePatch as ConversationMessagePatch,
};
/// A thread's messages without artifact rows. Artifact rows place artifact
diff --git a/tests/storage_desktop_upgrade_e2e.rs b/tests/storage_desktop_upgrade_e2e.rs
index 73f883ed08..5f04b01a20 100644
--- a/tests/storage_desktop_upgrade_e2e.rs
+++ b/tests/storage_desktop_upgrade_e2e.rs
@@ -23,9 +23,9 @@ use std::time::{Duration, SystemTime};
use openhuman_core::config::Config;
use openhuman_core::storage::import::{self, Outcome};
-use openhuman_core::storage::{DocumentStoreExt, Scope, Storage, StorageBackend, rusqlite};
+use openhuman_core::storage::{rusqlite, DocumentStoreExt, Scope, Storage, StorageBackend};
use sha2::Digest;
-use tinyagents_session::transcript::{SessionRef, TranscriptMessage, TranscriptMeta, session_stem};
+use tinyagents_session::transcript::{session_stem, SessionRef, TranscriptMessage, TranscriptMeta};
use tinyagents_session::turn_state::TurnState;
use tinystoragedrivers::Query;
diff --git a/tests/storage_legacy_profile_boot_e2e.rs b/tests/storage_legacy_profile_boot_e2e.rs
index 8e89a78f0a..454477941c 100644
--- a/tests/storage_legacy_profile_boot_e2e.rs
+++ b/tests/storage_legacy_profile_boot_e2e.rs
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
use std::process::{Child, Command, Stdio};
use std::time::{Duration, Instant};
-use serde_json::{Value, json};
+use serde_json::{json, Value};
use sha2::{Digest, Sha256};
use tinystoragedrivers::secrets::DerivedKeys;
use zeroize::Zeroizing;