Skip to content

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

test(config): cover snapshot binding to backend instance

Steven Enamakelca1b155a7169
diff --git a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
index deb95f8f59..1dd844517f 100644
--- a/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
+++ b/crates/openhuman-core/src/config/schema/load/source/concurrency_tests.rs
@@ -256,6 +256,35 @@ async fn config_snapshot_cannot_be_saved_into_a_different_tenant_scope() {
assert_eq!(tenant_b.default_model.as_deref(), Some("tenant-b"));
}
+#[tokio::test]
+async fn config_snapshot_is_bound_to_its_backend_instance() {
+ let tmp = tempfile::tempdir().unwrap();
+ let storage = MemoryStorage::new();
+ let seed = config_at(tmp.path(), "same-backend");
+ let stale = {
+ let _source = ForcedDocumentSource::new(
+ scoped(&storage, "tenant-backend-instance"),
+ Scope::new("tenant-backend-instance").unwrap(),
+ keys(14),
+ );
+ seed.save().await.unwrap();
+ Config::load_from_config_path(&seed.config_path, &seed.workspace_dir)
+ .await
+ .unwrap()
+ };
+ let error = {
+ let _source = ForcedDocumentSource::new(
+ scoped(&storage, "tenant-backend-instance"),
+ Scope::new("tenant-backend-instance").unwrap(),
+ keys(14),
+ );
+ let mut stale = stale;
+ stale.default_model = Some("must-not-cross-backend-instance".into());
+ stale.save().await.unwrap_err()
+ };
+ assert_typed_conflict(error);
+}
+
#[tokio::test]
async fn document_source_write_uses_its_last_read_revision() {
let tmp = tempfile::tempdir().unwrap();