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 <url>" 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.
This commit is contained in:
atlas 2026-08-16 00:49:13 +02:00
commit 5820c0e7e6

View file

@ -73,10 +73,18 @@ pub fn spawn(mut shutdown: tokio::sync::watch::Receiver<bool>) {
// 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<bool>) {
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 <url>"
// 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;
}