Publish Idunn daemon surgery plans

This commit is contained in:
Meta Vens 2026-06-15 21:47:53 +01:00
commit 8038af1819
5 changed files with 304 additions and 14 deletions

View file

@ -1,8 +1,9 @@
use anyhow::{Context, Result, anyhow};
use cultmesh_rs::{CultMesh, CultMeshNode, CultMeshNodeOptions};
use odin_core::{
IdunnDaemonHealthRecord, IdunnDeploymentResultRecord, IdunnDesiredDaemonRecord,
IdunnOperatorAlarmRecord, IdunnRestartResultRecord, OdinDocuments, plan_keepalive,
IdunnDaemonHealthRecord, IdunnDaemonSurgeryPlanRecord, IdunnDeploymentResultRecord,
IdunnDesiredDaemonRecord, IdunnOperatorAlarmRecord, IdunnRestartResultRecord, OdinDocuments,
plan_keepalive,
};
use std::env;
use std::path::PathBuf;
@ -99,6 +100,9 @@ fn run_swarm(options: &SwarmOptions, common: &CommonOptions) -> Result<()> {
println!("CultMesh store: {}", common.store_path.display());
let store_lock = Arc::new(Mutex::new(()));
let now = timestamp()?;
publish_daemon_surgery_plans(&targets, common, &store_lock, &now)?;
let mut workers = Vec::with_capacity(targets.len());
for target in targets {
let worker_common = common.clone();
@ -305,6 +309,197 @@ where
write(&mut node)
}
fn publish_daemon_surgery_plans(
targets: &[DaemonTarget],
options: &CommonOptions,
store_lock: &Arc<Mutex<()>>,
updated_at: &str,
) -> Result<()> {
let plans = daemon_surgery_plans(targets, updated_at);
with_store_node(options, store_lock, |node| {
for plan in &plans {
node.put(&plan.plan_id, plan)?;
}
Ok(())
})
}
fn daemon_surgery_plans(
targets: &[DaemonTarget],
updated_at: &str,
) -> Vec<IdunnDaemonSurgeryPlanRecord> {
targets
.iter()
.map(|target| daemon_surgery_plan(target, updated_at))
.collect()
}
fn daemon_surgery_plan(target: &DaemonTarget, updated_at: &str) -> IdunnDaemonSurgeryPlanRecord {
let mut severity = "high";
let mut status = "transport-surgery-required";
let mut owner = "daemon-owned CultLib update";
let mut objective = format!(
"{} publishes daemon-owned health, provider state, command boundary, and transport profile through CultNet/RUDP.",
target.name
);
let mut current_mechanism = format!(
"Idunn target {} currently uses local compatibility health command {:?} under contract {}.",
target.daemon_id, target.health_command, target.health_contract.id
);
let mut intended_authority = "Daemon publishes typed CultMesh/CultNet documents over cultnet.transport.rudp.v0; Idunn consumes those records and only actuates advertised lifecycle commands.".to_string();
let mut cut_line = "Cut HTTP, WebSocket, SSH, systemd, and command-exit probes as sources of daemon truth once the daemon's CultLib can publish the RUDP health contract.".to_string();
let mut steps = vec![
"Update the daemon's runtime CultLib dependency to a build that can speak CultNet over RUDP.".to_string(),
"Publish daemon_health, provider_advertisement, command_boundary, and transport_profile typed records over cultnet.transport.rudp.v0.".to_string(),
"Teach Odin to accept the daemon's RUDP provider records into the service/catalog surface.".to_string(),
"Switch Idunn from the compatibility health command to the daemon-owned RUDP health record.".to_string(),
"Delete or demote the old probe to a xenos-boundary compatibility check with no lifecycle authority.".to_string(),
];
let mut blockers = Vec::new();
match target.daemon_id.as_str() {
"odin" => {
severity = "critical";
owner = "Odin core";
current_mechanism =
"Odin still exposes local health and Eve deck compatibility surfaces over HTTP/WebSocket while Idunn verifies liveness through a command probe."
.to_string();
intended_authority =
"Odin owns accepted Verse discovery and provider catalog truth as typed CultMesh/CultNet records over cultnet.transport.rudp.v0."
.to_string();
cut_line =
"HTTP/WebSocket deck and health endpoints become browser/lowering bridges only; they no longer decide daemon health, discovery, or provider truth."
.to_string();
steps[2] =
"Make Odin ingest RUDP provider advertisements directly into its accepted service/catalog surface."
.to_string();
}
"nightwing-gjallar" => {
severity = "critical";
owner = "Gjallar C# runtime plus Odin provider feed";
current_mechanism =
"Gjallar currently proves visible composition through service checks and /var/log/gjallar.status, fed by Odin's WebSocket deck compatibility bridge."
.to_string();
intended_authority =
"Gjallar subscribes to Odin/provider deck state over CultNet/RUDP and publishes framebuffer composition health as typed CultMesh/CultNet state."
.to_string();
cut_line =
"Cut Odin WebSocket deck consumption as the compositor truth path; keep it only as a browser/debug lowering if needed."
.to_string();
blockers
.push("Requires native C# CultNet/RUDP subscription path for Gjallar.".to_string());
}
"stonks" => {
owner = "Stonks TypeScript runtime";
current_mechanism =
"Stonks has a repaired CultCache startup path, but health and market projection are still checked through local HTTP/WebSocket compatibility surfaces."
.to_string();
blockers.push("Requires TypeScript CultLib RUDP publication support.".to_string());
}
"mimir-eve-dashboard" => {
severity = "high";
owner = "Mimir dashboard runtime";
current_mechanism =
"Mimir dashboard health is currently a local compatibility probe with no Idunn restart authority."
.to_string();
blockers.push(
"No restart/deploy command authority is currently advertised to Idunn.".to_string(),
);
}
"weksa" => {
severity = "medium-high";
owner = "Weksa provider runtime";
current_mechanism =
"Weksa has provider advertisement bones, but Idunn still relies on compatibility process/health probes."
.to_string();
}
"voidbot" => {
severity = "medium-high";
owner = "VoidBot internal provider stack";
current_mechanism =
"VoidBot has CultMesh/CultCache swarm state, but Idunn still treats stack health through a compatibility command; Discord remains an external xenos boundary."
.to_string();
intended_authority =
"VoidBot publishes internal swarm, repo-face, and provider health over CultNet/RUDP; Discord delivery remains a boundary adapter, never daemon truth."
.to_string();
}
"starfire-muninn" | "muninn" | "nightwing-muninn" => {
owner = "Muninn Rust runtime";
current_mechanism =
"Muninn has typed telemetry state, but Idunn still validates continuity through local or remote script probes."
.to_string();
intended_authority =
"Muninn publishes telemetry, Quest/Move access, and daemon health over CultNet/RUDP; activation commands remain separate from keepalive."
.to_string();
}
"vili" => {
owner = "Vili animation runtime";
current_mechanism =
"Vili is watched through compatibility health/deck checks instead of daemon-owned CultNet/RUDP animation health."
.to_string();
}
"nightwing-eve-dashboard" | "nightwing-eve-browser-reference" => {
severity = "medium";
owner = "Eve lowering/runtime owner";
current_mechanism =
"Nightwing Eve runtime services are watched through local service probes; browser-facing transports are lowering bridges."
.to_string();
intended_authority =
"Eve runtimes subscribe to provider-owned CultMesh/CultNet state; any browser/WebSocket bridge is display-only and does not own daemon health."
.to_string();
cut_line =
"Cut display/runtime liveness from provider truth. Browser-compatible bridges may remain only as lowering targets."
.to_string();
}
"yggdrasil-heimdall" | "yggdrasil-repixelizer" | "yggdrasil-streampixels" => {
severity = "medium";
owner = "Yggdrasil service owner plus gamecult-ops deploy lane";
current_mechanism =
"Yggdrasil source apps are currently checked and deployed through SSH/systemd/source-artifact compatibility scripts."
.to_string();
intended_authority =
"Public HTTP remains the product boundary, but deployment freshness, daemon health, and lifecycle commands publish as internal CultNet/RUDP state."
.to_string();
cut_line =
"SSH/systemd probes stop deciding freshness once hosted services publish internal RUDP health and deployment manifests."
.to_string();
}
"idunn-swarm-deployment-coverage" => {
severity = "medium";
status = "catalog-coherence-probe";
owner = "Idunn";
objective =
"Keep Idunn's deployment target catalog honest while daemon-owned RUDP publication is being installed."
.to_string();
current_mechanism =
"A local coverage command verifies deployment authority categories for the swarm target catalog."
.to_string();
intended_authority =
"Daemon provider advertisements and command_boundary records make deploy/restart ownership inspectable without a local coverage shim."
.to_string();
cut_line =
"Delete this probe after every deployable daemon publishes command_boundary and transport_profile over CultNet/RUDP."
.to_string();
}
_ => {}
}
IdunnDaemonSurgeryPlanRecord {
plan_id: format!("surgery:{}", target.daemon_id),
daemon_id: target.daemon_id.clone(),
severity: severity.to_string(),
status: status.to_string(),
owner: owner.to_string(),
objective,
current_mechanism,
intended_authority,
cut_line,
steps,
blockers,
updated_at: updated_at.to_string(),
}
}
fn swarm_targets(options: &SwarmOptions) -> Result<Vec<DaemonTarget>> {
let repo_root = options.repo_root.display().to_string();
let script = |name: &str| format!(r"{}\scripts\{}", repo_root, name);
@ -384,7 +579,10 @@ fn swarm_targets(options: &SwarmOptions) -> Result<Vec<DaemonTarget>> {
daemon_id: "muninn".to_string(),
verse_id: "raven.local".to_string(),
name: "Muninn telemetry Verse assembler".to_string(),
health_contract: health_contract("muninn.cultnet-rudp-remote-telemetry-health", "failed"),
health_contract: health_contract(
"muninn.cultnet-rudp-remote-telemetry-health",
"failed",
),
health_command: Some(script("health-muninn.cmd")),
deploy_command: None,
restart_command: Some(script("restart-muninn.cmd")),
@ -487,7 +685,10 @@ fn swarm_targets(options: &SwarmOptions) -> Result<Vec<DaemonTarget>> {
daemon_id: "nightwing-eve-dashboard".to_string(),
verse_id: "nightwing.local".to_string(),
name: "Nightwing Eve dashboard broker".to_string(),
health_contract: health_contract("nightwing.cultnet-rudp-eve-dashboard-health", "failed"),
health_contract: health_contract(
"nightwing.cultnet-rudp-eve-dashboard-health",
"failed",
),
health_command: Some(script("health-nightwing-eve-dashboard.cmd")),
deploy_command: None,
restart_command: Some(script("restart-nightwing-eve-dashboard.cmd")),
@ -498,7 +699,10 @@ fn swarm_targets(options: &SwarmOptions) -> Result<Vec<DaemonTarget>> {
daemon_id: "nightwing-eve-browser-reference".to_string(),
verse_id: "nightwing.local".to_string(),
name: "Nightwing Eve browser reference".to_string(),
health_contract: health_contract("nightwing.cultnet-rudp-browser-reference-health", "failed"),
health_contract: health_contract(
"nightwing.cultnet-rudp-browser-reference-health",
"failed",
),
health_command: Some(script("health-nightwing-eve-browser-reference.cmd")),
deploy_command: None,
restart_command: Some(script("restart-nightwing-eve-browser-reference.cmd")),

View file

@ -19,6 +19,7 @@ pub const IDUNN_RESTART_RESULT_SCHEMA: &str = "idunn.restart_result.v1";
pub const IDUNN_DEPLOYMENT_REQUEST_SCHEMA: &str = "idunn.deployment_request.v1";
pub const IDUNN_DEPLOYMENT_RESULT_SCHEMA: &str = "idunn.deployment_result.v1";
pub const IDUNN_OPERATOR_ALARM_SCHEMA: &str = "idunn.operator_alarm.v1";
pub const IDUNN_DAEMON_SURGERY_PLAN_SCHEMA: &str = "idunn.daemon_surgery_plan.v1";
pub const MUNINN_TELEMETRY_SURFACE_SCHEMA: &str = "muninn.telemetry_surface.v1";
pub const MUNINN_CAPTURE_STREAM_SCHEMA: &str = "muninn.capture_stream.v1";
pub const MUNINN_OBS_STREAM_CATALOG_SCHEMA: &str = "muninn.obs_stream_catalog.v1";
@ -341,6 +342,38 @@ pub struct IdunnOperatorAlarmRecord {
pub raised_at: String,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "idunn.daemon_surgery_plan",
schema = "idunn.daemon_surgery_plan.v1"
)]
pub struct IdunnDaemonSurgeryPlanRecord {
#[cultcache(key = 0)]
pub plan_id: String,
#[cultcache(key = 1)]
pub daemon_id: String,
#[cultcache(key = 2)]
pub severity: String,
#[cultcache(key = 3)]
pub status: String,
#[cultcache(key = 4)]
pub owner: String,
#[cultcache(key = 5)]
pub objective: String,
#[cultcache(key = 6)]
pub current_mechanism: String,
#[cultcache(key = 7)]
pub intended_authority: String,
#[cultcache(key = 8)]
pub cut_line: String,
#[cultcache(key = 9)]
pub steps: Vec<String>,
#[cultcache(key = 10)]
pub blockers: Vec<String>,
#[cultcache(key = 11)]
pub updated_at: String,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(type = "muninn.capture_stream", schema = "muninn.capture_stream.v1")]
pub struct MuninnCaptureStreamRecord {
@ -576,6 +609,7 @@ cultmesh_rs::cultmesh_documents!(OdinDocuments {
IdunnDeploymentRequestRecord => IDUNN_DEPLOYMENT_REQUEST_SCHEMA,
IdunnDeploymentResultRecord => IDUNN_DEPLOYMENT_RESULT_SCHEMA,
IdunnOperatorAlarmRecord => IDUNN_OPERATOR_ALARM_SCHEMA,
IdunnDaemonSurgeryPlanRecord => IDUNN_DAEMON_SURGERY_PLAN_SCHEMA,
MuninnTelemetrySurfaceRecord => MUNINN_TELEMETRY_SURFACE_SCHEMA,
MuninnCaptureStreamRecord => MUNINN_CAPTURE_STREAM_SCHEMA,
MuninnObsStreamCatalogRecord => MUNINN_OBS_STREAM_CATALOG_SCHEMA,

View file

@ -175,7 +175,10 @@ fn decision(
#[cfg(test)]
mod tests {
use super::*;
use crate::documents::{IDUNN_DESIRED_DAEMON_SCHEMA, OdinDocuments};
use crate::documents::{
IDUNN_DAEMON_SURGERY_PLAN_SCHEMA, IDUNN_DESIRED_DAEMON_SCHEMA,
IdunnDaemonSurgeryPlanRecord, OdinDocuments,
};
use anyhow::Result;
use cultmesh_rs::{CultMesh, CultMeshNodeOptions};
@ -328,6 +331,24 @@ mod tests {
node.put(&health.daemon_id, &health)?;
node.put(&plan.decision.decision_id, &plan.decision)?;
node.put(&request.request_id, &request)?;
let surgery_plan = IdunnDaemonSurgeryPlanRecord {
plan_id: "surgery:voidbot".to_string(),
daemon_id: "voidbot".to_string(),
severity: "high".to_string(),
status: "transport-surgery-required".to_string(),
owner: "VoidBot internal provider stack".to_string(),
objective: "Publish VoidBot internal daemon health over CultNet/RUDP".to_string(),
current_mechanism: "compatibility command probe".to_string(),
intended_authority: "daemon-owned CultNet/RUDP health record".to_string(),
cut_line: "demote command probe after RUDP health exists".to_string(),
steps: vec![
"update CultLib".to_string(),
"publish RUDP health".to_string(),
],
blockers: vec!["runtime CultLib update".to_string()],
updated_at: "2026-06-04T00:00:02Z".to_string(),
};
node.put(&surgery_plan.plan_id, &surgery_plan)?;
let reloaded = CultMesh::create_node(
&store_path,
@ -346,12 +367,26 @@ mod tests {
.as_deref(),
Some(IDUNN_DESIRED_DAEMON_SCHEMA)
);
assert_eq!(
reloaded
.documents()
.binding("idunn.daemon_surgery_plan")
.and_then(|binding| binding.payload_schema_version.clone())
.as_deref(),
Some(IDUNN_DAEMON_SURGERY_PLAN_SCHEMA)
);
assert_eq!(
reloaded
.get_required::<IdunnKeepaliveDecisionRecord>(&plan.decision.decision_id)?
.action,
"restart"
);
assert_eq!(
reloaded
.get_required::<IdunnDaemonSurgeryPlanRecord>(&surgery_plan.plan_id)?
.cut_line,
"demote command probe after RUDP health exists"
);
assert_eq!(
reloaded
.get_required::<IdunnRestartRequestRecord>(&request.request_id)?

View file

@ -86,6 +86,7 @@ idunn.deployment_result.v1
idunn.restart_request.v1
idunn.restart_result.v1
idunn.operator_alarm.v1
idunn.daemon_surgery_plan.v1
```
## Invariants
@ -118,6 +119,13 @@ idunn.operator_alarm.v1
over `cultnet.transport.rudp.v0`. TCP, HTTP, WebSocket, and ad hoc port probes
are migration debt, tolerated only at xenos/legacy boundaries and while the
daemon's CultLib dependency has not yet been updated.
- Idunn publishes the transport migration plan as
`idunn.daemon_surgery_plan.v1` records in the keepalive store. Each daemon
plan names severity, status, owner, objective, current mechanism, intended
CultNet/RUDP authority, cut line, ordered steps, blockers, and update time.
These records are operational state, not documentation garnish: Nightwing,
Gjallar, Odin, and future Eve lowerings should inspect them when projecting
the daemon surgery queue.
- A stale deployment is not restartable liveness. If a target reports
`stale-deployment` without deploy authority, Idunn must alarm instead of
restarting the stale artifact. If a target reports `dependency-unavailable`
@ -184,10 +192,12 @@ The local swarm mode owns:
1. the built-in Starfire-local target catalog;
2. a mandatory health contract per target;
3. one in-process schedule per target instead of one watchdog process per target;
4. shared typed keepalive records in one CultMesh store;
5. deploy/restart/alarm execution through the same Rust decision engine;
6. recovery of fast local targets like Odin without waiting behind slow remote
3. a typed `idunn.daemon_surgery_plan.v1` record per target, so transport debt
is visible in the same state surface as daemon health;
4. one in-process schedule per target instead of one watchdog process per target;
5. shared typed keepalive records in one CultMesh store;
6. deploy/restart/alarm execution through the same Rust decision engine;
7. recovery of fast local targets like Odin without waiting behind slow remote
Yggdrasil checks.
Next: update daemon CultLib dependencies to the cross-runtime

View file

@ -157,12 +157,19 @@ Pages remains external-owned.
- `idunn.restart_request.v1`
- `idunn.restart_result.v1`
- `idunn.operator_alarm.v1`
- `idunn.daemon_surgery_plan.v1`
Idunn publishes one `idunn.daemon_surgery_plan.v1` record per swarm target when
the swarm starts. Those records make the CultNet/RUDP migration queue explicit:
owner, objective, current compatibility mechanism, intended authority, cut line,
steps, blockers, severity, and status.
The next cuts are updating daemon CultLib dependencies so health and command
boundaries publish through `cultnet.transport.rudp.v0`, promoting the built-in
target catalog into Odin-ingested service/provider records, keeping named
adapters only for legacy service-manager crossings, and replacing the local
operator alarm bridge with a fully Bifrost-owned notification request record.
boundaries publish through `cultnet.transport.rudp.v0`, switching Idunn to those
daemon-owned records, promoting the built-in target catalog into Odin-ingested
service/provider records, keeping named adapters only for legacy service-manager
crossings, and replacing the local operator alarm bridge with a fully
Bifrost-owned notification request record.
## Boundaries