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 marker logic

Steven Enamakeldd799ff735f2
diff --git a/crates/openhuman-core/src/modules/storage_import_support.rs b/crates/openhuman-core/src/modules/storage_import_support.rs
index c02695284a..8598429ddc 100644
--- a/crates/openhuman-core/src/modules/storage_import_support.rs
+++ b/crates/openhuman-core/src/modules/storage_import_support.rs
@@ -38,10 +38,9 @@ pub(super) fn marker_id(prefix: &str, source: &Path) -> String {
}
/// Whether the importer `kind` already finished for marker `id`, recorded in
-/// `tsd.migrations` of the module's scope. `kind` is the old marker
-/// collection name (`tinybox_host_import`), so a marker row an older build
-/// wrote ([`crate::storage::import_state::migrate_legacy_markers`]) answers
-/// the same question.
+/// the host-owned import-state collection of the module's scope. `kind` is a
+/// stable marker family name (`tinybox_host_import`), outside the module's
+/// granted collections.
pub(super) async fn already_imported(scoped: &Storage, kind: &str, id: &str) -> Result<bool> {
crate::storage::import_state::host_import_done(scoped, kind, id)
.await
diff --git a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs
index 7633b6721c..13aad39a26 100644
--- a/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs
+++ b/crates/openhuman-core/src/modules/storage_import_tinyjuice_savings.rs
@@ -12,7 +12,8 @@
//! * **The path is fixed.** It is `state/tokenjuice_savings.json` under the
//! workspace, read without following a symlink and capped in size; nothing
//! in the file can name another path.
-//! * **Runs once per file.** A marker in `tsd.migrations` records it. A
+//! * **Runs once per file.** A host-owned marker in the module scope records
+//! it. A
//! snapshot that does not parse is marked too (the old ledger ignored it as
//! well), so a corrupt file is not retried forever. A failed hand-over writes
//! no marker and is retried at the next install.
diff --git a/crates/openhuman-core/src/storage/scope_move.rs b/crates/openhuman-core/src/storage/scope_move.rs
index 6fbb38f837..c6fb585392 100644
--- a/crates/openhuman-core/src/storage/scope_move.rs
+++ b/crates/openhuman-core/src/storage/scope_move.rs
@@ -23,9 +23,6 @@ use tinystoragedrivers_types::{CollectionSpec, ErrorKind, WriteOptions};
use crate::storage::{DocumentStore, DocumentStoreExt, Precondition, Scope, StorageBackend};
use super::scope::{scope_for_agent, scope_for_profile, tenant_scope};
-/// The `tsd.migrations` owner the move records under.
-pub const MIGRATION_OWNER: &str = "host";
-
/// The ids a hashed v1 scope can be matched against.
#[derive(Debug, Default, Clone)]
pub struct Known {
diff --git a/crates/openhuman-core/src/storage/scope_move_tests.rs b/crates/openhuman-core/src/storage/scope_move_tests.rs
index 76635c42e8..e658524c99 100644
--- a/crates/openhuman-core/src/storage/scope_move_tests.rs
+++ b/crates/openhuman-core/src/storage/scope_move_tests.rs
@@ -2,7 +2,7 @@ use super::*;
#[cfg(feature = "legacy-import")]
use serde_json::json;
#[cfg(feature = "legacy-import")]
-use crate::storage::{Precondition, Scope};
+use crate::storage::Precondition;
use tinystoragedrivers_testkit::MemoryBackend;
use tinystoragedrivers_types::Meta;