Gate Yggdrasil releases through Bifrost

This commit is contained in:
Meta Vens 2026-07-16 18:34:19 +01:00
commit ecaac7f835
10 changed files with 1399 additions and 45 deletions

4
Cargo.lock generated
View file

@ -421,10 +421,14 @@ name = "idunn-daemon"
version = "0.1.0"
dependencies = [
"anyhow",
"chrono",
"cultcache-rs",
"cultmesh-rs",
"cultnet-rs",
"odin-core",
"rmp-serde",
"serde",
"sha2",
]
[[package]]

View file

@ -12,6 +12,10 @@ path = "src/main.rs"
[dependencies]
anyhow = "1"
cultmesh-rs = { path = "../../vendor/cultmesh-rs" }
cultcache-rs = { path = "../../vendor/cultcache-rs" }
cultnet-rs = { path = "../../vendor/cultnet-rs" }
odin-core = { path = "../odin-core" }
rmp-serde = "1.3"
sha2 = "0.10"
chrono = "0.4"
serde = { version = "1", features = ["derive"] }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
# Bifrost release-authority wire fixture
`bifrost-release-authority-v1.payload.hex` is the exact MessagePack payload
emitted on 2026-07-16 by Bifrost's TypeScript CultCache writer
`tools/bifrost-repository-release-authority.mjs` for `GameCult/Epiphany`,
`refs/heads/main`, commit
`0123456789abcdef0123456789abcdef01234567`.
It is checked in because the TypeScript runtime emits a camelCase MessagePack
map while Rust `DatabaseEntry` derives tuple payloads. Idunn must prove it can
decode the producer's real wire shape rather than round-tripping a fixture it
serialized itself.

View file

@ -0,0 +1 @@
de0018aa736368656d614e616d65d924626966726f73742e7265706f7369746f72795f72656c656173655f617574686f72697479ad736368656d6156657273696f6ed927626966726f73742e7265706f7369746f72795f72656c656173655f617574686f726974792e7631ab617574686f726974794964d95272656c656173653a47616d6543756c742f4570697068616e793a726566732f68656164732f6d61696e3a30313233343536373839616263646566303132333435363738396162636465663031323334353637a9636f6d6d616e644964d92163756c746d6573682d636f6d6d616e642d6570697068616e792d72656c65617365b163726f7373696e67526563656970744964b963726f7373696e675f6570697068616e795f72656c65617365b27265706f7369746f727946756c6c4e616d65b147616d6543756c742f4570697068616e79ab757073747265616d526566af726566732f68656164732f6d61696ea9636f6d6d6974536861d92830313233343536373839616263646566303132333435363738396162636465663031323334353637a86465636973696f6ea9617574686f72697a65a6737461747573aa617574686f72697a6564b0706f6c6963794465636973696f6e4964b7706f6c6963792d6570697068616e792d72656c65617365b2617574686f726974795265666572656e6365b8626966726f73743a72656c656173653a6570697068616e79ad6163746f724964656e74697479a86d65746163726174aa736f757263654b696e64b8626966726f73742e676f7665726e616e63652e746f706963a8736f757263654964b6746f7069632d6570697068616e792d72656c65617365ad6570697068616e7952756e4964b472756e2d6570697068616e792d72656c65617365ae6570697068616e794c616e654964b168616e64732d7075626c69636174696f6eb56570697068616e794167656e744964656e74697479a86570697068616e79b265787465726e616c5265636569707455726cd95468747470733a2f2f6769746875622e636f6d2f47616d6543756c742f4570697068616e792f636f6d6d69742f30313233343536373839616263646566303132333435363738396162636465663031323334353637b165787465726e616c526563656970744964d92830313233343536373839616263646566303132333435363738396162636465663031323334353637ac617574686f72697a65644174b4323032362d30372d31365430303a30303a30305aa9657870697265734174a0a97265766f6b65644174a0b07265766f636174696f6e526561736f6ea0

View file

