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): rename blob keys in cdylib host tests
Steven Enamakelf27ac41121eb
diff --git a/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs b/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rsindex 5e8ac858a0..f439f3c322 100644--- a/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs+++ b/crates/openhuman-core/src/modules/storage_host_cdylib_stream_tests.rs@@ -32,32 +32,32 @@ async fn a_blob_over_the_bus_frame_round_trips_through_a_peer_bound_stream() {// 20 MiB: over the 16 MiB frame no inline call could carry.let len = 20 * MIB;let stored = rig- .member("StreamPut", ("tinyjuice_ccr/streamed", len))+ .member("StreamPut", ("juice/ccr/streamed", len)).await;assert_eq!(stored["ok"]["len"], len, "{stored}");// It is in the module's own scope, byte for byte.let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();let meta = handle.blobs()- .head("tinyjuice_ccr/streamed")+ .head("juice/ccr/streamed").await.unwrap().expect("the streamed blob is stored");assert_eq!(meta.len, len);let bytes = handle.blobs()- .get_range("tinyjuice_ccr/streamed", 0..1024)+ .get_range("juice/ccr/streamed", 0..1024).await.unwrap().expect("range");assert!(bytes.iter().all(|byte| *byte == 0xAB));// And it comes back whole by `GetStream`.- let read = rig.member("StreamGet", ("tinyjuice_ccr/streamed",)).await;+ let read = rig.member("StreamGet", ("juice/ccr/streamed",)).await;assert_eq!(read["ok"]["len"], len, "{read}");assert_eq!(read["ok"]["meta_len"], len, "{read}");assert_eq!(read["ok"]["all_fill"], true, "{read}");// A key that is not there is `null`, not an error.- let missing = rig.member("StreamGet", ("tinyjuice_ccr/absent",)).await;+ let missing = rig.member("StreamGet", ("juice/ccr/absent",)).await;assert!(missing["ok"].is_null() && missing.get("ok").is_some(),"{missing}"@@ -77,24 +77,24 @@ async fn a_streamed_blob_is_still_bound_by_the_grant_and_the_length() {let rig = rig("tinyjuice").await;// Outside the CCR prefix: refused before anything is stored.let outside = rig- .member("StreamPut", ("tinyjuice_other/x", 2 * MIB))+ .member("StreamPut", ("juice/other/x", 2 * MIB)).await;assert!(outside.get("err").is_some(), "{outside}");let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();assert!(handle.blobs()- .head("tinyjuice_other/x")+ .head("juice/other/x").await.unwrap().is_none());- let denied_get = rig.member("StreamGet", ("tinyjuice_other/x",)).await;+ let denied_get = rig.member("StreamGet", ("juice/other/x",)).await;assert!(denied_get["err"].to_string().contains("target-not-granted"),"{denied_get}");// The module keeps working after a refusal.let after = rig- .member("StreamPut", ("tinyjuice_ccr/after", 3 * MIB))+ .member("StreamPut", ("juice/ccr/after", 3 * MIB)).await;assert_eq!(after["ok"]["len"], 3 * MIB, "{after}");}@@ -107,7 +107,7 @@ async fn an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging() {// frame, over the 16 MiB cap.let started = std::time::Instant::now();let big: Value = rig- .member("PutBlob", ("tinyjuice_ccr/over-frame", 5_000_000usize))+ .member("PutBlob", ("juice/ccr/over-frame", 5_000_000usize)).await;assert!(big.get("err").is_some(),@@ -121,12 +121,12 @@ async fn an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging() {let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();assert!(handle.blobs()- .head("tinyjuice_ccr/over-frame")+ .head("juice/ccr/over-frame").await.unwrap().is_none());let after: Value = rig- .member("PutBlob", ("tinyjuice_ccr/after", 2048usize))+ .member("PutBlob", ("juice/ccr/after", 2048usize)).await;assert!(after.get("ok").is_some(),@@ -223,14 +223,14 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {// which has no blobs at all.let rig = rig_with_peers("tinyjuice", &["tinyjuice", "tinymcp"]).await;let stored = rig- .member("StreamPut", ("tinyjuice_ccr/private", 2 * MIB))+ .member("StreamPut", ("juice/ccr/private", 2 * MIB)).await;assert_eq!(stored["ok"]["len"], 2 * MIB, "{stored}");// A module without blob rights is refused outright.let nosy: tinybus::Result<Value> = rig.peer_proxy(1, "Blobs")- .call("GetStream", (json!({"key": "tinyjuice_ccr/private"}),))+ .call("GetStream", (json!({"key": "juice/ccr/private"}),)).await;match nosy {Err(tinybus::Error::MethodFailed { name, message }) => {@@ -250,7 +250,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {.call("PutStream",(- json!({"key": "tinyjuice_ccr/hijacked", "len": MIB}),+ json!({"key": "juice/ccr/hijacked", "len": MIB}),reference,),)@@ -262,12 +262,12 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();assert!(handle.blobs()- .head("tinyjuice_ccr/hijacked")+ .head("juice/ccr/hijacked").await.unwrap().is_none());// The refused attempt did not spend the stream: its owner still uses it.- let used = rig.member("UseStream", ("tinyjuice_ccr/owned", MIB)).await;+ let used = rig.member("UseStream", ("juice/ccr/owned", MIB)).await;assert!(used.get("ok").is_some(),"the owner lost its stream: {used}"@@ -275,7 +275,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {assert_eq!(handle.blobs()- .head("tinyjuice_ccr/owned")+ .head("juice/ccr/owned").await.unwrap().expect("stored by the owner")@@ -284,7 +284,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {);// A download the host opened toward the probe is not readable by a peer.- let reply = rig.member("RawGetStream", ("tinyjuice_ccr/private",)).await;+ let reply = rig.member("RawGetStream", ("juice/ccr/private",)).await;let download: tinybus::StreamRef = serde_json::from_value(reply["ok"][1].clone()).unwrap_or_else(|_| panic!("a download reference: {reply}"));assert!(diff --git a/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs b/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rsindex bc1416eb01..8a7c7bc2f7 100644--- a/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs+++ b/crates/openhuman-core/src/modules/storage_host_cdylib_tests.rs@@ -547,7 +547,7 @@ async fn a_blob_over_the_inline_cap_is_refused_and_stores_nothing() {let rig = rig("tinyjuice").await;let small: Value = rig.probe- .call("PutBlob", ("tinyjuice_ccr/small", 1024usize))+ .call("PutBlob", ("juice/ccr/small", 1024usize)).await.unwrap();assert!(@@ -560,7 +560,7 @@ async fn a_blob_over_the_inline_cap_is_refused_and_stores_nothing() {// `an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging`.)let big: Value = rig.probe- .call("PutBlob", ("tinyjuice_ccr/over-cap", 2usize * 1024 * 1024))+ .call("PutBlob", ("juice/ccr/over-cap", 2usize * 1024 * 1024)).await.unwrap();assert!(@@ -570,14 +570,14 @@ async fn a_blob_over_the_inline_cap_is_refused_and_stores_nothing() {let handle = rig.backend.for_scope(&rig.scope("tinyjuice")).unwrap();assert!(handle.blobs()- .head("tinyjuice_ccr/over-cap")+ .head("juice/ccr/over-cap").await.unwrap().is_none());// The refusal does not take the module's connection down with it.let after: Value = rig.probe- .call("PutBlob", ("tinyjuice_ccr/after", 2048usize))+ .call("PutBlob", ("juice/ccr/after", 2048usize)).await.unwrap();assert!(@@ -586,7 +586,7 @@ async fn a_blob_over_the_inline_cap_is_refused_and_stores_nothing() {);// A blob key outside the CCR prefix is not the module's.let outside = rig- .call("Blobs", "Get", json!({"key": "tinyjuice_other/x"}))+ .call("Blobs", "Get", json!({"key": "juice/other/x"})).await;assert!(denied(&outside, "target-not-granted"), "{outside}");}