No description
  • Rust 99.2%
  • Shell 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens bd75ecdeac Close R20's four holes: delete the arity exemption, move brake
authorization off startup, quarantine bad records at read, and restore
the resident-terminal sweep

Per rulings-wave-1.md R20 (third pass on this branch, Soul's second
falsification):

1. decode_record_canonical: deleted the stored_len < canonical_len
   exemption outright instead of repairing it further. Measured the
   live control.cc through Idunn's own decoder first (throwaway
   #[ignore] test, removed before this commit): 507 records -- 253
   commands, 253 transactions, 1 admitted generation -- all already at
   full current arity. Zero short records exist, so there is nothing
   to be lenient toward; a future field addition is a migration to run
   at that moment, not a standing hole in this check.

2. validate_durable_authority is gone from serve. Warming and ready
   evidence were already re-authenticated at their own consumption
   points on every resume (rehydrate_warming_token,
   rehydrate_ready_token, rehydrate_admitted_ready) -- that part of
   the old startup gate was pure duplication. The one real gap was the
   deployment brake authorization, which nothing re-verified after
   Sealing consumed it once. Added
   verify_resident_deployment_authorization, called from the top of
   advance_transaction for every resident transaction that carries
   one: a rotated operator identity now fails only that transaction's
   advance (caught by resume_one_transaction's existing pre-/post-
   fencing abort handling), never serve. An empty store, or one with
   no Deploy transaction past Sealing, never touches the brake anchor
   at all.

3. ControlSnapshot::read no longer fails whole on one bad record.
   Split the per-envelope decode into ControlSnapshot::ingest; a
   record that fails it is logged and skipped, and the read returns
   everything else. A quarantined record is refused from acting as
   live authority by omission rather than by taking every other
   record in the store down with it -- which also means the byte-
   exact/foreign-encoding/short-record refusals from cut 1 now surface
   as the tampered record being absent from the snapshot, not as
   ControlSnapshot::read itself erroring.

