Skip to content

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

fix(storage): check migrated leases by key instead of collection listing

Steven Enamakel7e0eacd77667
diff --git a/crates/openhuman-core/src/profiles/storage_schema_tests.rs b/crates/openhuman-core/src/profiles/storage_schema_tests.rs
index e4e025465f..131d9619fe 100644
--- a/crates/openhuman-core/src/profiles/storage_schema_tests.rs
+++ b/crates/openhuman-core/src/profiles/storage_schema_tests.rs
@@ -83,12 +83,8 @@ async fn migrate_cluster_moves_v1_leases_into_tsd_leases_and_keeps_their_epoch()
.unwrap();
migrate_cluster(&scoped).await.unwrap();
migrate_cluster(&scoped).await.unwrap();
- assert!(!docs
- .collections("")
- .await
- .unwrap()
- .iter()
- .any(|name| name == "leases"));
+ assert!(docs.get("leases", "alice").await.unwrap().is_none());
+ assert!(docs.get("leases", "bob").await.unwrap().is_none());
let id = tinystoragedrivers::Key::of([LEASE_OWNER, "alice"]).unwrap();
let moved = docs.get("tsd.leases", id.as_str()).await.unwrap().unwrap();
assert_eq!(
diff --git a/crates/openhuman-core/src/storage/lease_documents.rs b/crates/openhuman-core/src/storage/lease_documents.rs
index 432899d07f..18933c0e52 100644
--- a/crates/openhuman-core/src/storage/lease_documents.rs
+++ b/crates/openhuman-core/src/storage/lease_documents.rs
@@ -293,7 +293,12 @@ impl LeaseStore for DocumentLeases {
"[lease] renewed"
);
let version = self.next_version(&grant.key, lease.epoch)?;
- Ok(Self::grant(&grant.key, &lease, version, grant.previous_unclean))
+ Ok(Self::grant(
+ &grant.key,
+ &lease,
+ version,
+ grant.previous_unclean,
+ ))
}
async fn release(&self, grant: LeaseGrant) -> Result<(), LeaseError> {