From dc3d6bc753c35f6a2fa94a2c3d95cdf6f4f57f63 Mon Sep 17 00:00:00 2001 From: atlas Date: Mon, 22 Jun 2026 19:01:55 +0200 Subject: [PATCH] fix(#1897): treat empty HYPERHIVE_HIVE_DOMAIN as unset in HiveDomain MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per argus review: std::env::var(..).ok() yields Some("") for an empty env value, so require_hive_domain would 'succeed' with an empty domain and emit invalid nix (swarm.peers."" = …). Filter empty so it resolves to None → the CLI's clear 'domain unset' error fires instead. --- hive-c0re/src/server.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hive-c0re/src/server.rs b/hive-c0re/src/server.rs index fb7d05b2..2248cb90 100644 --- a/hive-c0re/src/server.rs +++ b/hive-c0re/src/server.rs @@ -117,9 +117,13 @@ async fn dispatch(req: &HostRequest, coord: Arc) -> HostResponse { // The hive domain is injected into c0re's service env by // hive-c0re.nix (`HYPERHIVE_HIVE_DOMAIN`); surface it so the // operator CLI can fill in this hive's own identity. - HostRequest::HiveDomain => { - HostResponse::hive_domain(std::env::var("HYPERHIVE_HIVE_DOMAIN").ok()) - } + HostRequest::HiveDomain => HostResponse::hive_domain( + // Treat an empty env value as unset — otherwise the CLI + // would emit `swarm.peers."" = …`, invalid nix. + std::env::var("HYPERHIVE_HIVE_DOMAIN") + .ok() + .filter(|d| !d.is_empty()), + ), HostRequest::Pending => HostResponse::pending(coord.approvals.pending()?), HostRequest::Approve { id } => { actions::approve(coord.clone(), *id).await?;