The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(storage): clarify blob sweep safety requirements
Steven Enamakelb4d5dbfcf26a
diff --git a/crates/openhuman-core/src/storage/blob_sweep.rs b/crates/openhuman-core/src/storage/blob_sweep.rsindex c4ec0ff2b0..9a49bdafef 100644--- a/crates/openhuman-core/src/storage/blob_sweep.rs+++ b/crates/openhuman-core/src/storage/blob_sweep.rs@@ -39,9 +39,13 @@ pub const SCOPE_SWEEP_TIMEOUT: Duration = Duration::from_secs(5 * 60);////// This is a maintenance primitive, not an automatic policy: the caller must/// arrange that blob writers and reference creation cannot race the check and-/// delete (or use immutable keys). The age grace period must exceed the maximum-/// time from writing a blob until its durable reference is visible. This-/// function is deliberately not called by [`sweep_all`].+/// delete. One safe arrangement is uniquely allocated immutable keys, a grace+/// interval longer than the maximum write-to-durable-reference delay, and a+/// rule forbidding later references to already-eligible keys. Otherwise the+/// caller must coordinate the whole check/delete window with writers. The age+/// grace period must exceed the maximum time from writing a blob until its+/// durable reference is visible. This function is deliberately not called by+/// [`sweep_all`].////// Only blobs with a known `written_at_ms` strictly less than `older_than_ms`/// are considered. Unknown ages and entries at the cutoff are retained. Pagesdiff --git a/crates/openhuman-core/src/storage/blob_sweep_tests.rs b/crates/openhuman-core/src/storage/blob_sweep_tests.rsindex bc218ddcdd..403a3f85a5 100644--- a/crates/openhuman-core/src/storage/blob_sweep_tests.rs+++ b/crates/openhuman-core/src/storage/blob_sweep_tests.rs@@ -293,6 +293,32 @@ async fn orphan_sweep_pages_and_preserves_referenced_blobs() {assert!(blobs.get("cleanup/0000").await.unwrap().is_none());}+#[tokio::test]+async fn orphan_sweep_checks_references_only_for_eligible_blobs() {+ use std::sync::atomic::{AtomicUsize, Ordering};+ use tinystoragedrivers_api::BlobStore;+ use tinystoragedrivers_testkit::memory_storage;+ use tinystoragedrivers_types::Scope;++ let storage = memory_storage(&Scope::local());+ let blobs = storage.blobs();+ blobs.put("cleanup/a", vec![1], None).await.unwrap();+ blobs.put("cleanup/b", vec![2], None).await.unwrap();+ let checked = AtomicUsize::new(0);++ let removed = sweep_unreferenced_blobs(blobs.as_ref(), "cleanup/", 0, |_| {+ checked.fetch_add(1, Ordering::SeqCst);+ async { Ok(false) }+ })+ .await+ .unwrap();++ assert_eq!(removed, 0);+ assert_eq!(checked.load(Ordering::SeqCst), 0);+ assert!(blobs.get("cleanup/a").await.unwrap().is_some());+ assert!(blobs.get("cleanup/b").await.unwrap().is_some());+}+#[tokio::test]async fn orphan_sweep_stops_on_reference_error_after_preserving_prior_progress() {use tinystoragedrivers_api::BlobStore;diff --git a/vendor/tinystoragedrivers b/vendor/tinystoragedriversindex 7acd22d8e8..08625980d3 160000--- a/vendor/tinystoragedrivers+++ b/vendor/tinystoragedrivers@@ -1 +1 @@-Subproject commit 7acd22d8e8061edf7ef8cc4976c666b198a203c7+Subproject commit 08625980d3b85c1efffe15d5dfc74d21be9653a3