From 946d28a4c75135f80b2f8e40d1ca000407a0ee7c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 7 Sep 2026 00:11:42 +0200 Subject: [PATCH] Take the state root, not the store path Odin's recipe declared `[state]` with a `topology` slot but its launch contract passed `--store` as an absolute path. Idunn refuses that pairing: a workload whose recipe declares state must bind a state root, and binding a state root requires the launch contract to carry a `state_root` argument. No operator binding for Odin could have been admitted. This never surfaced because `idunn validate` was run recipe-only, so `admit` never saw it. The rule is Idunn's on purpose -- it is what makes Idunn the owner of where a target's state lives, so it can create and harden the root. Odin naming its own absolute store path routed around that: a binding could have placed the store outside the root Idunn prepared. So the daemon now takes `--state-root` and derives the store from the slot the recipe already declares. The store path is no longer supplied by anyone; `--store` is rejected, and a test pins that. Co-Authored-By: Claude Opus 5 --- crates/odin-daemon/src/main.rs | 34 +++++++++++++++++++++++++++++----- deployment/idunn/recipe.toml | 4 ++-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/crates/odin-daemon/src/main.rs b/crates/odin-daemon/src/main.rs index 99094d3..0f00f88 100644 --- a/crates/odin-daemon/src/main.rs +++ b/crates/odin-daemon/src/main.rs @@ -75,6 +75,12 @@ type TopologyAuthority = OdinTopologyAuthority< SystemClock, >; +/// Relative path of Odin's durable store inside the state root. The recipe's +/// `topology` state slot in `deployment/idunn/recipe.toml` is the authority for +/// this name; Idunn owns where the root itself lives and hardens it, so the +/// daemon is told the root and never the file. +const TOPOLOGY_SLOT: &str = "topology.cc"; + #[derive(Clone, Debug)] struct Options { store: PathBuf, @@ -639,7 +645,7 @@ fn parse_options(args: impl Iterator) -> Result { .strip_prefix("--") .with_context(|| format!("expected --option, got {name:?}"))?; ensure!( - matches!(name, "store" | "idunn-projection" | "idunn-anchor"), + matches!(name, "state-root" | "idunn-projection" | "idunn-anchor"), "unsupported Odin option --{name}" ); let value = args @@ -661,7 +667,7 @@ fn parse_options(args: impl Iterator) -> Result { Ok(path) }; let options = Options { - store: take("store")?, + store: take("state-root")?.join(TOPOLOGY_SLOT), idunn_projection: take("idunn-projection")?, idunn_anchor: take("idunn-anchor")?, }; @@ -669,7 +675,7 @@ fn parse_options(args: impl Iterator) -> Result { options.store != options.idunn_projection && options.store != options.idunn_anchor && options.idunn_projection != options.idunn_anchor, - "Odin store, Idunn projection, and Idunn anchor paths must be distinct" + "Odin state root, Idunn projection, and Idunn anchor paths must be distinct" ); Ok(options) } @@ -1161,8 +1167,8 @@ mod tests { fn options_are_exact_and_absolute() { let parsed = parse_options( [ - "--store", - "/var/lib/gamecult/odin-v2/topology.cc", + "--state-root", + "/var/lib/gamecult/odin-v2", "--idunn-projection", "/var/lib/gamecult/idunn-projection/topology.cc", "--idunn-anchor", @@ -1176,10 +1182,28 @@ mod tests { parsed.store, Path::new("/var/lib/gamecult/odin-v2/topology.cc") ); + // The store path is derived from the slot, never supplied: naming it + // directly would let a binding place Odin's state outside the root + // Idunn hardened. assert!( parse_options( [ "--store", + "/var/lib/gamecult/odin-v2/topology.cc", + "--idunn-projection", + "/p", + "--idunn-anchor", + "/a" + ] + .into_iter() + .map(str::to_owned) + ) + .is_err() + ); + assert!( + parse_options( + [ + "--state-root", "relative", "--idunn-projection", "/p", diff --git a/deployment/idunn/recipe.toml b/deployment/idunn/recipe.toml index f4455df..34163d9 100644 --- a/deployment/idunn/recipe.toml +++ b/deployment/idunn/recipe.toml @@ -35,8 +35,8 @@ executable = true [service] executable_artifact = "odin-daemon" arguments = [ - { kind = "literal", value = "--store" }, - { kind = "binding", name = "store_path" }, + { kind = "literal", value = "--state-root" }, + { kind = "binding", name = "state_root" }, { kind = "literal", value = "--idunn-projection" }, { kind = "binding", name = "idunn_projection_path" }, { kind = "literal", value = "--idunn-anchor" },