From ae9c3444bc45b5242e73596d2e90ed02d6a0842a Mon Sep 17 00:00:00 2001 From: damocles Date: Wed, 28 Oct 2026 21:07:32 +0100 Subject: [PATCH] test the invite room check and the no-homeserver sweep, drop the last space wording --- hive-c0re/src/matrix.rs | 23 ++++++++++++++++++++++ nix/host-modules/hive-c0re/environment.nix | 2 +- nix/host-modules/hive-matrix-service.nix | 3 +-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/hive-c0re/src/matrix.rs b/hive-c0re/src/matrix.rs index 0318d639..d92a98aa 100644 --- a/hive-c0re/src/matrix.rs +++ b/hive-c0re/src/matrix.rs @@ -460,4 +460,27 @@ mod tests { assert!(!message.contains("free-form-marker"), "{message}"); } } + + /// A room that is neither an id nor an alias is refused before any + /// request is made; with no default Space left, there is nothing to fall + /// back to. + #[tokio::test] + async fn invite_user_refuses_a_room_that_is_neither_an_id_nor_an_alias() { + let client = swarm_matrix_client::client().expect("client"); + let err = invite_user(&client, "tok", "mara", "general", "example.org") + .await + .expect_err("a bare name is not a room"); + assert!( + format!("{err:#}").contains("neither a room id nor an alias"), + "{err:#}" + ); + } + + /// The sweep touches nothing, and reports success, on a hive with no + /// homeserver configured (the test environment has none). + #[tokio::test] + async fn the_sweep_is_a_successful_no_op_without_a_homeserver() { + assert!(!is_present()); + assert!(ensure_all().await); + } } diff --git a/nix/host-modules/hive-c0re/environment.nix b/nix/host-modules/hive-c0re/environment.nix index 2f32ea48..e89d5c80 100644 --- a/nix/host-modules/hive-c0re/environment.nix +++ b/nix/host-modules/hive-c0re/environment.nix @@ -170,7 +170,7 @@ in } // lib.optionalAttrs (config.services.hyperhive.swarm.matrix.apiUrl != null) { # Client-server API base hive-c0re uses to provision matrix (register - # agent users, create the hive space, invite members). + # agent users, invite members). # Supplied by `services.hyperhive.swarm.matrix.apiUrl`, which defaults to # the same gateway vhost as HIVE_MATRIX_URL above, over https because it # carries the hive's matrix token and may cross the network. Its own diff --git a/nix/host-modules/hive-matrix-service.nix b/nix/host-modules/hive-matrix-service.nix index 53292fc9..5cfa49f1 100644 --- a/nix/host-modules/hive-matrix-service.nix +++ b/nix/host-modules/hive-matrix-service.nix @@ -59,8 +59,7 @@ in example = "https://matrix.example.com"; description = '' Client-server API base URL **hive-c0re itself** uses to - provision matrix (register agent users, create the hive space, - invite members). Distinct from the agent-facing + provision matrix (register agent users, invite members). Distinct from the agent-facing `services.hyperhive.agent.matrix.url`, which is the gateway vhost handed to each agent's `hive-matrix-daemon`.