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
chore(tests): add missing test coverage for runtime and profiles
Steven Enamakelbf8bd5d5890c
diff --git a/crates/openhuman-core/src/core/runtime/saas_tests.rs b/crates/openhuman-core/src/core/runtime/saas_tests.rsindex 72db43a2e4..6356d75d7a 100644--- a/crates/openhuman-core/src/core/runtime/saas_tests.rs+++ b/crates/openhuman-core/src/core/runtime/saas_tests.rs@@ -235,3 +235,20 @@ fn reads_the_operators_cron_limits() {assert!(cron.agent_jobs_only);assert_eq!((cron.min_interval_secs, cron.max_active_jobs), (300, 5));}++#[test]+fn debug_output_redacts_the_storage_url() {+ let mut config = SaasConfig::new("/srv/oh");+ config.storage_url = Some("mongodb://admin:[email protected]/oh".into());+ let shown = format!("{config:?}");+ assert!(!shown.contains("hunter2") && !shown.contains("db.internal"), "{shown}");+ assert!(shown.contains("<redacted>"));+ assert!(!format!("{:?}", SaasConfig::new("/srv/oh")).contains("<redacted>"));+}++#[test]+fn reads_the_tool_iteration_cap() {+ let config: SaasConfig = toml::from_str("root = \"/srv/oh\"\nmax_tool_iterations = 4\n").unwrap();+ assert_eq!(config.max_tool_iterations, Some(4));+ assert_eq!(SaasConfig::new("/srv/oh").max_tool_iterations, None);+}diff --git a/crates/openhuman-core/src/profiles/host_tests.rs b/crates/openhuman-core/src/profiles/host_tests.rsindex 69334d918c..8aafdcd552 100644--- a/crates/openhuman-core/src/profiles/host_tests.rs+++ b/crates/openhuman-core/src/profiles/host_tests.rs@@ -355,6 +355,26 @@ async fn a_profile_with_a_live_turn_is_not_evicted() {host.open(&b).await.unwrap();}+#[tokio::test]+async fn the_operators_iteration_cap_binds_every_profile_whatever_its_config_says() {+ let tmp = tempfile::tempdir().unwrap();+ let mut saas = SaasConfig::new(tmp.path());+ saas.max_tool_iterations = Some(4);+ let host = ProfileHost::new(saas, CoreContext::for_test(DomainSet::full(), None));+ let id = profile("alice");+ host.provision(&id).await.unwrap();+ let layout = ProfileLayout::new(tmp.path(), &id);+ std::fs::write(+ &layout.config_path,+ "[agent]\nmax_tool_iterations_override = 99\n",+ )+ .unwrap();+ let forced = host.provisioned_config(&id).await.unwrap();+ let opened = host.open(&id).await.unwrap();+ assert_eq!(forced.agent.max_tool_iterations_override, Some(4));+ assert_eq!(opened.config.agent.max_tool_iterations_override, Some(4));+}+#[tokio::test]async fn the_operators_cron_limits_bind_every_profile_whatever_its_config_says() {let tmp = tempfile::tempdir().unwrap();diff --git a/crates/openhuman-core/src/profiles/tools_tests.rs b/crates/openhuman-core/src/profiles/tools_tests.rsindex 004f2242da..465bb79bf8 100644--- a/crates/openhuman-core/src/profiles/tools_tests.rs+++ b/crates/openhuman-core/src/profiles/tools_tests.rs@@ -184,3 +184,12 @@ fn a_missing_sandbox_is_refused() {let action = root().join("users").join(AGENT).join("sandbox");assert!(sandbox_policy_with(&root(), &SaasSandboxConfig::default(), &action, &action).is_err());}++#[test]+fn only_the_scheduler_and_clock_tools_are_operator_admittable() {+ assert_eq!(OPERATOR_ADMITTABLE, ["cron", "current_time", "resolve_time"]);+ for tool in OPERATOR_ADMITTABLE {+ assert!(!is_hard_denied(tool), "{tool}");+ assert!(!admits_with(tool, false, &[]), "{tool} stays off without a scope");+ }+}