Skip to content

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

test(memory): cover saas confinement refusals

Steven Enamakelf7c4da457edd
diff --git a/crates/openhuman-core/src/memory/user_scope_tests.rs b/crates/openhuman-core/src/memory/user_scope_tests.rs
index 7a7b452d85..35489ffbd8 100644
--- a/crates/openhuman-core/src/memory/user_scope_tests.rs
+++ b/crates/openhuman-core/src/memory/user_scope_tests.rs
@@ -16,15 +16,25 @@ fn user_config(root: &str) -> Config {
}
#[test]
-fn only_saas_configs_with_a_root_are_confined() {
- assert_eq!(confinement_in(false, &user_config("user:u-a")), None);
- assert_eq!(confinement_in(true, &Config::default()), None);
+fn only_saas_configs_are_confined() {
+ assert!(confinement_in(false, &user_config("user:u-a"))
+ .unwrap()
+ .is_none());
assert_eq!(
- confinement_in(true, &user_config("user:u-a")),
+ confinement_in(true, &user_config("user:u-a")).unwrap(),
Some(ns("user:u-a"))
);
}
+#[test]
+fn a_saas_config_without_a_valid_root_is_refused() {
+ // No root, an unparseable one, or the global root: memory refuses rather
+ // than reaching every user.
+ assert!(confinement_in(true, &Config::default()).is_err());
+ assert!(confinement_in(true, &user_config("")).is_err());
+ assert!(confinement_in(true, &user_config("not a namespace!")).is_err());
+}
+
#[test]
fn reads_never_climb_out_of_the_root() {
let root = ns("user:u-a");
diff --git a/tests/saas_mode_e2e.rs b/tests/saas_mode_e2e.rs
index b8b2ccc192..0c0c895bd3 100644
--- a/tests/saas_mode_e2e.rs
+++ b/tests/saas_mode_e2e.rs
@@ -702,11 +702,11 @@ fn users_reach_their_memory_but_not_its_configuration() {
!text.contains("unknown method"),
"memory_recall is on the surface: {text}"
);
- let (_, body) = call("openhuman.memory_engine_get", json!({}));
- assert!(body.get("result").is_some(), "{body}");
// Not reachable: anything that changes where memory lives or reads the host.
+ // The engine's settings carry its credential: operator-only.
for method in [
+ "openhuman.memory_engine_get",
"openhuman.memory_engine_set",
"openhuman.memory_policy_set",
"openhuman.memory_sources_add",