Skip to content

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

fix(storage): skip driver bookkeeping collections during scope import

Steven Enamakel90e9d824c82e
diff --git a/crates/openhuman-core/src/storage/import/scope_move.rs b/crates/openhuman-core/src/storage/import/scope_move.rs
index c7af393689..73336a6627 100644
--- a/crates/openhuman-core/src/storage/import/scope_move.rs
+++ b/crates/openhuman-core/src/storage/import/scope_move.rs
@@ -150,6 +150,13 @@ impl LegacyScopeInventory {
deleted,
body,
) = row?;
+ // Driver bookkeeping (`tsd.migrations`, `tsd.leases`) describes
+ // the source database, not the profile's data; copying it would
+ // claim migrations ran in the destination and admit scopes that
+ // hold nothing else.
+ if collection.starts_with("tsd.") {
+ continue;
+ }
scopes.insert(scope.clone());
if deleted {
continue;
diff --git a/crates/openhuman-core/src/storage/scope_move_tests.rs b/crates/openhuman-core/src/storage/scope_move_tests.rs
index f7b62c04c5..59e58c5dfc 100644
--- a/crates/openhuman-core/src/storage/scope_move_tests.rs
+++ b/crates/openhuman-core/src/storage/scope_move_tests.rs
@@ -293,14 +293,13 @@ fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
.unwrap();
let source_db = legacy::v1_db(&target);
- { let inv = crate::storage::import::scope_move::LegacyScopeInventory::read(&source_db).unwrap(); let v: Vec<_> = inv.documents.iter().map(|d| (d.scope.clone(), d.collection.clone(), d.id.clone())).collect(); eprintln!("DBG4 scopes={:?} docs={v:?}", inv.scopes); }
let before = hash_file(&source_db);
let destination =
crate::storage::test_support::sqlite_backend_in(dir, destination_url).unwrap();
let backend = &destination.backend;
let _installed =
crate::storage::test_support::install_for_test(&destination.url, Arc::clone(backend));
- let first = crate::storage::import::run_all(backend, &config); eprintln!("DBG3 {first:?}");
+ let first = crate::storage::import::run_all(backend, &config);
let moved = first
.iter()
.find(|report| report.domain == IMPORT_DOMAIN)