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(doctor): account for root when asserting write access
Steven Enamakeldc40f0b73814
diff --git a/crates/openhuman-core/src/doctor/checks/config_semantics_tests.rs b/crates/openhuman-core/src/doctor/checks/config_semantics_tests.rsindex 3c39f4b390..8090eab6db 100644--- a/crates/openhuman-core/src/doctor/checks/config_semantics_tests.rs+++ b/crates/openhuman-core/src/doctor/checks/config_semantics_tests.rs@@ -246,13 +246,23 @@ async fn action_directory_without_write_access_is_an_error() {let findings = run_check(config, "workspace/action-dir").await;std::fs::set_permissions(dir.path(), original_permissions).unwrap();+ // Root can still create files in a directory whose POSIX write bits are+ // clear, so the expected result follows the effective user running the+ // test rather than the mode bits alone.+ let expected_severity = if unsafe { libc::geteuid() } == 0 {+ FindingSeverity::Pass+ } else {+ FindingSeverity::Error+ };assert_eq!(- finding(&findings, FindingSeverity::Error)- .config_path- .as_deref(),+ findings[0].severity,+ expected_severity,+ "action-directory probe should reflect effective write access"+ );+ assert_eq!(+ findings[0].config_path.as_deref(),Some("action_dir"));- #[cfg(unix)]assert_eq!(std::fs::read_dir(dir.path()).unwrap().count(), 0);}diff --git a/crates/openhuman-core/src/doctor/checks/workspace_tests.rs b/crates/openhuman-core/src/doctor/checks/workspace_tests.rsindex 1adb3011d0..74213b89fb 100644--- a/crates/openhuman-core/src/doctor/checks/workspace_tests.rs+++ b/crates/openhuman-core/src/doctor/checks/workspace_tests.rs@@ -159,13 +159,18 @@ async fn writable_probe_succeeds_and_leaves_the_selected_workspace_unchanged() {#[cfg(unix)]#[tokio::test]-async fn read_only_workspace_is_reported_by_the_native_writable_check() {+async fn workspace_without_write_mode_bits_reports_effective_writability() {let workspace = ReadOnlyWorkspace::new();assert!(workspace.path().is_dir(), "the selected workspace exists");- assert!(- crate::storage::probe_directory_writable(workspace.path()).is_err(),- "the selected directory must reject probe-file creation"- );+ let expected_severity = if unsafe { libc::geteuid() } == 0 {+ FindingSeverity::Pass+ } else {+ assert!(+ crate::storage::probe_directory_writable(workspace.path()).is_err(),+ "a non-root user must be denied probe-file creation when write bits are clear"+ );+ FindingSeverity::Error+ };let before = tree_snapshot(workspace.path());let mut config = crate::config::Config::default();config.workspace_dir = workspace.path().to_path_buf();@@ -190,14 +195,16 @@ async fn read_only_workspace_is_reported_by_the_native_writable_check() {.iter().find(|finding| finding.check_id == "workspace/writable").expect("native workspace check produces a finding");- assert_eq!(finding.severity, FindingSeverity::Error);+ assert_eq!(finding.severity, expected_severity);assert_eq!(finding.config_path.as_deref(), Some("workspace_dir"));let serialized = serde_json::to_string(&report).expect("serialize doctor report");assert!(!serialized.contains(PRIVATE_WORKSPACE_MARKER),"the report must not disclose the physical workspace path");- assert!(!finding.fix_hint.trim().is_empty());+ if expected_severity == FindingSeverity::Error {+ assert!(!finding.fix_hint.trim().is_empty());+ }}#[tokio::test]diff --git a/crates/openhuman-embed/examples/support/mod.rs b/crates/openhuman-embed/examples/support/mod.rsindex b5b94dff8c..37b1b2c6ac 100644--- a/crates/openhuman-embed/examples/support/mod.rs+++ b/crates/openhuman-embed/examples/support/mod.rs@@ -208,9 +208,9 @@ pub fn route(server: &wiremock::MockServer, model: &str) -> openhuman_embed::Pro.model(model)}-/// Polls `check` until it yields `Some` or about thirty seconds pass.+/// Polls `check` until it yields `Some` or about ninety seconds pass.pub async fn eventually<T>(what: &str, mut check: impl FnMut() -> Option<T>) -> T {- for _ in 0..3000 {+ for _ in 0..9000 {if let Some(value) = check() {return value;}