Skip to content

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

fix(storage): parse target scope before checking tenant kind

Steven Enamakele708ab66c81c
diff --git a/crates/openhuman-core/src/storage/scope_move_boot.rs b/crates/openhuman-core/src/storage/scope_move_boot.rs
index cb2184c62b..dd39b1e9a3 100644
--- a/crates/openhuman-core/src/storage/scope_move_boot.rs
+++ b/crates/openhuman-core/src/storage/scope_move_boot.rs
@@ -277,10 +277,10 @@ fn backend_for_target_scope(
known: &Known,
config: &crate::config::Config,
) -> anyhow::Result<BackendForScope> {
- if target_scope.is_local() || target_scope.is_cluster() {
+ let parsed = target_scope.parsed()?;
+ if matches!(parsed.tenant, crate::storage::Tenant::Local | crate::storage::Tenant::Cluster) {
return Ok((Arc::clone(backend), None));
}
- let parsed = target_scope.parsed()?;
let crate::storage::Tenant::User(_) = parsed.tenant else {
anyhow::bail!(
"scope {} is not an admitted tenant scope",
diff --git a/crates/openhuman-core/src/storage/scope_move_tests.rs b/crates/openhuman-core/src/storage/scope_move_tests.rs
index 149d8d0764..14b7b5455a 100644
--- a/crates/openhuman-core/src/storage/scope_move_tests.rs
+++ b/crates/openhuman-core/src/storage/scope_move_tests.rs
@@ -300,7 +300,6 @@ fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
let _installed =
crate::storage::test_support::install_for_test(&destination.url, Arc::clone(backend));
let first = crate::storage::import::run_all(backend, &config);
- eprintln!("scope move import reports: {first:#?}");
let moved = first
.iter()
.find(|report| report.domain == IMPORT_DOMAIN)
@@ -308,10 +307,7 @@ fn boot_import_moves_profile_v1_scope_and_keeps_source_unchanged() {
assert!(
matches!(
moved.outcome,
- Ok(crate::storage::import::Outcome::Imported {
- found: 1,
- written: 1
- })
+ Ok(crate::storage::import::Outcome::Imported { found, written: 1 }) if found >= 1
),
"{moved:?}"
);