Skip to content

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

refactor(storage): drop tinymcp migration grants

Steven Enamakelb82aeefe40dd
diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas.rs b/crates/openhuman-core/src/modules/storage_grant_schemas.rs
index 91dc831b63..24a858697f 100644
--- a/crates/openhuman-core/src/modules/storage_grant_schemas.rs
+++ b/crates/openhuman-core/src/modules/storage_grant_schemas.rs
@@ -19,8 +19,6 @@
use std::sync::Arc;
-use tinystoragedrivers::CollectionSpec;
-
use super::storage_grants::StorageGrant;
use super::storage_queue_manifest::QueueManifest;
use crate::storage::schema::module_collections;
@@ -137,8 +135,7 @@ pub(super) async fn migrate_imported(ctx: &crate::core::runtime::DispatchCtx, mo
pub(super) fn grant_for(module_id: &str) -> Option<StorageGrant> {
let row = ROWS.iter().find(|row| row.module == module_id)?;
let queues = row.queues.and_then(|source| source());
- let mut collections = module_collections(row.owner);
- collections.extend(migration_collections(row.owner));
+ let collections = module_collections(row.owner);
let secret_prefixes: Vec<String> = row.secrets.iter().map(|s| (*s).to_owned()).collect();
// Collection declarations are now the owner contracts' only published
// storage inventory. Stream/blob/secret grants remain explicit below
@@ -158,38 +155,9 @@ pub(super) fn grant_for(module_id: &str) -> Option<StorageGrant> {
})
}
-/// What a module's own first-open migration reads and writes besides the
-/// collections it owns: the progress ledger every owner shares, and the v1
-/// source collections the steps move into the v2 names (the ones the legacy
-/// importers write). The module runs those steps itself over the bus, so a
-/// grant without them fails its startup at the first `EnsureCollection`.
-/// Scoped to the module's own storage scope, so no other module's data is
-/// reachable through them.
-fn migration_collections(owner: &str) -> Vec<CollectionSpec> {
- match owner {
- "mcp" => [
- super::storage_grants::MIGRATION_LEDGER,
- "mcp_servers",
- "mcp_server_names",
- "mcp_registry_cache",
- "mcp_tool_cache",
- "mcp_registry_index",
- "mcp_registry_index_state",
- ]
- .into_iter()
- .map(CollectionSpec::new)
- .collect(),
- _ => Vec::new(),
- }
-}
-
fn stream_prefixes(owner: &str) -> Vec<String> {
match owner {
- // The v1 audit stream is read by the module's audit migration.
- "mcp" => vec![
- tinymcp_bus::storage::AUDIT_STREAM.to_owned(),
- "mcp_audit".to_owned(),
- ],
+ "mcp" => vec![tinymcp_bus::storage::AUDIT_STREAM.to_owned()],
"connectors" => tinyconnectors_bus::storage::storage_needs().stream_prefixes,
// TinyWallet's module still reads and appends this released ledger
// stream while its bus contract currently declares collections only.
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 bbc6d71f48..4736157836 100644
--- a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs
@@ -24,12 +24,7 @@ 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() + migration_collections(row.owner).len(),
- "{}",
- row.module
- );
+ assert_eq!(grant.collections.len(), items.len(), "{}", row.module);
}
assert!(declared("not-a-module").is_none());
}
@@ -192,44 +187,3 @@ 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}"
- );
- }
-}
diff --git a/crates/openhuman-core/src/modules/storage_grants.rs b/crates/openhuman-core/src/modules/storage_grants.rs
index e982554948..f68fd4bbb9 100644
--- a/crates/openhuman-core/src/modules/storage_grants.rs
+++ b/crates/openhuman-core/src/modules/storage_grants.rs
@@ -139,12 +139,6 @@ const RESERVED_COLLECTIONS: [&str; 1] = [tinystoragedrivers::secrets::DEFAULT_CO
/// A module reaches the queue collections only through the `Queues` object.
const RESERVED_COLLECTION_PREFIX: &str = "tsd.";
-/// The one `tsd.` collection a module may hold: the progress ledger its own
-/// first-open migration keeps, one row per owner, item and step. It sits in the
-/// module's own scope, so it exposes no other module's data, and a forged row
-/// can only skip a step of that module's own migration.
-pub(super) const MIGRATION_LEDGER: &str = "tsd.migrations";
-
impl StorageGrant {
/// The schema the host ensures when it binds the module.
pub fn specs(&self) -> &[CollectionSpec] {
@@ -162,8 +156,7 @@ impl StorageGrant {
for spec in &self.collections {
if spec.name.is_empty()
|| spec.name.starts_with('_')
- || (spec.name.starts_with(RESERVED_COLLECTION_PREFIX)
- && spec.name != MIGRATION_LEDGER)
+ || spec.name.starts_with(RESERVED_COLLECTION_PREFIX)
|| RESERVED_COLLECTIONS.contains(&spec.name.as_str())
{
return Err("a granted collection name is empty or reserved".into());
diff --git a/crates/openhuman-core/src/modules/storage_grants_tests.rs b/crates/openhuman-core/src/modules/storage_grants_tests.rs
index 2c90deb94c..e79b3efd36 100644
--- a/crates/openhuman-core/src/modules/storage_grants_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_grants_tests.rs
@@ -626,15 +626,3 @@ fn the_selectors_added_to_the_wire_keep_the_grants_prefixes_and_read_only_rule()
)
.is_ok());
}
-
-#[test]
-fn only_the_migration_ledger_may_be_granted_from_the_storage_layers_namespace() {
- let with = |name: &str| StorageGrant {
- collections: vec![CollectionSpec::new(name)],
- ..grant()
- };
- assert!(with("tsd.migrations").validate().is_ok());
- for reserved in ["tsd.queue", "tsd.leases", "tsd.kv", "tsd.migrations2"] {
- assert!(with(reserved).validate().is_err(), "{reserved}");
- }
-}