From 5820c0e7e6005bc2fcda21cf7e03d7101a0c6a85 Mon Sep 17 00:00:00 2001 From: atlas Date: Sun, 16 Aug 2026 00:49:13 +0200 Subject: [PATCH] fix(hive-c0re): keep the cause in the swarm-status boot warnings Same review catch as the crate side: these two format the queue client's own error with `{:#}`, and thiserror's Display ignores the alternate flag, so the source was silently dropped. The banners read "swarm status publishing is off: swarm queue is half-configured" with no list of missing variables, and "...: connecting to the swarm queue at " with no nats error saying why. These are the two worst places to lose it. `set_boot_warning` is for a one-shot startup step with no retry: the banner leaks until the process restarts, so it is the operator's whole account of what went wrong. --- hive-c0re/src/swarm_status.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/hive-c0re/src/swarm_status.rs b/hive-c0re/src/swarm_status.rs index a32b31fb..822b8564 100644 --- a/hive-c0re/src/swarm_status.rs +++ b/hive-c0re/src/swarm_status.rs @@ -73,10 +73,18 @@ pub fn spawn(mut shutdown: tokio::sync::watch::Receiver) { // A one-shot startup step with no later retry to clear it — // exactly what `set_boot_warning` is for. The fix is a // redeploy, which restarts this process anyway. + // + // `chain`, not `{:#}`: this is the queue client's own error + // type, whose Display ignores the alternate flag, so `{:#}` + // would show only "swarm queue is half-configured" and drop + // which variables are missing. crate::warnings::set_boot_warning( "swarm_status_config", "warn", - format!("swarm status publishing is off: {e:#}"), + format!( + "swarm status publishing is off: {}", + swarm_queue_client::chain(&e) + ), ); return; } @@ -100,10 +108,16 @@ pub fn spawn(mut shutdown: tokio::sync::watch::Receiver) { let client = match swarm_queue_client::connect(cfg).await { Ok(client) => client, Err(e) => { + // `chain` for the same reason as above: without it this + // banner reads "connecting to the swarm queue at " + // and drops the nats error that says why. crate::warnings::set_boot_warning( "swarm_status_config", "warn", - format!("swarm status publishing is off: {e:#}"), + format!( + "swarm status publishing is off: {}", + swarm_queue_client::chain(&e) + ), ); return; }