Skip to content

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

style: apply rustfmt formatting to storage layout and secret storage code

Steven Enamakel55b0f357b5e8
diff --git a/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend.rs b/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend.rs
index 710a871169..5b266610e6 100644
--- a/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend.rs
+++ b/crates/openhuman-core/src/security/secret_storage/encrypted_file_backend.rs
@@ -166,9 +166,8 @@ pub(crate) fn storage_master_key() -> Result<[u8; KEY_LEN], String> {
/// credential files only imports them when this holds, because a key minted
/// by an offline tool would not match the one the desktop later loads.
pub(crate) fn storage_master_key_resolvable() -> bool {
- let env_set = |name: &str| {
- std::env::var_os(name).is_some_and(|v| !v.to_string_lossy().trim().is_empty())
- };
+ let env_set =
+ |name: &str| std::env::var_os(name).is_some_and(|v| !v.to_string_lossy().trim().is_empty());
let dir = crate::security::secret_storage::store::workspace_dir_for_file_backend();
resolvable(
matches!(MASTER_KEY.get(), Some(Ok(Some(_)))),
diff --git a/crates/openhuman-core/src/storage/layout/credentials.rs b/crates/openhuman-core/src/storage/layout/credentials.rs
index 2ee8717cf9..58b3b404ec 100644
--- a/crates/openhuman-core/src/storage/layout/credentials.rs
+++ b/crates/openhuman-core/src/storage/layout/credentials.rs
@@ -92,9 +92,10 @@ pub async fn import(target: &Target) -> Result<Vec<String>, LayoutError> {
.set(secret, &bytes)
.await
.map_err(|e| LayoutError::Other(anyhow::anyhow!("store {file}: {e}")))?;
- let back = secrets.get(secret).await.map_err(|e| {
- LayoutError::Verify(format!("read back {file}: {e}"))
- })?;
+ let back = secrets
+ .get(secret)
+ .await
+ .map_err(|e| LayoutError::Verify(format!("read back {file}: {e}")))?;
if back.as_deref().map(|b| b.as_slice()) != Some(bytes.as_slice()) {
return Err(LayoutError::Verify(format!(
"{file} did not read back identically; refusing to delete it"
diff --git a/crates/openhuman-core/src/storage/layout/credentials_tests.rs b/crates/openhuman-core/src/storage/layout/credentials_tests.rs
index 619ecd6925..bde2bbd4c9 100644
--- a/crates/openhuman-core/src/storage/layout/credentials_tests.rs
+++ b/crates/openhuman-core/src/storage/layout/credentials_tests.rs
@@ -8,7 +8,8 @@ use std::sync::Arc;
use tinystoragedrivers::secrets::{DerivedKeys, SecretStore as _};
use zeroize::Zeroizing;
-const PROFILES: &str = r#"{"schema_version":1,"profiles":{"openai:default":{"token":"enc2:abcdef"}}}"#;
+const PROFILES: &str =
+ r#"{"schema_version":1,"profiles":{"openai:default":{"token":"enc2:abcdef"}}}"#;
const HTTP: &str = r#"{"credentials":{"gh":{"token":"enc2:012345"}}}"#;
/// A host key source holding one fixed key, so no key is ever minted.
@@ -57,7 +58,11 @@ async fn a_migration_moves_the_credential_files_into_encrypted_secrets() {
"{file} is deleted once archived"
);
assert!(report.deleted.contains(&format!("{PROFILE_PREFIX}{file}")));
- let expected = if file == PROFILES_FILENAME { PROFILES } else { HTTP };
+ let expected = if file == PROFILES_FILENAME {
+ PROFILES
+ } else {
+ HTTP
+ };
assert_eq!(stored(&fx, secret).await.unwrap(), expected.as_bytes());
}
// storage.db never holds the plaintext
diff --git a/crates/openhuman-core/src/storage/layout/run.rs b/crates/openhuman-core/src/storage/layout/run.rs
index f6a6d9da6f..696c9d5a49 100644
--- a/crates/openhuman-core/src/storage/layout/run.rs
+++ b/crates/openhuman-core/src/storage/layout/run.rs
@@ -198,8 +198,10 @@ fn dry_run(target: &Target, resuming: bool) -> Result<DryRun, LayoutError> {
None => {
let mut plan = plan::scan(&target.workspace())?;
// What the import step would copy into encrypted secrets.
- let candidates: Vec<String> =
- super::credentials::FILES.iter().map(|(f, _)| (*f).to_owned()).collect();
+ let candidates: Vec<String> = super::credentials::FILES
+ .iter()
+ .map(|(f, _)| (*f).to_owned())
+ .collect();
plan.entries
.extend(plan::scan_credentials(&target.profile_dir, &candidates));
plan.entries.sort_by(|a, b| a.path.cmp(&b.path));