From c5d71e1991d162290a8b9e141b919c841c0680c2 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 15 Jul 2026 20:25:16 +0100 Subject: [PATCH] Give Idunn ownership of Yggdrasil VoidBot releases --- README.md | 5 +- crates/idunn-daemon/src/main.rs | 63 +++++++++++++++---- ...health-idunn-swarm-deployment-coverage.ps1 | 7 ++- scripts/idunn-deployment-targets.ps1 | 31 +++++---- scripts/linux/idunn-yggdrasil | 8 +++ scripts/restart-voidbot.cmd | 10 --- src/Idunn/README.md | 22 +++++-- 7 files changed, 104 insertions(+), 42 deletions(-) delete mode 100644 scripts/restart-voidbot.cmd diff --git a/README.md b/README.md index 7a38e68..c0ff2b0 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,9 @@ Local package surfaces: - Rust daemon crate: `crates/idunn-daemon` - Rust lifecycle logic: `crates/odin-core/src/idunn.rs` - Runtime store: `scratch/idunn/idunn.keepalive.cc` -- Local VoidBot keepalive: `scripts\health-voidbot.cmd` and - `scripts\restart-voidbot.cmd` +- Hosted VoidBot release: upstream `main` -> Yggdrasil-local Idunn -> the + root-owned `/srv/odin/deploy-manifests/voidbot` actuator. Local checkouts are + development and diagnostics only; do not create a local deployment. - Operator escalation: Bifrost-owned CultMesh crossing; current compatibility delivery calls `scripts\notify-idunn-operator-alarm.ps1`, which asks Bifrost to publish a typed `gamecult.operator_dm_request.v1` CultMesh command document diff --git a/crates/idunn-daemon/src/main.rs b/crates/idunn-daemon/src/main.rs index d966eef..715caac 100644 --- a/crates/idunn-daemon/src/main.rs +++ b/crates/idunn-daemon/src/main.rs @@ -2079,6 +2079,23 @@ fn swarm_targets(options: &SwarmOptions) -> Result> { match options.profile.as_str() { "yggdrasil-local" => Ok(vec![ + DaemonTarget { + daemon_id: "yggdrasil-voidbot".to_string(), + verse_id: "yggdrasil.local".to_string(), + name: "Yggdrasil VoidBot".to_string(), + health_contract: health_contract("voidbot.cultnet-rudp-stack-health", "failed"), + deploy_command: Some(yggdrasil_actuator("deploy", "voidbot")), + restart_command: Some(yggdrasil_actuator("restart", "voidbot")), + release: Some(release_target( + "VoidBot", + PathBuf::from("/srv/build/VoidBot"), + "restart-after-verified-build", + None, + "restart-required", + )), + enabled: true, + interval_seconds: 300, + }, DaemonTarget { daemon_id: "yggdrasil-heimdall".to_string(), verse_id: "yggdrasil.local".to_string(), @@ -2185,17 +2202,6 @@ fn swarm_targets(options: &SwarmOptions) -> Result> { enabled: true, interval_seconds: 30, }, - DaemonTarget { - daemon_id: "voidbot".to_string(), - verse_id: "starfire.local".to_string(), - name: "VoidBot local stack".to_string(), - health_contract: health_contract("voidbot.cultnet-rudp-stack-health", "failed"), - deploy_command: None, - restart_command: Some(script("restart-voidbot.cmd")), - release: None, - enabled: true, - interval_seconds: 300, - }, DaemonTarget { daemon_id: "weksa".to_string(), verse_id: "starfire.local".to_string(), @@ -3815,6 +3821,41 @@ mod tests { ); } + #[test] + fn voidbot_release_authority_is_yggdrasil_local_only() { + let yggdrasil = swarm_targets(&SwarmOptions { + profile: "yggdrasil-local".to_string(), + repo_root: PathBuf::from("/srv/odin/source"), + }) + .expect("yggdrasil-local targets"); + let voidbot = yggdrasil + .iter() + .find(|target| target.daemon_id == "yggdrasil-voidbot") + .expect("Yggdrasil VoidBot target"); + + assert_eq!(voidbot.verse_id, "yggdrasil.local"); + assert_eq!( + voidbot.deploy_command.as_deref(), + Some("sudo -n /usr/local/libexec/idunn-yggdrasil deploy voidbot") + ); + assert_eq!( + voidbot.restart_command.as_deref(), + Some("sudo -n /usr/local/libexec/idunn-yggdrasil restart voidbot") + ); + let release = voidbot.release.as_ref().expect("VoidBot release target"); + assert_eq!(release.repo_path, PathBuf::from("/srv/build/VoidBot")); + assert_eq!(release.upstream_remote, "origin"); + assert_eq!(release.upstream_branch, "main"); + + let starfire = swarm_targets(&SwarmOptions { + profile: "starfire-local".to_string(), + repo_root: PathBuf::from("E:/Projects/Odin"), + }) + .expect("starfire-local targets"); + assert!(starfire.iter().all(|target| target.daemon_id != "voidbot" + && target.daemon_id != "yggdrasil-voidbot")); + } + #[test] fn starfire_and_nightwing_muninn_restart_when_health_publication_is_missing() { let options = SwarmOptions { diff --git a/scripts/health-idunn-swarm-deployment-coverage.ps1 b/scripts/health-idunn-swarm-deployment-coverage.ps1 index 8c5d7e0..03b2a73 100644 --- a/scripts/health-idunn-swarm-deployment-coverage.ps1 +++ b/scripts/health-idunn-swarm-deployment-coverage.ps1 @@ -12,14 +12,17 @@ $deployScriptsWithoutIdunnGuard = @( $IdunnDeploymentTargets | Where-Object { $_.Status -eq "enforced" -and -not [string]::IsNullOrWhiteSpace($_.Deploy) } | Where-Object { + if ($_.Deploy -match '^sudo -n /usr/local/libexec/idunn-yggdrasil deploy [a-z0-9-]+$') { + return $false + } -not (Test-Path -LiteralPath $_.Deploy) -or - -not ((Get-Content -Raw -LiteralPath $_.Deploy) -match 'IDUNN_ACTUATOR') + -not ((Get-Content -Raw -LiteralPath $_.Deploy) -match 'IDUNN_ACTUATOR') } ) $knownActuatorPaths = @{} foreach ($target in $IdunnDeploymentTargets) { foreach ($path in @($target.Deploy, $target.Restart) + @($target.Aliases)) { - if (-not [string]::IsNullOrWhiteSpace($path)) { + if (-not [string]::IsNullOrWhiteSpace($path) -and (Test-Path -LiteralPath $path)) { $knownActuatorPaths[[System.IO.Path]::GetFullPath($path).ToLowerInvariant()] = $target.Id } } diff --git a/scripts/idunn-deployment-targets.ps1 b/scripts/idunn-deployment-targets.ps1 index b65b5da..d36ac46 100644 --- a/scripts/idunn-deployment-targets.ps1 +++ b/scripts/idunn-deployment-targets.ps1 @@ -70,19 +70,6 @@ $IdunnDeploymentTargets = @( Aliases = @() Reason = "Weksa provider state and health are daemon-owned CultMesh/CultNet records; local restart is an Idunn actuator only." }, - [pscustomobject]@{ - Id = "voidbot" - Repo = "VoidBot" - LocalPath = "E:\Projects\VoidBot" - Host = "starfire" - Service = "VoidBot local stack" - Status = "runtime-enforced" - Health = "daemon-published-rudp:voidbot.cultnet-rudp-stack-health" - Deploy = $null - Restart = "$repoRoot\scripts\restart-voidbot.cmd" - Aliases = @() - Reason = "VoidBot stack health and provider state publish through daemon-owned CultMesh/CultNet records; restart is an Idunn actuator only." - }, [pscustomobject]@{ Id = "starfire-muninn" Repo = "Odin" @@ -166,6 +153,24 @@ $IdunnDeploymentTargets = @( ZeroDowntime = "restart-required" Reason = "Nightwing framebuffer compositor has a committed artifact manifest and automatic Idunn deploy lane." }, + [pscustomobject]@{ + Id = "yggdrasil-voidbot" + Repo = "VoidBot" + LocalPath = "/srv/build/VoidBot" + Host = "yggdrasil" + Service = "voidbot.service" + Status = "enforced" + Health = "daemon-published-rudp:voidbot.cultnet-rudp-stack-health" + Deploy = "sudo -n /usr/local/libexec/idunn-yggdrasil deploy voidbot" + Restart = "sudo -n /usr/local/libexec/idunn-yggdrasil restart voidbot" + Aliases = @() + UpstreamRemote = "origin" + UpstreamBranch = "main" + RolloutStrategy = "restart-after-verified-build" + StateMigration = "daemon-owned-noop" + ZeroDowntime = "restart-required" + Reason = "Yggdrasil-local Idunn deploys upstream VoidBot releases through the narrow root-owned manifest; local checkouts have no deployment authority." + }, [pscustomobject]@{ Id = "yggdrasil-bifrost" Repo = "Bifrost" diff --git a/scripts/linux/idunn-yggdrasil b/scripts/linux/idunn-yggdrasil index 136185e..6980a15 100644 --- a/scripts/linux/idunn-yggdrasil +++ b/scripts/linux/idunn-yggdrasil @@ -20,6 +20,14 @@ case "$action:$target" in restart:streampixels) docker compose -f "$compose" restart streampixels-service streampixels-web ;; + deploy:voidbot|restart:voidbot) + manifest="/srv/odin/deploy-manifests/voidbot" + if [ ! -x "$manifest" ] || [ ! -O "$manifest" ]; then + echo "root-owned executable deploy manifest is not installed: $manifest" >&2 + exit 1 + fi + exec "$manifest" "$action" + ;; deploy:heimdall|deploy:repixelizer|deploy:streampixels) manifest="/srv/odin/deploy-manifests/$target" if [ ! -x "$manifest" ] || [ ! -O "$manifest" ]; then diff --git a/scripts/restart-voidbot.cmd b/scripts/restart-voidbot.cmd deleted file mode 100644 index d31bace..0000000 --- a/scripts/restart-voidbot.cmd +++ /dev/null @@ -1,10 +0,0 @@ -@echo off -if not "%IDUNN_ACTUATOR%"=="1" ( - echo restart-voidbot.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2 - exit /b 1 -) -if /I not "%IDUNN_COMMAND_AUTHORITY%"=="idunn-daemon" ( - echo restart-voidbot.cmd is an Idunn actuator body. Redeploy by poking Idunn; direct service restart is not an owned path. 1>&2 - exit /b 1 -) -powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\VoidBot\scripts\start-voidbot-stack.ps1 diff --git a/src/Idunn/README.md b/src/Idunn/README.md index 6171154..de7ccd2 100644 --- a/src/Idunn/README.md +++ b/src/Idunn/README.md @@ -52,10 +52,10 @@ instead of building one more private watchdog. ## Current State -Idunn is a Rust daemon inside Odin's Cargo workspace. The live local runtime is -one long-lived `idunn.exe` process that owns the whole Starfire-local swarm: -Odin, local adjunct daemons, the Yggdrasil deploy lanes, and the Nightwing -display services. Each target declares a daemon-owned health contract and keeps +Idunn is a Rust daemon inside Odin's Cargo workspace. Starfire and Yggdrasil +run separate host-local swarm profiles. Starfire owns its local adjunct daemons +and remote display/telemetry lanes. Yggdrasil owns its hosted release targets, +including VoidBot. Each target declares a daemon-owned health contract and keeps its own interval and deploy/restart authority. Daemon truth comes from typed CultNet/RUDP publication and daemon-owned boundary stores. Shell scripts remain deployment, restart, and manual diagnostic lowerings only; they do not satisfy @@ -63,6 +63,14 @@ health. The scheduler and continuity witness now belong to one Rust process instead of a PowerShell-herded pile of one-daemon workers. +VoidBot deployment authority is deliberately absent from `starfire-local`. +Pushing VoidBot's upstream `main` branch is the release input; Yggdrasil-local +Idunn observes `/srv/build/VoidBot` and invokes only +`sudo -n /usr/local/libexec/idunn-yggdrasil deploy voidbot`. The privileged +actuator delegates deploy and restart to the root-owned executable +`/srv/odin/deploy-manifests/voidbot`. A developer checkout is not a deployment +target and agents must not create a local keepalive or deploy path for VoidBot. + ```text scratch/idunn/idunn.keepalive.cc ``` @@ -126,6 +134,12 @@ To run the built-in Starfire-local swarm profile directly: npm run idunn:start -- --swarm-profile starfire-local --repo-root E:\Projects\Odin --execute ``` +The Yggdrasil service runs the hosted profile directly: + +```sh +/usr/local/bin/idunn --swarm-profile yggdrasil-local --repo-root /srv/odin/source --store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc --rudp-health-bind 10.77.0.1:17870 --execute +``` + Optional store override: ```powershell