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
feat(storage): add lease documents for fenced storage access
Steven Enamakelb511c67b192d
diff --git a/crates/openhuman-core/src/storage/fence_tests.rs b/crates/openhuman-core/src/storage/fence_tests.rsindex a154f3c57d..fb9cee2acb 100644--- a/crates/openhuman-core/src/storage/fence_tests.rs+++ b/crates/openhuman-core/src/storage/fence_tests.rs@@ -34,7 +34,6 @@ fn a_fence_covers_its_exact_scope_and_prefix_only() {let grant = LeaseGrant {key: "alice".into(),epoch: 1,- version: tinystoragedrivers::Version(1),expires_at_ms: 1_000,previous_unclean: false,};@@ -53,7 +52,6 @@ fn the_local_check_refuses_inside_the_skew_margin_and_after_renewal_admits_againlet grant = LeaseGrant {key: "alice".into(),epoch: 3,- version: tinystoragedrivers::Version(1),expires_at_ms: 30_000,previous_unclean: false,};diff --git a/crates/openhuman-core/src/storage/fenced_backend_tests.rs b/crates/openhuman-core/src/storage/fenced_backend_tests.rsindex 450471cd67..f0201273c1 100644--- a/crates/openhuman-core/src/storage/fenced_backend_tests.rs+++ b/crates/openhuman-core/src/storage/fenced_backend_tests.rs@@ -240,8 +240,8 @@ impl LeaseStore for PausedAfterCheck {Ok(record)}- fn record_scope(&self) -> Option<Scope> {- self.inner.record_scope()+ fn driver_fence(&self, key: &str, node: &str, epoch: u64) -> Option<tinystoragedrivers::Fence> {+ self.inner.driver_fence(key, node, epoch)}}diff --git a/crates/openhuman-core/src/storage/lease_documents.rs b/crates/openhuman-core/src/storage/lease_documents.rsindex dbd90fc165..ead6c0561a 100644--- a/crates/openhuman-core/src/storage/lease_documents.rs+++ b/crates/openhuman-core/src/storage/lease_documents.rs@@ -240,7 +240,13 @@ impl LeaseStore for DocumentLeases {self.declare().await?;let renewed = self.leases_at(now_ms)- .renew(LEASE_OWNER, &grant.key, &self.node, grant.epoch, self.ttl_ms)+ .renew(+ LEASE_OWNER,+ &grant.key,+ &self.node,+ grant.epoch,+ self.ttl_ms,+ ).await?;let Some(lease) = renewed else {// The held entry stays: it names an epoch the record has moveddiff --git a/crates/openhuman-core/src/storage/lease_documents_tests.rs b/crates/openhuman-core/src/storage/lease_documents_tests.rsindex c71b3224ab..b8725bb35a 100644--- a/crates/openhuman-core/src/storage/lease_documents_tests.rs+++ b/crates/openhuman-core/src/storage/lease_documents_tests.rs@@ -3,6 +3,7 @@ use super::*;use std::time::Duration;use crate::storage::MemoryStorage;+use tinystoragedrivers::Precondition;const TTL: Duration = Duration::from_millis(1_000);@@ -52,7 +53,6 @@ async fn renew_extends_and_keeps_the_epoch() {let renewed = a.renew(&grant, 900).await.unwrap();assert_eq!(renewed.epoch, grant.epoch);assert_eq!(renewed.expires_at_ms, 1_900);- assert!(renewed.version > grant.version);assert!(matches!(b.acquire("k", 1_500).await,Err(LeaseError::Held(_))@@ -106,8 +106,11 @@ async fn bad_keys_and_corrupt_records_are_storage_errors() {.documents().put(LEASE_COLLECTION,- "k",- serde_json::json!({ "owner": 7 }),+ &tinystoragedrivers::Key::of([LEASE_OWNER, "k"])+ .unwrap()+ .as_str()+ .to_string(),+ serde_json::json!({ "holder": 7 }),Precondition::None,).awaitdiff --git a/crates/openhuman-core/src/storage/lease_local.rs b/crates/openhuman-core/src/storage/lease_local.rsindex bdcd516072..92c230def0 100644--- a/crates/openhuman-core/src/storage/lease_local.rs+++ b/crates/openhuman-core/src/storage/lease_local.rs@@ -229,13 +229,7 @@ impl LeaseStore for LocalLeases {previous_unclean = unclean,"[lease] local acquired");- held.insert(- key.to_string(),- Holding {- file,- record,- },- );+ held.insert(key.to_string(), Holding { file, record });Ok(LeaseGrant {key: key.to_string(),epoch,