The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(storage): cover dry-run import listing and richer credential fixtures
Steven Enamakel59d69e53c000
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.rsindex 52acb7737a..6e180650d8 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@@ -174,7 +174,8 @@ pub(crate) fn storage_master_key_resolvable() -> bool {env_set(MASTER_KEY_ENV) || env_set(MASTER_KEY_FILE_ENV),// A host source counts only when it already holds the key: an empty// one would have a key minted into it by the load.- key_source::installed_master_key_source().is_some_and(|source| matches!(source.load(), Ok(Some(_)))),+ key_source::installed_master_key_source()+ .is_some_and(|source| matches!(source.load(), Ok(Some(_)))),dir.join("keyring/master.key").is_file(),)}diff --git a/crates/openhuman-core/src/storage/layout/credentials_tests.rs b/crates/openhuman-core/src/storage/layout/credentials_tests.rsindex cf1162e808..aca0fecc20 100644--- a/crates/openhuman-core/src/storage/layout/credentials_tests.rs+++ b/crates/openhuman-core/src/storage/layout/credentials_tests.rs@@ -8,9 +8,8 @@ use std::sync::Arc;use tinystoragedrivers::secrets::DerivedKeys;use zeroize::Zeroizing;-const PROFILES: &str =- r#"{"schema_version":1,"profiles":{"openai:default":{"token":"enc2:abcdef"}}}"#;-const HTTP: &str = r#"{"credentials":{"gh":{"token":"enc2:012345"}}}"#;+const PROFILES: &str = r#"{"schema_version":1,"updated_at":"2026-01-01T00:00:00Z","active_profiles":{},"profiles":{"openai:default":{"provider":"openai","profile_name":"default","kind":"token","token":"enc2:abcdef"}}}"#;+const HTTP: &str = r#"{"schema_version":1,"updated_at":"2026-01-01T00:00:00Z","credentials":{"gh":{"scheme":"bearer","secret":"enc2:012345","created_at":"2026-01-01T00:00:00Z","updated_at":"2026-01-01T00:00:00Z"}}}"#;/// A host key source holding one fixed key, so no key is ever minted.struct FixedKey;@@ -69,6 +68,7 @@ async fn a_migration_moves_the_credential_files_into_encrypted_secrets() {let db = std::fs::read(fx.target.storage_db()).unwrap();assert!(!db.windows(11).any(|w| w == b"openai:defa"));assert!(!db.windows(6).any(|w| w == b"\"gh\":{"));+ assert!(!db.windows(11).any(|w| w == b"enc2:abcdef"));// the archive keeps them and a restore puts them back beside config.tomlrestore(&fx.target, &report.archive).await.unwrap();@@ -125,16 +125,16 @@ async fn a_record_already_on_the_backend_wins_over_a_stale_file() {}#[tokio::test(flavor = "current_thread")]-async fn a_file_that_is_not_json_is_left_in_place() {+async fn a_file_that_is_not_a_credential_document_is_left_in_place() {install_master_key_source(Arc::new(FixedKey));let fx = v1_profile();- write(&fx.target.profile_dir.join(PROFILES_FILENAME), "not json");+ write(&fx.target.profile_dir.join(PROFILES_FILENAME), "[]");write(&fx.target.profile_dir.join(STORE_FILENAME), HTTP);run(&fx).await.unwrap();clear_master_key_source();assert_eq!(std::fs::read_to_string(fx.target.profile_dir.join(PROFILES_FILENAME)).unwrap(),- "not json"+ "[]");assert!(!fx.target.profile_dir.join(STORE_FILENAME).exists());}@@ -156,3 +156,26 @@ fn the_secret_names_match_the_stores_that_read_them() {assert_eq!(PROFILES_FILENAME, "auth-profiles.json");assert_eq!(STORE_FILENAME, "http-credentials.json");}++#[tokio::test(flavor = "current_thread")]+async fn the_dry_run_lists_only_the_files_the_run_would_import() {+ install_master_key_source(Arc::new(FixedKey));+ let fx = v1_profile();+ write(&fx.target.profile_dir.join(PROFILES_FILENAME), "not json");+ write(&fx.target.profile_dir.join(STORE_FILENAME), HTTP);+ let options = Options {+ dry_run: true,+ ..Options::default()+ };+ let Outcome::DryRun(plan) = migrate(&fx.target, &fx.config, &options).await.unwrap() else {+ panic!("expected a dry run");+ };+ clear_master_key_source();+ let listed: Vec<_> = plan+ .delete_entries+ .iter()+ .map(|e| e.path.as_str())+ .collect();+ assert!(listed.contains(&"@profile/http-credentials.json"));+ assert!(!listed.contains(&"@profile/auth-profiles.json"));+}