Skip to content

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

refactor(storage): update storage import documentation and logic

Steven Enamakel2cf667a5e2b0
diff --git a/crates/openhuman-core/src/modules/storage_import_tinybox.rs b/crates/openhuman-core/src/modules/storage_import_tinybox.rs
index 5a843dd3bf..ca5d730cc4 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinybox.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinybox.rs
@@ -2,11 +2,10 @@
//! tinybox module's storage.
//!
//! A `JailRegistry` used to keep its metadata for every jail in
-//! `<base>/index.json` (the documented base is `<workspace>/jails/`). From
-//! v0.1.29 the index is one document per registry in the
-//! `tinybox_jail_index` collection of the module's own scope, with the same
-//! JSON shape, so a registry opened on the host's storage sees the jails an
-//! older install created.
+//! `<base>/index.json` (the documented base is `<workspace>/jails/`). The
+//! importer converts that registry JSON through the TinyBox bus contract and
+//! writes the current `box.jail_index` body, so a registry opened on the
+//! host's storage sees jails an older install created.
//!
//! * **The legacy file is never modified.** It is only read.
//! * **Nothing is overwritten.** The document is written only when absent, so
@@ -85,9 +84,7 @@ async fn import_into(scoped: &Storage, base: &Path) -> Result<Outcome> {
let collection = tinybox_bus::storage::JAIL_INDEX_COLLECTION;
docs.ensure_collection(&CollectionSpec::new(collection))
.await
- .map_err(|error| {
- anyhow::anyhow!("declare {collection}: {:?}", error.kind())
- })?;
+ .map_err(|error| anyhow::anyhow!("declare {collection}: {:?}", error.kind()))?;
let body = tinybox_bus::storage::jail_index::to_body(doc)
.context("convert the jail index into the current owner body")?;
written = support::put_absent_with(
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
index 3f61286d73..1ace3e5ae5 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors.rs
@@ -11,6 +11,9 @@
//! upgraded with preferences set (a denied write, say) must not lose them.
//!
//! * **Legacy files are never modified.** They are only read.
+//! * **Current owner shapes.** Preferences are encoded with the TinyConnectors
+//! bus contract and written to its v2 collection; trigger records go to the
+//! current owner stream prefix.
//! * **Nothing is overwritten.** A preference document that already exists is
//! kept, and a day's stream that already holds records is not appended to,
//! so a retry cannot duplicate and records the module wrote since are never
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
index 1ab6d2205d..7c73384140 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyconnectors_tests.rs
@@ -174,10 +174,10 @@ async fn records_the_module_already_wrote_are_never_replaced_or_duplicated() {
.unwrap();
scoped
.streams()
- .append(
- "connectors.triggers/2026-10-12",
- json!({"metadataId": "live"}),
- )
+ .append(
+ "connectors.triggers/2026-10-12",
+ json!({"metadataId": "live"}),
+ )
.await
.unwrap();