refactor(#2285): repoint all hive-c0re host-path consumers to paths.rs

This commit is contained in:
damocles 2026-07-10 19:52:38 +02:00 committed by mara
commit 187c364feb
16 changed files with 95 additions and 125 deletions

View file

@ -13,8 +13,6 @@ use tokio::sync::Mutex;
use crate::coordinator::HiveEnv;
use crate::lifecycle;
const META_ROOT: &str = "/var/lib/hyperhive/meta";
const APPLIED_ROOT: &str = "/var/lib/hyperhive/applied";
const GIT_NAME: &str = "c0re";
const GIT_EMAIL: &str = "c0re@hyperhive.local";
@ -60,7 +58,7 @@ pub struct AgentSpec {
#[must_use]
pub fn meta_dir() -> PathBuf {
PathBuf::from(META_ROOT)
crate::paths::meta_root()
}
/// Idempotently reconcile the meta repo with the current agent set.
@ -840,7 +838,7 @@ fn ca_embed_state(dir: &std::path::Path) -> (Vec<(String, String)>, bool) {
/// Returns an empty vec when the lock is missing or unparsable —
/// safe degradation, the worst case is no dedup for that agent.
fn agent_canonical_inputs(name: &str) -> Vec<&'static str> {
let path = std::path::PathBuf::from(format!("{APPLIED_ROOT}/{name}/flake.lock"));
let path = crate::paths::applied_dir(name).join("flake.lock");
let Ok(raw) = std::fs::read_to_string(&path) else {
return Vec::new();
};
@ -931,8 +929,9 @@ where
for spec in agents {
let _ = writeln!(
out,
" agent-{}.url = \"git+file://{APPLIED_ROOT}/{}\";",
spec.name, spec.name,
" agent-{}.url = \"git+file://{}\";",
spec.name,
crate::paths::applied_dir(&spec.name).display(),
);
// For each canonical input the agent declares in its own
// `flake.nix` (detected by reading its applied `flake.lock`),