Skip to content

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

feat(storage): grant tinymcp its migration collections

Steven Enamakel9fd2235d8ab5
diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas.rs b/crates/openhuman-core/src/modules/storage_grant_schemas.rs
index 214501e935..b5b806d61f 100644
--- a/crates/openhuman-core/src/modules/storage_grant_schemas.rs
+++ b/crates/openhuman-core/src/modules/storage_grant_schemas.rs
@@ -19,6 +19,8 @@
use std::sync::Arc;
+use tinystoragedrivers::CollectionSpec;
+
use super::storage_grants::StorageGrant;
use super::storage_queue_manifest::QueueManifest;
use crate::storage::schema::module_collections;
diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
index 4736157836..bbc6d71f48 100644
--- a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
@@ -24,7 +24,12 @@ fn every_row_has_a_valid_generated_grant() {
.unwrap_or_else(|why| panic!("{}: {why}", row.module));
assert!(grant.writable);
let items = module_collections(row.owner);
- assert_eq!(grant.collections.len(), items.len(), "{}", row.module);
+ assert_eq!(
+ grant.collections.len(),
+ items.len() + migration_collections(row.owner).len(),
+ "{}",
+ row.module
+ );
}
assert!(declared("not-a-module").is_none());
}
@@ -187,3 +192,44 @@ fn non_document_grants_match_the_owner_contracts_without_broad_prefixes() {
Err(Denied::Target)
);
}
+
+#[test]
+fn tinymcp_may_run_its_own_migration_over_the_bus() {
+ // The module migrates its v1 records itself on first open: it declares the
+ // shared progress ledger and the v1 source collections, and reads the v1
+ // audit stream. A grant without them fails the module's startup.
+ let grant = declared("tinymcp").expect("tinymcp declares storage");
+ for name in ["tsd.migrations", "mcp_servers", "mcp_registry_index_state"] {
+ assert!(
+ allowed(
+ &grant,
+ Object::Documents,
+ "Get",
+ json!({"collection": name, "id": "x"})
+ ),
+ "{name}"
+ );
+ }
+ assert!(allowed(
+ &grant,
+ Object::Streams,
+ "ReadWindow",
+ json!({"stream": "mcp_audit/2026"})
+ ));
+}
+
+#[test]
+fn no_other_module_gets_the_migration_ledger_or_tinymcp_legacy_names() {
+ for module in ["tinychannels", "tinyconnectors", "tinybox", "tinyjuice"] {
+ let grant = declared(module).expect("declares storage");
+ assert!(
+ !allowed(
+ &grant,
+ Object::Documents,
+ "Get",
+ json!({"collection": "tsd.migrations", "id": "x"})
+ ),
+ "{module}"
+ );
+ }
+}