From 1042bf65db008cd5cc3aeb7eb85e1e48ac11feeb Mon Sep 17 00:00:00 2001 From: atlas Date: Mon, 9 Nov 2026 23:40:38 +0100 Subject: [PATCH] pause_hold: pin the undeclared-agent case and fix the test comment --- swarm-controller/src/pause_hold.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/swarm-controller/src/pause_hold.rs b/swarm-controller/src/pause_hold.rs index d6bdc51a9..ce71eb58a 100644 --- a/swarm-controller/src/pause_hold.rs +++ b/swarm-controller/src/pause_hold.rs @@ -109,8 +109,7 @@ mod tests { assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Paused)); } - /// An operator's `Offline` is not overruled by the agent's pause, and an - /// agent no hive declares leaves the pause to be tried again. + /// An operator's `Offline` is not overruled by the agent's pause. #[tokio::test] async fn only_an_agent_declared_up_is_paused() { let nats = TestNats::start(); @@ -130,4 +129,24 @@ mod tests { assert_eq!(declared(&wanted, "atlas").await, Some(AgentState::Offline)); assert!(login.unheld_pauses().is_empty(), "nothing left to hold"); } + + /// An agent no hive declares has nothing to override: its pause is held at + /// once and nothing is written to any declaration. + #[tokio::test] + async fn an_undeclared_agent_is_held_at_once_and_nothing_is_declared() { + let nats = TestNats::start(); + let wanted = WantedWriter::new(nats.client().await); + let hives = vec!["pr1ma".to_owned()]; + let login = Reported::default(); + login.record( + &swarm_queue_client::agent_state_subject("atlas"), + &header(Some("skipped get_loose_ends")), + ); + assert_eq!(login.unheld_pauses(), ["atlas"], "control: pending first"); + + hold_pending(&login, &wanted, &hives).await; + assert!(login.unheld_pauses().is_empty(), "held at once"); + assert_eq!(declared(&wanted, "atlas").await, None); + assert!(wanted.view("pr1ma").await.unwrap().is_none()); + } }