Skip to content

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

fix(driver_tests): correct test assertion for subsystem state

Steven Enamakelec09134472ef
diff --git a/crates/openhuman-core/src/core/subsystem/driver_tests.rs b/crates/openhuman-core/src/core/subsystem/driver_tests.rs
index a2a6ca741a..433cfa4ca3 100644
--- a/crates/openhuman-core/src/core/subsystem/driver_tests.rs
+++ b/crates/openhuman-core/src/core/subsystem/driver_tests.rs
@@ -87,42 +87,6 @@ fn driver_health_display_includes_the_reason() {
);
}
-/// Drift guard for the boundary conversion that lands with the memory adapter.
-///
-/// The contract crate's `health` module states that `MemoryHealth` is shaped
-/// one-for-one against the kernel's `Ready | Degraded { reason } | Down
-/// { reason }` so the conversion is trivial and lossless. This asserts that,
-/// pairwise, on the serialized form — so a fourth state, a renamed
-/// discriminant, or an extra field on either side fails here rather than
-/// silently making the conversion partial.
-#[test]
-fn driver_health_shape_matches_memory_health_one_for_one() {
- use tinymemory_api::health::MemoryHealth;
-
- let pairs: Vec<(MemoryHealth, DriverHealth)> = vec![
- (MemoryHealth::Ready, DriverHealth::Ready),
- (
- MemoryHealth::degraded("index rebuilding"),
- DriverHealth::degraded("index rebuilding"),
- ),
- (
- MemoryHealth::down("connection refused"),
- DriverHealth::down("connection refused"),
- ),
- ];
- assert_eq!(pairs.len(), 3, "both enums have exactly three states");
-
- for (contract, kernel) in pairs {
- assert_eq!(contract.as_str(), kernel.as_str());
- assert_eq!(contract.reason(), kernel.reason());
- assert_eq!(contract.is_usable(), kernel.is_usable());
- assert_eq!(
- serde_json::to_value(&contract).expect("contract health serializes"),
- serde_json::to_value(&kernel).expect("kernel health serializes"),
- );
- }
-}
-
#[test]
fn driver_capabilities_round_trips_through_json() {
let caps = DriverCapabilities::empty()
@@ -182,37 +146,3 @@ fn driver_capabilities_contains_all_is_subset_semantics() {
assert!(advertised.contains_all(&DriverCapabilities::empty()));
}
-/// The kernel's opaque-string set must be able to carry every family the memory
-/// contract defines, losslessly and through the wire form — that is what makes
-/// the future boundary conversion total without the kernel knowing what a
-/// memory capability is.
-#[test]
-fn every_memory_contract_capability_string_maps_into_driver_capabilities() {
- use tinymemory_api::capabilities::Capability;
-
- let caps: DriverCapabilities = Capability::ALL.iter().map(|cap| cap.as_str()).collect();
-
- assert_eq!(caps.len(), Capability::ALL.len());
- // A literal, so adding a family forces a look at this test rather than
- // sliding past it. 13 → 17 when the port added People, Chunks, Retrieval
- // and Profile, then 18 with Episodic, then 20 when tinymemory v1.7.0 added
- // SourceSync and CodingSessions, then 21 with v1.13.2 adding Scoring,
- // then 26 with v1.13.7's typed-ingestion round (Document/Conversation/
- // Learning/Event ingest and Answer), then 27 with v1.21.0's
- // EpisodicPortability. The assertion above is the
- // load-bearing one: it says the mapping is lossless, which is what makes
- // the kernel's opaque-string set able to carry the contract without
- // knowing what a memory capability is.
- assert_eq!(caps.len(), 27);
- assert!(
- caps.contains("tool_memory"),
- "the one non-identity snake_case family must survive"
- );
- for cap in Capability::ALL {
- assert!(caps.contains(cap.as_str()), "missing {cap}");
- }
-
- let encoded = serde_json::to_value(&caps).expect("serializes");
- let decoded: DriverCapabilities = serde_json::from_value(encoded).expect("deserializes");
- assert_eq!(decoded, caps);
-}