Skip to content

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

test(storage_grants): update capability probe test assertions

Steven Enamakel5cb01752815c
diff --git a/crates/openhuman-core/src/modules/storage_grants_tests.rs b/crates/openhuman-core/src/modules/storage_grants_tests.rs
index c503f7611f..357b316cca 100644
--- a/crates/openhuman-core/src/modules/storage_grants_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_grants_tests.rs
@@ -133,8 +133,9 @@ fn an_object_the_grant_does_not_hold_is_refused() {
#[test]
fn capabilities_are_answered_for_an_object_the_grant_does_not_hold() {
- // The module's client probes every object's capabilities when it connects
- // (tinymcp 0.18.0 holds no blobs); refusing the probe left it without storage.
+ // The module's client probes all six objects when it connects; refusing a
+ // capability probe leaves it without storage, even if the object itself
+ // is not granted.
let documents_only = StorageGrant {
collections: vec![CollectionSpec::new("notes")],
writable: true,
@@ -148,6 +149,14 @@ fn capabilities_are_answered_for_an_object_the_grant_does_not_hold() {
"max_key_len": 0,
})))
);
+ assert_eq!(
+ authorize(&documents_only, Object::Streams, "Capabilities", &json!({})),
+ Ok(Plan::Answer(json!({ "capabilities": [] })))
+ );
+ assert_eq!(
+ authorize(&documents_only, Object::Secrets, "Capabilities", &json!({})),
+ Ok(Plan::Answer(json!({ "enumerable": false })))
+ );
// Anything else on that object is still refused.
assert_eq!(
authorize(
@@ -158,6 +167,14 @@ fn capabilities_are_answered_for_an_object_the_grant_does_not_hold() {
),
Err(Denied::Object)
);
+ assert_eq!(
+ authorize(&documents_only, Object::Streams, "Len", &json!({ "stream": "x" })),
+ Err(Denied::Object)
+ );
+ assert_eq!(
+ authorize(&documents_only, Object::Secrets, "Get", &json!({ "name": "x" })),
+ Err(Denied::Object)
+ );
}
#[test]