Skip to content

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

feat(modules): add registry contract tests

Steven Enamakel5d16a9ff25c5
diff --git a/crates/openhuman-core/src/modules/registry.rs b/crates/openhuman-core/src/modules/registry.rs
index 6ba637af80..a0e02b3f02 100644
--- a/crates/openhuman-core/src/modules/registry.rs
+++ b/crates/openhuman-core/src/modules/registry.rs
@@ -71,7 +71,7 @@ use records_voice::TINYVOICE;
/// Every module this build can load. The records whose contract crate is an
/// optional dependency (`documents`, `web3`, `voice`, `hosting`, `tinymemes`) exist only when
-/// that gate is on; a product-feature build carries all twelve.
+/// that gate is on; a product-feature build carries all thirteen.
pub const ALL: &[ModuleRecord] = &[
TINYCOMPUTER,
TINYSEARCH,
diff --git a/crates/openhuman-core/src/modules/registry_contract_tests.rs b/crates/openhuman-core/src/modules/registry_contract_tests.rs
index 189a470193..2dbfd064ff 100644
--- a/crates/openhuman-core/src/modules/registry_contract_tests.rs
+++ b/crates/openhuman-core/src/modules/registry_contract_tests.rs
@@ -41,6 +41,9 @@ fn contract_names() -> Vec<(&'static str, &'static str, &'static str)> {
tinychannels_bus::names::BUS_NAME,
tinychannels_bus::names::OBJECT_PATH,
),
+ // The Authoring identity the module registers under; the scheduler is
+ // a second object on it (pinned by `the_flows_record_serves_the_schedule_object`).
+ ("tinyflows", tinyflows_bus::BUS_NAME, tinyflows_bus::OBJECT_PATH),
];
#[cfg(feature = "modules")]
names.push(("tinybox", tinybox_bus::INTERFACE, tinybox_bus::OBJECT_PATH));
@@ -111,8 +114,8 @@ fn a_drifted_contract_constant_is_reported_as_a_mismatch() {
feature = "tinymemes"
))]
#[test]
-fn a_product_feature_build_carries_all_twelve_records() {
- assert_eq!(ALL.len(), 12);
+fn a_product_feature_build_carries_all_thirteen_records() {
+ assert_eq!(ALL.len(), 13);
for id in [
"tinycomputer",
"tinysearch",
@@ -124,6 +127,7 @@ fn a_product_feature_build_carries_all_twelve_records() {
"tinyconnectors",
"tinybox",
"tinychannels",
+ "tinyflows",
"tinyhosts",
"tinymemes",
] {
@@ -153,3 +157,36 @@ fn every_record_maps_to_a_real_component() {
);
}
}
+
+/// The scheduler is a second interface on the same module, and the host calls
+/// it by the contract's own names: the record carries the Authoring identity,
+/// and the Schedule object and callback interfaces are distinct from it and from
+/// each other.
+#[test]
+fn the_flows_record_serves_the_schedule_object() {
+ use tinyflows_bus::schedule;
+ let record = find("tinyflows").expect("tinyflows is registered");
+ assert_eq!(record.bus_name, schedule::BUS_NAME);
+ assert_ne!(record.object_path, schedule::OBJECT_PATH);
+ assert_ne!(schedule::INTERFACE, schedule::CALLBACK_INTERFACE);
+ assert_ne!(schedule::INTERFACE, schedule::DOCUMENT_INTERFACE);
+ assert_eq!(schedule::CONTRACT_VERSION, 3, "the host speaks contract v3");
+ assert_eq!(component_for("tinyflows"), Some("tinyflows"));
+}
+
+/// The pins are the published v0.8.21 `checksum.toml`, a placeholder until
+/// v0.8.22 (the first release with contract v3) is cut and re-pinned.
+#[test]
+fn the_flows_record_pins_every_host_of_one_release() {
+ let record = find("tinyflows").unwrap();
+ assert_eq!(record.version, "0.8.21", "TODO(repin v0.8.22)");
+ assert_eq!(record.assets.len(), 11);
+ for asset in record.assets {
+ assert!(
+ asset.archive.starts_with("tinyflows-module-0.8.21-"),
+ "{}",
+ asset.archive
+ );
+ assert_eq!(asset.sha256.len(), 64, "{}", asset.archive);
+ }
+}