Skip to content

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

chore: remove unused document store modules

Steven Enamakel7d87c06b6273
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
index 66b3df78f1..ce5acb2db7 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents.rs
@@ -36,9 +36,34 @@ fn collections() -> Vec<CollectionSpec> {
/// The document store for this call, when the host configured one.
pub(super) fn current() -> Result<Option<Docs>> {
+ #[cfg(test)]
+ if let Some(docs) = TEST_OVERRIDE.with(|slot| slot.borrow().clone()) {
+ return Ok(Some(docs));
+ }
Ok(Repo::current(DOMAIN, collections)?.map(Docs))
}
+/// Whether a test pinned a document store for this thread.
+#[cfg(test)]
+pub(super) fn overridden() -> bool {
+ TEST_OVERRIDE.with(|slot| slot.borrow().is_some())
+}
+
+/// Runs `f` with `docs` standing in for the installed backend, on this thread
+/// only, so tests exercise the dispatch without the process-wide slot.
+#[cfg(test)]
+pub(super) fn with_override<T>(docs: Docs, f: impl FnOnce() -> T) -> T {
+ TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = Some(docs));
+ let out = f();
+ TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = None);
+ out
+}
+
+#[cfg(test)]
+thread_local! {
+ static TEST_OVERRIDE: std::cell::RefCell<Option<Docs>> = const { std::cell::RefCell::new(None) };
+}
+
/// The session list over one scoped document handle.
pub(super) struct Docs(Repo);
diff --git a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
index 82f2ad4eb0..e5b06b3088 100644
--- a/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
+++ b/crates/openhuman-core/src/integrations/composio/file_store_documents.rs
@@ -32,9 +32,34 @@ fn collections() -> Vec<CollectionSpec> {
/// The document store for this call, when the host configured one.
pub(super) fn current() -> Result<Option<Docs>> {
+ #[cfg(test)]
+ if let Some(docs) = TEST_OVERRIDE.with(|slot| slot.borrow().clone()) {
+ return Ok(Some(docs));
+ }
Ok(Repo::current(DOMAIN, collections)?.map(Docs))
}
+/// Whether a test pinned a document store for this thread.
+#[cfg(test)]
+pub(super) fn overridden() -> bool {
+ TEST_OVERRIDE.with(|slot| slot.borrow().is_some())
+}
+
+/// Runs `f` with `docs` standing in for the installed backend, on this thread
+/// only, so tests exercise the dispatch without the process-wide slot.
+#[cfg(test)]
+pub(super) fn with_override<T>(docs: Docs, f: impl FnOnce() -> T) -> T {
+ TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = Some(docs));
+ let out = f();
+ TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = None);
+ out
+}
+
+#[cfg(test)]
+thread_local! {
+ static TEST_OVERRIDE: std::cell::RefCell<Option<Docs>> = const { std::cell::RefCell::new(None) };
+}
+
fn id_of(path: &Path) -> Result<String> {
path.file_name()
.map(|name| name.to_string_lossy().into_owned())
diff --git a/crates/openhuman-core/src/platform/cost/tracker_documents.rs b/crates/openhuman-core/src/platform/cost/tracker_documents.rs
index 8d420802a1..31ab233f36 100644
--- a/crates/openhuman-core/src/platform/cost/tracker_documents.rs
+++ b/crates/openhuman-core/src/platform/cost/tracker_documents.rs
@@ -33,9 +33,34 @@ fn collections() -> Vec<CollectionSpec> {
/// The document store for this call, when the host configured one.
pub(super) fn current() -> Result<Option<CostDocs>> {
+ #[cfg(test)]
+ if let Some(docs) = TEST_OVERRIDE.with(|slot| slot.borrow().clone()) {
+ return Ok(Some(docs));
+ }
Ok(Repo::current(DOMAIN, collections)?.map(CostDocs))
}
+/// Whether a test pinned a document store for this thread.
+#[cfg(test)]
+pub(super) fn overridden() -> bool {
+ TEST_OVERRIDE.with(|slot| slot.borrow().is_some())
+}
+
+/// Runs `f` with `docs` standing in for the installed backend, on this thread
+/// only, so tests exercise the dispatch without the process-wide slot.
+#[cfg(test)]
+pub(super) fn with_override<T>(docs: CostDocs, f: impl FnOnce() -> T) -> T {
+ TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = Some(docs));
+ let out = f();
+ TEST_OVERRIDE.with(|slot| *slot.borrow_mut() = None);
+ out
+}
+
+#[cfg(test)]
+thread_local! {
+ static TEST_OVERRIDE: std::cell::RefCell<Option<CostDocs>> = const { std::cell::RefCell::new(None) };
+}
+
/// The cost ledger over one scoped document handle.
pub(super) struct CostDocs(Repo);