@ -16,11 +16,13 @@ pub const IDUNN_DAEMON_HEALTH_SCHEMA: &str = "idunn.daemon_health.v1";
pub const IDUNN_KEEPALIVE_DECISION_SCHEMA: &str = "idunn.keepalive_decision.v1";
pub const IDUNN_RESTART_REQUEST_SCHEMA: &str = "idunn.restart_request.v1";
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_REQUEST_SCHEMA: &str = "idunn.deployment_request.v2";
pub const IDUNN_DEPLOYMENT_RESULT_SCHEMA: &str = "idunn.deployment_result.v1";
pub const IDUNN_LIFECYCLE_COMMAND_SCHEMA: &str = "idunn.lifecycle_command.v1";
pub const IDUNN_RELEASE_TARGET_SCHEMA: &str = "idunn.release_target.v1";
pub const IDUNN_DEPLOYMENT_ARTIFACT_SCHEMA: &str = "idunn.deployment_artifact.v1";
pub const IDUNN_RELEASE_TARGET_SCHEMA: &str = "idunn.release_target.v2";
pub const IDUNN_DEPLOYMENT_ARTIFACT_SCHEMA: &str = "idunn.deployment_artifact.v2";
pub const BIFROST_REPOSITORY_RELEASE_AUTHORITY_SCHEMA: &str =
"bifrost.repository_release_authority.v1";
pub const IDUNN_STATE_MIGRATION_PLAN_SCHEMA: &str = "idunn.state_migration_plan.v1";
pub const IDUNN_STATE_MIGRATION_RESULT_SCHEMA: &str = "idunn.state_migration_result.v1";
pub const IDUNN_ROLLOUT_PLAN_SCHEMA: &str = "idunn.rollout_plan.v1";
@ -323,7 +325,7 @@ pub struct IdunnRestartResultRecord {
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "idunn.deployment_request",
schema = "idunn.deployment_request.v1"
schema = "idunn.deployment_request.v2"
)]
pub struct IdunnDeploymentRequestRecord {
#[cultcache(key = 0)]
@ -336,6 +338,18 @@ pub struct IdunnDeploymentRequestRecord {
pub authority: String,
#[cultcache(key = 4)]
pub requested_at: String,
#[cultcache(key = 5, default)]
pub repository_full_name: String,
#[cultcache(key = 6, default)]
pub upstream_ref: String,
#[cultcache(key = 7, default)]
pub source_revision: String,
#[cultcache(key = 8, default)]
pub release_authority_id: String,
#[cultcache(key = 9, default)]
pub release_authority_envelope_sha256: String,
#[cultcache(key = 10, default)]
pub requires_bifrost_authority: bool,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
@ -385,7 +399,7 @@ pub struct IdunnLifecycleCommandRecord {
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(type = "idunn.release_target", schema = "idunn.release_target.v1")]
#[cultcache(type = "idunn.release_target", schema = "idunn.release_target.v2")]
pub struct IdunnReleaseTargetRecord {
#[cultcache(key = 0)]
pub target_id: String,
@ -415,12 +429,26 @@ pub struct IdunnReleaseTargetRecord {
pub status: String,
#[cultcache(key = 13)]
pub observed_at: String,
#[cultcache(key = 14, default)]
pub repository_full_name: String,
#[cultcache(key = 15, default)]
pub upstream_ref: String,
#[cultcache(key = 16, default)]
pub release_authority_id: String,
#[cultcache(key = 17, default)]
pub release_authority_envelope_sha256: String,
#[cultcache(key = 18, default)]
pub release_authority_status: String,
#[cultcache(key = 19, default)]
pub requires_bifrost_authority: bool,
#[cultcache(key = 20, default)]
pub observed_upstream_revision: String,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "idunn.deployment_artifact",
schema = "idunn.deployment_artifact.v1"
schema = "idunn.deployment_artifact.v2"
)]
pub struct IdunnDeploymentArtifactRecord {
#[cultcache(key = 0)]
@ -441,6 +469,62 @@ pub struct IdunnDeploymentArtifactRecord {
pub sha256: String,
#[cultcache(key = 8)]
pub built_at: String,
#[cultcache(key = 9, default)]
pub release_authority_id: String,
#[cultcache(key = 10, default)]
pub release_authority_envelope_sha256: String,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
#[cultcache(
type = "bifrost.repository_release_authority",
schema = "bifrost.repository_release_authority.v1"
)]
pub struct BifrostRepositoryReleaseAuthorityRecord {
#[cultcache(key = 0)]
pub authority_id: String,
#[cultcache(key = 1)]
pub command_id: String,
#[cultcache(key = 2)]
pub crossing_receipt_id: String,
#[cultcache(key = 3)]
pub repository_full_name: String,
#[cultcache(key = 4)]
pub upstream_ref: String,
#[cultcache(key = 5)]
pub commit_sha: String,
#[cultcache(key = 6)]
pub decision: String,
#[cultcache(key = 7)]
pub status: String,
#[cultcache(key = 8)]
pub policy_decision_id: String,
#[cultcache(key = 9)]
pub authority_reference: String,
#[cultcache(key = 10)]
pub actor_identity: String,
#[cultcache(key = 11)]
pub source_kind: String,
#[cultcache(key = 12)]
pub source_id: String,
#[cultcache(key = 13, default)]
pub epiphany_run_id: String,
#[cultcache(key = 14, default)]
pub epiphany_lane_id: String,
#[cultcache(key = 15, default)]
pub epiphany_agent_identity: String,
#[cultcache(key = 16)]
pub external_receipt_url: String,
#[cultcache(key = 17)]
pub external_receipt_id: String,
#[cultcache(key = 18)]
pub authorized_at: String,
#[cultcache(key = 19, default)]
pub expires_at: String,
#[cultcache(key = 20, default)]
pub revoked_at: String,
#[cultcache(key = 21, default)]
pub revocation_reason: String,
}
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
@ -1345,6 +1429,7 @@ cultmesh_rs::cultmesh_documents!(OdinDocuments {
IdunnLifecycleCommandRecord => IDUNN_LIFECYCLE_COMMAND_SCHEMA,
IdunnReleaseTargetRecord => IDUNN_RELEASE_TARGET_SCHEMA,
IdunnDeploymentArtifactRecord => IDUNN_DEPLOYMENT_ARTIFACT_SCHEMA,
BifrostRepositoryReleaseAuthorityRecord => BIFROST_REPOSITORY_RELEASE_AUTHORITY_SCHEMA,
IdunnStateMigrationPlanRecord => IDUNN_STATE_MIGRATION_PLAN_SCHEMA,
IdunnStateMigrationResultRecord => IDUNN_STATE_MIGRATION_RESULT_SCHEMA,
IdunnRolloutPlanRecord => IDUNN_ROLLOUT_PLAN_SCHEMA,

View file

@ -78,6 +78,12 @@ pub fn plan_keepalive(
command: command.to_string(),
authority: desired.authority.clone(),
requested_at: now,
repository_full_name: String::new(),
upstream_ref: String::new(),
source_revision: String::new(),
release_authority_id: String::new(),
release_authority_envelope_sha256: String::new(),
requires_bifrost_authority: false,
}),
restart_request: None,
operator_alarm: None,
@ -416,6 +422,13 @@ mod tests {
zero_downtime_capability: "restart-required".to_string(),
status: "tracked".to_string(),
observed_at: "2026-06-04T00:00:02Z".to_string(),
repository_full_name: "GameCult/VoidBot".to_string(),
upstream_ref: "refs/heads/main".to_string(),
release_authority_id: "release:GameCult/VoidBot:refs/heads/main:abc123".to_string(),
release_authority_envelope_sha256: "authority-sha".to_string(),
release_authority_status: "authorized".to_string(),
requires_bifrost_authority: true,
observed_upstream_revision: "abc123".to_string(),
};
let artifact = IdunnDeploymentArtifactRecord {
artifact_id: "artifact:voidbot:main".to_string(),
@ -427,6 +440,10 @@ mod tests {
artifact_uri: "built-by-deploy-command".to_string(),
sha256: "pending-deploy-command".to_string(),
built_at: "2026-06-04T00:00:02Z".to_string(),
release_authority_id: release_target.release_authority_id.clone(),
release_authority_envelope_sha256: release_target
.release_authority_envelope_sha256
.clone(),
};
let migration_plan = IdunnStateMigrationPlanRecord {
plan_id: "migration:voidbot:main".to_string(),

View file

@ -81,12 +81,29 @@ Idunn now shares Odin's Rust body:
- `npm run idunn:start -- --swarm-profile starfire-local --repo-root E:\Projects\Odin --execute`
runs the singular local swarm supervisor.
- `--swarm-profile yggdrasil-local` is the Linux host-local supervisor for
Heimdall, Repixelizer, and StreamPixels. Its only command boundary is the
Epiphany, Heimdall, Repixelizer, StreamPixels, and VoidBot. Its only command boundary is the
root-owned `/usr/local/libexec/idunn-yggdrasil` actuator. Restart commands
target the local Compose stack; deployment fails closed unless a root-owned
executable manifest exists for that service under
`/srv/odin/deploy-manifests`. It does not inherit Starfire paths, SSH keys,
ADB authority, or Windows process ownership.
- Release authorization is adopted per target. Epiphany requires an exact
`bifrost.repository_release_authority.v1` receipt from the explicitly
configured Bifrost store before migration or deployment; its request,
artifact, and remote manifest lineage freeze that authorized commit. The
older Yggdrasil targets remain marked `legacy-unmigrated` until Bifrost
authorities are issued for them, so installing the Epiphany gate does not
silently disable their existing lifecycle paths. Git branch position alone
never satisfies the Epiphany gate.
- For Epiphany, Bifrost's one current authorized record for
`GameCult/Epiphany` and `refs/heads/main` selects the release commit. The
current remote branch head is observed separately and may advance without
changing an already authorized deployment. Zero or multiple current
authorities fail closed. Idunn freezes the selected SHA and receipt digest
into the deployment request, then the root Yggdrasil actuator invokes
Idunn's narrow `validate-release-authority` posture against the live Bifrost
store immediately before the service manifest executes. Environment values
carry lineage across sudo; they do not grant it.
The current typed records are:

View file

@ -8,8 +8,57 @@ fi
action="${1:-}"
target="${2:-}"
source_commit="${3:-}"
repository_full_name="${4:-}"
upstream_ref="${5:-}"
release_authority_id="${6:-}"
release_authority_sha256="${7:-}"
deployment_request_id="${8:-}"
requires_bifrost_authority="${9:-false}"
compose=/srv/compose/yggdrasil-apps.yaml
require_release_lineage() {
case "$target" in
epiphany) target_requires_bifrost_authority=true ;;
voidbot|heimdall|repixelizer|streampixels) target_requires_bifrost_authority=false ;;
*) echo "deployment target has no release-authority policy: $target" >&2; exit 1 ;;
esac
if [ "$requires_bifrost_authority" != "$target_requires_bifrost_authority" ]; then
echo "caller release-authority mode does not match root policy for $target" >&2
exit 1
fi
requires_bifrost_authority="$target_requires_bifrost_authority"
case "$source_commit" in
*[!0-9a-f]*|'') echo "invalid or missing IDUNN_SOURCE_COMMIT" >&2; exit 1 ;;
esac
[ "${#source_commit}" -eq 40 ] || { echo "IDUNN_SOURCE_COMMIT must be 40 hex characters" >&2; exit 1; }
[ -n "$repository_full_name" ] || { echo "missing repository identity" >&2; exit 1; }
[ -n "$upstream_ref" ] || { echo "missing upstream ref" >&2; exit 1; }
[ -n "$deployment_request_id" ] || { echo "missing Idunn deployment request id" >&2; exit 1; }
case "$requires_bifrost_authority" in
true)
[ -n "$release_authority_id" ] || { echo "missing Bifrost release authority id" >&2; exit 1; }
case "$release_authority_sha256" in
*[!0-9a-f]*|'') echo "invalid or missing Bifrost release authority digest" >&2; exit 1 ;;
esac
[ "${#release_authority_sha256}" -eq 64 ] || { echo "Bifrost release authority digest must be 64 hex characters" >&2; exit 1; }
/usr/local/bin/idunn validate-release-authority \
--store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc \
--release-authority-store /srv/bifrost/state/repository-release-authority.cc \
--repository-full-name "$repository_full_name" \
--upstream-ref "$upstream_ref" \
--source-revision "$source_commit" \
--release-authority-id "$release_authority_id" \
--release-authority-sha256 "$release_authority_sha256"
;;
false)
[ -z "$release_authority_id" ] || { echo "legacy release cannot claim Bifrost authority id" >&2; exit 1; }
[ -z "$release_authority_sha256" ] || { echo "legacy release cannot claim Bifrost authority digest" >&2; exit 1; }
;;
*) echo "invalid Bifrost authority requirement mode" >&2; exit 1 ;;
esac
}
case "$action:$target" in
restart:heimdall)
exec docker compose -f "$compose" restart heimdall
@ -20,13 +69,24 @@ 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"
deploy:voidbot|restart:voidbot|deploy:epiphany|restart:epiphany)
manifest="/srv/odin/deploy-manifests/$target"
if [ ! -x "$manifest" ] || [ ! -O "$manifest" ]; then
echo "root-owned executable deploy manifest is not installed: $manifest" >&2
exit 1
fi
IDUNN_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon exec "$manifest" "$action"
if [ "$action" = deploy ]; then
require_release_lineage
fi
IDUNN_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon \
IDUNN_SOURCE_COMMIT="$source_commit" \
IDUNN_REPOSITORY_FULL_NAME="$repository_full_name" \
IDUNN_UPSTREAM_REF="$upstream_ref" \
BIFROST_RELEASE_AUTHORITY_ID="$release_authority_id" \
BIFROST_RELEASE_AUTHORITY_SHA256="$release_authority_sha256" \
IDUNN_DEPLOYMENT_REQUEST_ID="$deployment_request_id" \
IDUNN_REQUIRES_BIFROST_AUTHORITY="$requires_bifrost_authority" \
exec "$manifest" "$action"
;;
deploy:heimdall|deploy:repixelizer|deploy:streampixels)
manifest="/srv/odin/deploy-manifests/$target"
@ -34,7 +94,16 @@ case "$action:$target" in
echo "root-owned executable deploy manifest is not installed: $manifest" >&2
exit 1
fi
exec "$manifest"
require_release_lineage
IDUNN_ACTUATOR=1 IDUNN_COMMAND_AUTHORITY=idunn-daemon \
IDUNN_SOURCE_COMMIT="$source_commit" \
IDUNN_REPOSITORY_FULL_NAME="$repository_full_name" \
IDUNN_UPSTREAM_REF="$upstream_ref" \
BIFROST_RELEASE_AUTHORITY_ID="$release_authority_id" \
BIFROST_RELEASE_AUTHORITY_SHA256="$release_authority_sha256" \
IDUNN_DEPLOYMENT_REQUEST_ID="$deployment_request_id" \
IDUNN_REQUIRES_BIFROST_AUTHORITY="$requires_bifrost_authority" \
exec "$manifest"
;;
*)
echo "unsupported Idunn Yggdrasil actuator request: $action $target" >&2

View file

@ -8,7 +8,7 @@ Requires=docker.service
Type=simple
User=idunn
Group=idunn
ExecStart=/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 --command-timeout-seconds 900 --execute
ExecStart=/usr/local/bin/idunn --swarm-profile yggdrasil-local --repo-root /srv/odin/source --store /var/lib/gamecult/idunn/yggdrasil.keepalive.cc --release-authority-store /srv/bifrost/state/repository-release-authority.cc --rudp-health-bind 10.77.0.1:17870 --command-timeout-seconds 3600 --execute
Restart=always
RestartSec=5
TimeoutStopSec=20