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
feat(storage): re-migrate module owners after legacy imports, storage-schema gate and docs, test updates
Steven Enamakelf38ffcba6b3c
diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas.rs b/crates/openhuman-core/src/modules/storage_grant_schemas.rsindex d43a784631..918e081191 100644--- a/crates/openhuman-core/src/modules/storage_grant_schemas.rs+++ b/crates/openhuman-core/src/modules/storage_grant_schemas.rs@@ -71,10 +71,7 @@ pub(super) fn owner_of(module_id: &str) -> Option<&'static str> {/// Carries what a legacy-file importer just wrote into `module_id`'s scope/// (v1 names and shapes) forward to the owner's v2 schema.-pub(super) async fn migrate_imported(- ctx: &crate::core::runtime::DispatchCtx,- module_id: &str,-) {+pub(super) async fn migrate_imported(ctx: &crate::core::runtime::DispatchCtx, module_id: &str) {let (Some(owner), Some(backend)) = (owner_of(module_id), crate::storage::installed()) else {return;};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 f439f3c322..2b7dc40865 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@@ -31,9 +31,7 @@ async fn a_blob_over_the_bus_frame_round_trips_through_a_peer_bound_stream() {let rig = rig("tinyjuice").await;// 20 MiB: over the 16 MiB frame no inline call could carry.let len = 20 * MIB;- let stored = rig- .member("StreamPut", ("juice/ccr/streamed", len))- .await;+ let stored = rig.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();@@ -76,9 +74,7 @@ async fn a_streamed_blob_is_still_bound_by_the_grant_and_the_length() {let _turn = TURN.lock().await;let rig = rig("tinyjuice").await;// Outside the CCR prefix: refused before anything is stored.- let outside = rig- .member("StreamPut", ("juice/other/x", 2 * MIB))- .await;+ let outside = rig.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@@ -93,9 +89,7 @@ async fn a_streamed_blob_is_still_bound_by_the_grant_and_the_length() {"{denied_get}");// The module keeps working after a refusal.- let after = rig- .member("StreamPut", ("juice/ccr/after", 3 * MIB))- .await;+ let after = rig.member("StreamPut", ("juice/ccr/after", 3 * MIB)).await;assert_eq!(after["ok"]["len"], 3 * MIB, "{after}");}@@ -125,9 +119,7 @@ async fn an_inline_blob_no_frame_can_carry_fails_fast_instead_of_hanging() {.await.unwrap().is_none());- let after: Value = rig- .member("PutBlob", ("juice/ccr/after", 2048usize))- .await;+ let after: Value = rig.member("PutBlob", ("juice/ccr/after", 2048usize)).await;assert!(after.get("ok").is_some(),"the module keeps working: {after}"@@ -249,10 +241,7 @@ async fn a_second_module_cannot_read_or_take_the_first_modules_streams() {.peer_proxy(0, "Blobs").call("PutStream",- (- json!({"key": "juice/ccr/hijacked", "len": MIB}),- reference,- ),+ (json!({"key": "juice/ccr/hijacked", "len": MIB}), reference),).await;assert!(diff --git a/crates/openhuman-core/src/profiles/fence_tests.rs b/crates/openhuman-core/src/profiles/fence_tests.rsindex 7953c924b6..d2c421c7a2 100644--- a/crates/openhuman-core/src/profiles/fence_tests.rs+++ b/crates/openhuman-core/src/profiles/fence_tests.rs@@ -112,7 +112,9 @@ async fn a_takeover_fences_the_old_holders_writes_before_its_heartbeat_runs() {.unwrap();// Node A's next write is refused at once, and the profile is latched.- let refused = write(&a_storage, "u:alice/agent:default").await.unwrap_err();+ let refused = write(&a_storage, "u:alice/agent:default")+ .await+ .unwrap_err();assert!(matches!(fence_error(&refused),Some(FenceError::Superseded { .. })diff --git a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs b/crates/openhuman-core/src/storage/import/tinyflows_tests.rsindex f9096031b5..159e680cae 100644--- a/crates/openhuman-core/src/storage/import/tinyflows_tests.rs+++ b/crates/openhuman-core/src/storage/import/tinyflows_tests.rs@@ -203,6 +203,16 @@ fn cron_jobs_and_runs_come_across_with_their_fields() {got.as_object_mut().unwrap().remove("id");let mut want = legacy.clone();want.as_object_mut().unwrap().remove("id");+ // v2 keeps instants as epoch milliseconds and stamps the creation time+ // from the driver clock: compare `next_run` at millisecond precision and+ // leave `created_at` out (the tinyflows import step does not carry it).+ for body in [&mut got, &mut want] {+ body.as_object_mut().unwrap().remove("created_at");+ if let Some(next) = body["next_run"].as_str() {+ let at = chrono::DateTime::parse_from_rfc3339(next).unwrap();+ body["next_run"] = json!(at.timestamp_millis());+ }+ }assert_eq!(got, want, "job {legacy_id}");let runs = cron_store::list_runs(&backend, &Scope::local(), &new_id).unwrap();assert_eq!(diff --git a/examples/storage_schema_dump.rs b/examples/storage_schema_dump.rsindex 2f4f1a2ef8..5112ca1e0a 100644--- a/examples/storage_schema_dump.rs+++ b/examples/storage_schema_dump.rs@@ -39,13 +39,21 @@ fn item(item: &Item) -> Value {.flat_map(|index| index.fields.iter().cloned()).collect::<Vec<_>>(),}),- Item::Stream { name, scope: class, .. } => {+ Item::Stream {+ name, scope: class, ..+ } => {json!({ "kind": "stream", "name": name, "scope": scope(*class) })}- Item::Blobs { prefix, scope: class } => {+ Item::Blobs {+ prefix,+ scope: class,+ } => {json!({ "kind": "blobs", "name": prefix, "scope": scope(*class) })}- Item::Secrets { prefix, scope: class } => {+ Item::Secrets {+ prefix,+ scope: class,+ } => {json!({ "kind": "secrets", "name": prefix, "scope": scope(*class) })}}@@ -68,5 +76,8 @@ fn main() {})}).collect();- println!("{}", serde_json::to_string_pretty(&json!({ "owners": owners })).unwrap());+ println!(+ "{}",+ serde_json::to_string_pretty(&json!({ "owners": owners })).unwrap()+ );}