4. Restored the resident-terminal sweep in resume_one_transaction
   (fef226a's shape), rather than routing the admission commit through
   replace_transaction: that commit writes the Complete transaction
   and the new AdmittedGeneration atomically in one compare_exchange,
   which replace_transaction cannot do since it only ever moves a
   single already-resident record. The sweep finds any transaction
   already terminal in control.cc -- born terminal by that commit, or
   left by a crash mid-archive -- and archives it through
   replace_transaction before scheduling anything else.

All five soul2_* tests flipped to assert the closed behaviour instead
of the hole (short_record_is_refused_not_tolerated,
soul2_shortened_record_escapes_the_byte_exact_check,
soul2_startup_authority_check_needs_the_brake_anchor_with_no_records,
soul2_one_live_record_with_a_rotated_brake_signer_refuses_startup,
soul2_one_noncanonical_record_starves_every_scheduler_tick,
soul2_stateful_continuity_admission_mints_a_terminal_record_into_control),
none deleted. Two more pre-existing tests
(legacy_mutable_command_schema_is_quarantined,
loadcredential_era_control_schemas_are_quarantined_not_rehydrated) and
one Soul claim-1 test (soul_live_record_in_foreign_encoding_is_refused_by_control_read)
updated for the same quarantine-not-refuse semantics.

Net -17 lines against the second pass (312 insertions, 329 deletions)
and net -71 against origin/main on source with tests excluded (was
+859 stated in R20; this cut's source-only delta is roughly flat to
slightly negative -- see the CutReport for the exact numbers). All 111
tests pass under `cargo test --locked` in the Debian/rustc 1.95
container on ygg with /etc/machine-id mounted.

Deviation from "commit each cut separately": landed as one commit.
The four cuts touch overlapping regions of the same file and, more to
the point, several tests had to be re-edited a second time once cut 3
(quarantine) was in place -- cut 1's and Soul's claim-1 tests originally
asserted a hard ControlSnapshot::read refusal, and quarantine changed
that refusal into an absence-from-snapshot instead. A four-way split
along the original cut boundaries would not have been independently
buildable/testable at each step without redoing that same test
rewrite twice. Splitting was not attempted rather than faked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 14:47:52 +02:00
deploy Give each build container its own machine identity 2026-09-07 00:24:59 +02:00
docs Record the host shape Odin's bootstrap established 2026-09-07 17:42:00 +02:00
src Close R20's four holes: delete the arity exemption, move brake 2026-09-08 14:47:52 +02:00
tests/fixtures Gate Yggdrasil releases through Bifrost 2026-07-16 18:34:26 +01:00
.gitignore Stand Idunn up as its own repository 2026-09-05 17:53:29 +02:00
Cargo.lock Stand Idunn up as its own repository 2026-09-05 17:53:29 +02:00
Cargo.toml Stand Idunn up as its own repository 2026-09-05 17:53:29 +02:00
LICENSE Add the MIT license file the manifest already declares 2026-09-05 22:02:45 +02:00
README.md Make the public entry point describe the binary that actually ships 2026-09-05 23:15:46 +02:00

Idunn

Deployment admission and daemon-survival authority for the GameCult swarm.

Idunn decides two things and nothing else: whether an artifact may be installed, and whether an already-installed body may be restarted. It keeps daemons alive across a fleet, admits releases against operator-signed authority, and reports typed health — while depending on none of the services it manages.

Extracted from Odin on 2026-09-05 with its full 136-commit history. Idunn had lived as a crate inside the repository of a service it manages, which inverted the authority it exists to hold.


Quick start

Requires Rust 1.95+. Idunn is a Linux daemon; see Platform.

git clone https://github.com/GameCult/Idunn.git
cd Idunn
cargo build --release

Two binaries land in target/release/:

Binary Purpose
idunn the daemon — keepalive supervision, deployment actuation, health
idunn-provision operator tooling — brake status, identity enrolment, provisioning

Idunn's CLI is declarative. There are three commands and no imperative escape hatch — you cannot hand it a shell string to run:

idunn serve  [runtime options]                      # the control plane
idunn up     <service|profile:name> [--no-wait]     # request a deployment
idunn status [--command ID]                         # read what happened

A test, cli_exposes_only_declarative_commands, asserts that --deploy-command, --restart-command and --swarm-profile are rejected. What a target is, how it is built, and what it is allowed to touch live in two documents, never in a command line — see Recipes and bindings.

Request a deployment and watch it:

idunn up ghostlight --requested-by "$USER"
idunn status --command <id>

idunn up accepts a service name or profile:<name>; profiles are declared by the bindings, so idunn up profile:full-gamecult brings up everything bound into that profile.

Authority

Owner. Deployment admission, and the continuity of installed bodies.

Inputs. Its own typed state stores, its own credentials, and operator-authored trust anchors and bindings. It does not read a managed target's binaries, health, or availability to decide anything about itself.

The one deliberate exception, stated plainly rather than hidden: Idunn reads Odin's published topology correlation to gate deployment promotion, so that a promotion waits for semantic discovery. It is read-only, an absent store yields None rather than an error, and it is structurally unreachable from the continuity path — validate_live_providers_for_deploy never invokes the provider check for CommandKind::Continuity. Odin being down blocks promotions. It cannot stop daemon survival.

The invariant.

Idunn must be able to start, recover, observe and report while any managed target is absent, broken, or deliberately braked.

A target's brake gates mutation of that target only. It can neither authorize nor block Idunn's own startup, nor any other target's lifecycle.

Two brakes, not one. Deployment and continuity are separate authorities with separate stores, declared per target in that target's binding. A binding naming one store for both is rejected outright — "deployment and lifecycle brakes are identical".

  • Continuity is restarting an already-admitted installed release. Physiology.
  • Deployment is changing an artifact, revision, configuration, schema, unit, or authority binding.

A deployment brake does not own the former. Suspending restart actuation requires the separately named lifecycle brake.

Forbidden. Idunn does not depend on a managed target, and does not repair one merely to satisfy a deploy. If recovery would require that, the target dependency is the thing to cut.

Recipes and bindings

Two documents describe a target, and the split is the security model.

The recipe lives in the target's own repository at deployment/idunn/recipe.toml (gamecult.idunn.target_declaration.v1). It declares capability: build and test steps, the artifacts they produce, the service's argument shape, its health contract, its state slots, and what it provides. It names no host paths, no images, no privileges.

The operator binding lives on the host under --bindings-dir (gamecult.idunn.operator_binding.v2). It supplies everything privileged: which origin and ref are admitted, the pinned runner image, the workload's roots and hardening, the runtime trust anchor, the route, the two brake stores, rollout strategy and placement. It also declares which profiles the target belongs to.

# recipe — in the target's repo, capability only
[[steps]]
id = "build"
phase = "build"
runner = "rust-build"
argv = ["cargo", "build", "--locked", "--release", "-p", "thing"]

[service]
executable_artifact = "thing"
arguments = [
  { kind = "literal", value = "--store" },
  { kind = "binding", name = "state_root" },
]
# binding — on the host, privilege only
[repository]
origin = "https://github.com/GameCult/Thing.git"
admitted_ref = "refs/heads/main"
selection = "ref-head"
recipe_path = "deployment/idunn/recipe.toml"

[brakes]
deployment_store = "/var/lib/gamecult/idunn-authority/thing-deployment-brake.cc"
lifecycle_store  = "/var/lib/gamecult/idunn-authority/thing-lifecycle-brake.cc"

A recipe cannot grant itself an affordance: the binding must name every affordance the recipe's runners derive, and admit() rejects a binding that omits one. Unknown fields are rejected on both sides. A repository that gets compromised can therefore change what is built, but not what it is allowed to touch on the host.

Contracts

Idunn's typed contracts are published by CultLib in cultnet-rs — deployment and lifecycle brakes, service identity, runtime activation, expected incarnation, and the provider-health family. Idunn consumes them and defines no private copies.

State is CultCache (.cc typed documents) throughout. Health is published over CultNet RUDP.

Odin keeps its own separate projection of Idunn state for aggregation. That is the all-seer's view, not Idunn's contract, and the two sets do not overlap.

Running as a service

deploy/ carries a worked systemd installation:

File
idunn-yggdrasil.service the unit
idunn-yggdrasil operator wrapper
idunn-yggdrasil.sudoers the narrow sudo grant the wrapper needs

The unit runs as a dedicated idunn user under ProtectSystem=full, ProtectHome=yes, PrivateTmp=yes. ReadWritePaths is Idunn's own state plus the build root; the operator anchor, the bindings, and Odin's correlation store are all ReadOnlyPaths. Idunn admits against operator authority — it does not author it.

Note Wants=docker.service, not Requires=. Only the build step is containerized; warm, fence, promote, drain and restart run on systemd, and worktree-tree recipes skip Docker entirely. A hard requirement would let a Docker outage stop Idunn itself and take daemon survival down with it.

Adapt the store paths for your host. Every path in ExecStart is explicit on purpose; Idunn discovers no authority implicitly.

Documentation

docs/migration.md start here if you run a swarm today — moving a target from the previous generation, in order, and cutting over the authority itself
docs/authority-map.md authority map, repository declaration, operator binding, release foundation, promotion and continuity
docs/deployment-authority.md the deployment transaction in depth
docs/signed-daemon-health-authority.md signed health admission and trust bindings
docs/guide.md the previous generation's keepalive daemon — still what runs on yggdrasil, kept for the migration; its commands no longer work
deploy/legacy/ the shell actuator that generation used, and what replaced each part of it

Platform

Idunn targets Linux. cargo test on Windows reports 63 passed, 18 failed; those 18 assert against absolute deployment paths (/srv/..., /var/lib/gamecult/...) and Rust's Path::is_absolute() requires a drive prefix there. It is platform semantics, not breakage — the same 18 fail identically in the Odin tree this was extracted from. Build and test on Linux for a true result.

Licence

MIT.