Skip to content

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

feat(storage/import): add incomplete outcome for legacy imports

Steven Enamakel5fd398b5aeeb
diff --git a/crates/openhuman-core/src/storage/import/mod.rs b/crates/openhuman-core/src/storage/import/mod.rs
index 94ef1f5f5b..2ce8eb5e49 100644
--- a/crates/openhuman-core/src/storage/import/mod.rs
+++ b/crates/openhuman-core/src/storage/import/mod.rs
@@ -166,6 +166,16 @@ pub enum Outcome {
/// Records written; the rest already existed.
written: usize,
},
+ /// The reader found records it could not import, so the clean-only marker
+ /// was withheld and this import will be retried.
+ Incomplete {
+ /// Records found in the legacy file (both shapes).
+ found: usize,
+ /// Records written; the rest already existed or were invalid.
+ written: usize,
+ /// Records rejected by the reader or owner importer.
+ skipped: usize,
+ },
}
/// One domain's result.
@@ -246,6 +256,18 @@ pub fn run_with(
written,
"[storage::import] imported the legacy store; the files were not modified"
),
+ Ok(Outcome::Incomplete {
+ found,
+ written,
+ skipped,
+ }) => tracing::warn!(
+ target: "openhuman::storage_import",
+ domain = source.domain,
+ found,
+ written,
+ skipped,
+ "[storage::import] some legacy records were skipped; the import remains open for retry"
+ ),
Ok(Outcome::AlreadyDone) => tracing::debug!(
target: "openhuman::storage_import",
domain = source.domain,
diff --git a/crates/openhuman-core/src/storage/import/tinyflows.rs b/crates/openhuman-core/src/storage/import/tinyflows.rs
index 0f20494bff..06f0b90e31 100644
--- a/crates/openhuman-core/src/storage/import/tinyflows.rs
+++ b/crates/openhuman-core/src/storage/import/tinyflows.rs
@@ -81,7 +81,11 @@ pub(super) fn marked(
skipped,
"[storage::import] legacy records were skipped; the import stays open for retry"
);
- return Ok(Outcome::Imported { found, written });
+ return Ok(Outcome::Incomplete {
+ found,
+ written,
+ skipped,
+ });
}
import_state::set_done(&markers, MARKER_OWNER, &step)?;
Ok(Outcome::Imported { found, written })
@@ -299,6 +303,18 @@ pub(super) fn finish(domain: &'static str, outcome: Result<Outcome>) -> Report {
written,
"[storage::import] imported the legacy store; the files were not modified"
),
+ Ok(Outcome::Incomplete {
+ found,
+ written,
+ skipped,
+ }) => tracing::warn!(
+ target: "openhuman::storage_import",
+ domain,
+ found,
+ written,
+ skipped,
+ "[storage::import] some legacy records were skipped; the import remains open for retry"
+ ),
Ok(Outcome::AlreadyDone) => tracing::debug!(
target: "openhuman::storage_import",
domain,