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
refactor(storage): compose artifact and tiny_artifacts schemas
Steven Enamakelf62323fb6caa
diff --git a/crates/openhuman-core/src/storage/schema.rs b/crates/openhuman-core/src/storage/schema.rsindex 15f7588beb..5d30b7d879 100644--- a/crates/openhuman-core/src/storage/schema.rs+++ b/crates/openhuman-core/src/storage/schema.rs@@ -21,6 +21,16 @@ use tinystoragedrivers::schema::{Item, Registry, Schema, ScopeClass};/// Every owner's schema that this build links.pub fn owner_schemas() -> Vec<Schema> {+ // The host owns the artifact records and migrations; TinyArtifacts owns+ // the blob namespace its file store uses. They share one storage owner,+ // so compose their declarations into a single schema before Registry's+ // same-owner and duplicate-item checks run.+ let mut artifacts = crate::artifacts::storage_schema();+ let tiny_artifacts = tiny_artifacts::storage_schema();+ debug_assert_eq!(artifacts.owner.as_str(), tiny_artifacts.owner.as_str());+ artifacts.items.extend(tiny_artifacts.items);+ artifacts.steps.extend(tiny_artifacts.steps);+let mut schemas = vec![tinyagents_harness::storage_schema(),tinyagents_session::storage_schema(),@@ -33,7 +43,7 @@ pub fn owner_schemas() -> Vec<Schema> {crate::security::devices::storage_schema(),crate::desktop::notifications::storage_schema(),crate::integrations::task_sources::storage_schema(),- crate::artifacts::storage_schema(),+ artifacts,tiny_artifacts::storage_schema(),crate::platform::cost::storage_schema(),crate::config::schema::config_storage_schema(),diff --git a/crates/openhuman-core/src/storage/schema_tests.rs b/crates/openhuman-core/src/storage/schema_tests.rsindex ec1481df4a..ad79df006a 100644--- a/crates/openhuman-core/src/storage/schema_tests.rs+++ b/crates/openhuman-core/src/storage/schema_tests.rs@@ -36,6 +36,32 @@ fn module_items_are_the_owners_module_scoped_declarations() {assert!(module_items("no-such-owner").collections.is_empty());}+#[test]+fn tiny_artifacts_blob_namespace_composes_with_host_artifact_collections() {+ let registry = registry().expect("the owners compose");+ assert_eq!(registry.owners().filter(|owner| *owner == "artifacts").count(), 1);++ let artifacts = owner_schemas()+ .into_iter()+ .find(|schema| schema.owner.as_str() == "artifacts")+ .expect("the artifact owners are composed");+ assert!(artifacts.items.iter().any(|item| matches!(+ item,+ Item::Collection { name, .. } if name == "artifacts.records"+ )));+ assert!(artifacts.items.iter().any(|item| matches!(+ item,+ Item::Blobs {+ prefix,+ scope: ScopeClass::Tenant,+ } if prefix == "artifacts/files/"+ )));+ assert!(!module_items("artifacts")+ .blobs+ .iter()+ .any(|prefix| prefix == "artifacts/files/"));+}+#[test]fn tiny_artifacts_blob_namespace_is_in_the_composed_owner_schema() {let registry = registry().expect("the owners compose");