Merge origin/main into idunn/route-b1

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 05:13:07 +02:00
commit 4b5e60fb12
15 changed files with 2688 additions and 216 deletions

View file

@ -456,7 +456,59 @@ reverted (Idunn).**
- F0 is not required. This cut could land before F0 if Self wants the drift
closed first.
**B1 status, 2026-09-29 (Self).** Landed on `idunn/route-b1` (`87fa57d` revert of `a148802`,
`4427769`, `4a9fe87`); 177 tests pass. **Soul (Opus): do not close.** The rule held (one
rule, one resolution, exact activation, the Expected never withdrawn, foreign activations
refused, the revert exact). The transition failed:
- **High, CONFIRMED:** a continuity abort persisted under the old rule (`Skipped` although
an activation was issued) fails the new validation (`control_plane.rs:1031-1044`).
`ControlSnapshot::read` fails the whole store on one record, so a resident record stops
Idunn from booting, for every target.
- **Medium, CONFIRMED:** supervision's pre-restart demotion failure is only logged
(`:3557-3576`). A continuity failing between `prepare_activation` and
`publish_observed_activation` then wedges its abort on "substituted" every tick. Drift
left by a pre-B1 failed continuity wedges a later deploy abort the same way.
- Low: `docs/deployment-authority.md` says the projection "never drifts".
**Self's ruling for the B1 fix batch, which runs on top of F0 because F0 owns the legacy lift:**
1. The legacy-transaction lift maps a pre-B1 continuity abort that issued an activation to
`Pending`. The new single resolution then demotes its own activation, which also cleans
the residue that record left behind.
2. Supervision owns the Expected-only precondition. It does not mint a continuity while its
pre-restart demotion fails; the failure is recorded, not merely logged.
3. A one-time boot reconciliation demotes a projected activation only when its issuing
transaction is a failed transaction in history (exact identity). It never adopts.
4. Engine-layer tests for both abort paths, using Soul's EngineFixture probe shape (candidate
cleanup already Complete, so no systemctl runs). cargo-mutants found 6 Engine-path mutants
missed.
5. Correct the doc's "never drifts".
Before any deploy, check the live host for resident continuity abort records. That is a read
of `control.cc`, and the operator's to authorise.
**B2 — Bounded, backed-off route and unit repair (Idunn).**
*Widened 2026-09-29 by Self, from Soul's S1 pass.* S1 closed the healthy-target storm, and
Soul found two storm paths S1 does not claim. Both are B2's:
- **A failing reload deletes the fragment** (`restore_admitted_membership`,
`drivers.rs:5472-5478`). The next tick reads the file as missing, treats that as drift, and
restores again: one `systemd-run`, ufw, `nginx -t` and reload every 500 ms, unbounded.
This was probed over 4 ticks. A broken global nginx config does the same through the
private-mount unit.
- **`NginxRouteDriver::install` (`drivers.rs:5402`) runs ufw, `nginx -t` and reload
unconditionally.** The Routing phase re-runs it on every resume, and a post-fence proof
failure resumes forever (F17), so a candidate failing its proof reloads every tick. A
stateless candidate reloads twice (install, then rollback). The post-fence abort's
`withdraw_candidate_membership` then calls `restore`, which does the same.
So B2's actuation ceiling covers **`install`, `restore` and `restore_admitted_membership`**,
not only supervision. B2 also adds the seam Soul specified: the route actuator program paths
and `preflight_root` on `RuntimeOptions`, defaulting to today's paths and used at every
`NginxRouteDriver::new` site, plus a routed `Stored<AdmittedGeneration>` fixture beside
`EngineFixture`. Deleting `supervise_admitted_route`'s body currently survives every test
(cargo-mutants), and B2's reload-count timeline test needs the same seam. A failed proof
marks the route degraded (Q5 a). Today nothing is written and the next tick re-challenges
with no backoff.
- Challenges back off exponentially per target on consecutive failures, with a
floor at max age and a cap.
- Route actuations (write, reload, ufw) go through a per-target rolling
@ -521,6 +573,35 @@ reverted (Idunn).**
- The lease pickup contract is unchanged.
- Tests are in the package. Verify under the node image on Yggdrasil.
**C1 status, 2026-09-29 (Self).** Landed on CultLib `idunn-ts/route-c1` (`795fd10`). Soul closed
it on conditions, and a fix batch is in Hands:
- stateful, lease-bound Rust vectors;
- the signer owns health (`reportHealth`), starting at `warming`;
- the signer records every warming it signs, so a route-proof stateful target can take its lease;
- one signer per authority, a frozen authority, and a subpath export without the Odin publisher.
**Two consequences for later cuts:**
- **C2 covers the StreamPixels service too.** `apps/service/src/app.ts:155` answers route
challenges through `publishRouteObservation`, which C1 removed, so the gitlink bump breaks
the service unless C2 moves it to `answerRouteObservation` and `reportHealth`.
- **B3 surfaces the typed capacity shortfall** on the route path. Today it reads as a
generic "disagrees with current authority" (`control_plane.rs:5190`).
**S3 + C2 code status, 2026-09-29 (Self).** Landed on StreamPixels `route/s3-c2` (`8e6d891`),
after Soul and a fix batch:
- `vendor/CultLib` is at `30ee8b9`, and the web has no Odin dependency or env.
- Both apps answer through the signer, with one health owner, `driveRuntimeHealth`.
- CI now builds the vendored gitlink, not a sibling `main`.
- A production-named launcher test runs `runIdunnRuntime`. It caught a dropped `publish`
argument that would have broken the service's write lease.
- Checks: 172 tests, typecheck, the web build and the release assembly.
**Not merged to StreamPixels `main` until B3 lands.** Idunn cannot yet admit a web with no
Odin dependency, so a deploy of `main` would fail readiness.
Follow-up: the production fixtures are generated by applying
`test-data/idunn-runtime/fixture.patch` to CultLib's `idunn_runtime_fixture.rs`. The generator
should take the target, contract and dependencies as input, so no consumer patches it.
Recorded: web `/api/healthz` is constant `{ok:true}`, so the route proves "HTTP answers", not
store health.
**C2 — StreamPixels web binding proves invariant 3 end to end (StreamPixels,
after C1, S3, B3).**
- Point the gitlink at the C1 commit.

File diff suppressed because it is too large Load diff

View file

@ -275,6 +275,10 @@ pub struct OperatorBinding {
pub process_write_lease: Option<ProcessWriteLeaseBinding>,
pub brakes: BrakeBinding,
pub rollout: RolloutBinding,
/// Optional per-phase deadline overrides; absent fields take Idunn's defaults
/// when the plan is compiled.
#[serde(default)]
pub deadlines: Option<DeadlineBinding>,
pub placement: PlacementBinding,
#[serde(default)]
pub external_capabilities: Vec<ExternalCapabilityBinding>,
@ -709,6 +713,44 @@ pub struct RolloutBinding {
pub retain_releases: u32,
}
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct DeadlineBinding {
#[serde(default)]
pub fencing_seconds: Option<u32>,
#[serde(default)]
pub leasing_seconds: Option<u32>,
#[serde(default)]
pub awaiting_ready_seconds: Option<u32>,
#[serde(default)]
pub routing_seconds: Option<u32>,
#[serde(default)]
pub committing_seconds: Option<u32>,
}
/// Longest deadline a binding may declare: one day.
pub const MAXIMUM_DEADLINE_SECONDS: u32 = 86_400;
impl DeadlineBinding {
fn validate(&self) -> Result<()> {
for (name, seconds) in [
("fencing", self.fencing_seconds),
("leasing", self.leasing_seconds),
("awaiting-ready", self.awaiting_ready_seconds),
("routing", self.routing_seconds),
("committing", self.committing_seconds),
] {
if let Some(seconds) = seconds {
ensure!(
(1..=MAXIMUM_DEADLINE_SECONDS).contains(&seconds),
"{name} deadline must be between 1 and {MAXIMUM_DEADLINE_SECONDS} seconds"
);
}
}
Ok(())
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum RolloutStrategy {
@ -1343,6 +1385,9 @@ impl OperatorBinding {
/// The part of validation that does not depend on where the workload runs.
fn validate_shared_tail(&self) -> Result<()> {
if let Some(deadlines) = &self.deadlines {
deadlines.validate()?;
}
ensure!(
self.rollout.retain_releases >= 2,
"candidate rollout must retain at least current and prior releases"

View file

@ -12,13 +12,16 @@ use sha2::{Digest, Sha256};
use crate::control_plane::SequenceAdmittedReady;
use crate::deployment::{
CapabilityDependency, DependencyKind, ExternalCapabilityBinding, OperatorBinding,
CapabilityDependency, DeadlineBinding, DependencyKind, ExternalCapabilityBinding, OperatorBinding,
ServiceTransport, SourceSelectionPolicy, StartupOrder, StateDeclaration, TargetDeclaration,
capability_compatible,
};
pub const SOURCE_SELECTION_FACTS_SCHEMA: &str = "idunn.source_selection_facts.v1";
pub const COMPILED_DEPLOYMENT_PLAN_SCHEMA: &str = "idunn.compiled_deployment_plan.v2";
pub const COMPILED_DEPLOYMENT_PLAN_SCHEMA: &str = "idunn.compiled_deployment_plan.v3";
/// Plans sealed before phase deadlines existed. They keep their bytes, and so
/// their plan id; their deadlines are Idunn's defaults at read time.
pub const COMPILED_DEPLOYMENT_PLAN_SCHEMA_V2: &str = "idunn.compiled_deployment_plan.v2";
pub const SEALED_RELEASE_SCHEMA: &str = "idunn.sealed_release.v1";
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
@ -460,6 +463,89 @@ pub fn select_dependencies(
.collect()
}
/// Idunn's default duration for each post-fencing phase, in seconds. A binding
/// overrides any of them; the resolved values are frozen into the plan.
pub const DEFAULT_FENCING_DEADLINE_SECONDS: u32 = 120;
pub const DEFAULT_LEASING_DEADLINE_SECONDS: u32 = 120;
// Unsafe for streampixels-service (startup = "create-or-open-after-write-lease"):
// its Postgres migrations run inside AwaitingReady. B5 requires an explicit
// binding value for stateful targets instead of this default.
pub const DEFAULT_AWAITING_READY_DEADLINE_SECONDS: u32 = 300;
pub const DEFAULT_ROUTING_DEADLINE_SECONDS: u32 = 120;
pub const DEFAULT_COMMITTING_DEADLINE_SECONDS: u32 = 120;
/// The resolved per-phase deadline durations a plan carries. Nothing reads
/// them at the cut that introduced them.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct PhaseDeadlines {
pub fencing_seconds: u32,
pub leasing_seconds: u32,
pub awaiting_ready_seconds: u32,
pub routing_seconds: u32,
pub committing_seconds: u32,
}
impl PhaseDeadlines {
pub const IDUNN_DEFAULTS: Self = Self {
fencing_seconds: DEFAULT_FENCING_DEADLINE_SECONDS,
leasing_seconds: DEFAULT_LEASING_DEADLINE_SECONDS,
awaiting_ready_seconds: DEFAULT_AWAITING_READY_DEADLINE_SECONDS,
routing_seconds: DEFAULT_ROUTING_DEADLINE_SECONDS,
committing_seconds: DEFAULT_COMMITTING_DEADLINE_SECONDS,
};
/// Binding overrides over Idunn's defaults.
pub fn resolve(binding: Option<&DeadlineBinding>) -> Self {
let defaults = Self::IDUNN_DEFAULTS;
let Some(binding) = binding else {
return defaults;
};
Self {
fencing_seconds: binding.fencing_seconds.unwrap_or(defaults.fencing_seconds),
leasing_seconds: binding.leasing_seconds.unwrap_or(defaults.leasing_seconds),
awaiting_ready_seconds: binding
.awaiting_ready_seconds
.unwrap_or(defaults.awaiting_ready_seconds),
routing_seconds: binding.routing_seconds.unwrap_or(defaults.routing_seconds),
committing_seconds: binding
.committing_seconds
.unwrap_or(defaults.committing_seconds),
}
}
fn validate_against(&self, binding: &OperatorBinding) -> Result<()> {
let declared = binding.deadlines.clone().unwrap_or_default();
for (name, frozen, declared) in [
("fencing", self.fencing_seconds, declared.fencing_seconds),
("leasing", self.leasing_seconds, declared.leasing_seconds),
(
"awaiting-ready",
self.awaiting_ready_seconds,
declared.awaiting_ready_seconds,
),
("routing", self.routing_seconds, declared.routing_seconds),
(
"committing",
self.committing_seconds,
declared.committing_seconds,
),
] {
ensure!(
(1..=crate::deployment::MAXIMUM_DEADLINE_SECONDS).contains(&frozen),
"frozen {name} deadline is out of range"
);
if let Some(declared) = declared {
ensure!(
frozen == declared,
"frozen {name} deadline differs from the binding"
);
}
}
Ok(())
}
}
/// Private Idunn control-plane state. This contains host binding details and is
/// never an Odin/CultMesh projection. The shared CultNet Expected incarnation
/// is the sanitized topology projection derived only after a release validates
@ -476,12 +562,17 @@ pub struct CompiledDeploymentPlan {
pub binding_blob: Vec<u8>,
pub dependencies: Vec<DependencySelection>,
pub candidate_port: Option<u16>,
/// Present exactly on v3 plans. Skipped when absent so a v2 plan re-encodes
/// to its original bytes and keeps its plan id.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub deadlines: Option<PhaseDeadlines>,
}
impl CompiledDeploymentPlan {
pub fn validate(&self) -> Result<()> {
ensure!(
self.schema == COMPILED_DEPLOYMENT_PLAN_SCHEMA,
self.schema == COMPILED_DEPLOYMENT_PLAN_SCHEMA
|| self.schema == COMPILED_DEPLOYMENT_PLAN_SCHEMA_V2,
"unsupported deployment-plan schema"
);
require_sha256(&self.plan_id, "plan id")?;
@ -492,6 +583,11 @@ impl CompiledDeploymentPlan {
);
let (declaration, binding) = self.parsed_inputs()?;
self.source.validate_against(&binding)?;
match (&self.schema[..], &self.deadlines) {
(COMPILED_DEPLOYMENT_PLAN_SCHEMA, Some(deadlines)) => deadlines.validate_against(&binding)?,
(COMPILED_DEPLOYMENT_PLAN_SCHEMA_V2, None) => {}
_ => bail!("deployment plan deadlines differ from its schema"),
}
ensure!(
sha256_id(&self.recipe_blob) == self.source.recipe_blob_sha256,
"selected recipe blob differs from the exact plan recipe bytes"
@ -527,6 +623,12 @@ impl CompiledDeploymentPlan {
Ok(())
}
/// The deadline durations this plan runs under: frozen for v3, Idunn's
/// defaults for a v2 plan that predates them.
pub fn phase_deadlines(&self) -> PhaseDeadlines {
self.deadlines.unwrap_or(PhaseDeadlines::IDUNN_DEFAULTS)
}
pub(crate) fn parsed_inputs(&self) -> Result<(TargetDeclaration, OperatorBinding)> {
let recipe_text = std::str::from_utf8(&self.recipe_blob)
.context("stored deployment recipe is not UTF-8")?;
@ -589,6 +691,7 @@ pub(crate) fn compile_deployment_plan(
binding_blob: binding_bytes.to_vec(),
dependencies,
candidate_port,
deadlines: Some(PhaseDeadlines::resolve(binding.deadlines.as_ref())),
};
plan.plan_id = plan.recomputed_plan_id()?;
plan.validate()?;
@ -998,7 +1101,7 @@ fn sha256_id(bytes: &[u8]) -> String {
}
#[cfg(test)]
mod tests {
pub(crate) mod tests {
use super::*;
use cultnet_rs::{
GameCultProviderHealthIdentity, GameCultRuntimeCapability, IdunnRuntimeActivationLaunch,
@ -1009,7 +1112,7 @@ mod tests {
verify_runtime_authority,
};
const RECIPE: &str = r#"
pub(crate) const RECIPE: &str = r#"
schema = "gamecult.idunn.target_declaration.v1"
target = "service"
source_stamp_environment = "SERVICE_BUILD_COMMIT"
@ -1072,7 +1175,7 @@ schema = "odin.verse-topology.v1"
compatibility = "v1"
"#;
const BINDING: &str = r#"
pub(crate) const BINDING: &str = r#"
schema = "gamecult.idunn.operator_binding.v2"
target = "service"
@ -1147,7 +1250,7 @@ nodes = ["yggdrasil"]
format!("sha256-{}", char::from(byte).to_string().repeat(64))
}
fn source(recipe: &str) -> SourceSelectionFacts {
pub(crate) fn source(recipe: &str) -> SourceSelectionFacts {
SourceSelectionFacts {
schema: SOURCE_SELECTION_FACTS_SCHEMA.into(),
origin: "https://github.com/GameCult/Service.git".into(),
@ -1287,7 +1390,7 @@ nodes = ["yggdrasil"]
.unwrap()
}
fn artifact_receipt() -> ArtifactReceipt {
pub(crate) fn artifact_receipt() -> ArtifactReceipt {
ArtifactReceipt {
artifact_id: "daemon".into(),
destination: "service".into(),
@ -1297,7 +1400,7 @@ nodes = ["yggdrasil"]
}
}
fn external_input_receipt() -> ExternalInputMaterializationReceipt {
pub(crate) fn external_input_receipt() -> ExternalInputMaterializationReceipt {
ExternalInputMaterializationReceipt {
input_id: "toolchain-index".into(),
url: "https://example.invalid/toolchain-index".into(),
@ -1594,4 +1697,92 @@ nodes = ["yggdrasil"]
changed.external_inputs[0].size_bytes = 18;
assert!(changed.validate_against(&plan).is_err());
}
fn binding_with_deadlines(table: &str) -> String {
BINDING.replace("[placement]", &format!("{table}\n[placement]"))
}
fn plan_under(binding: &str) -> Result<CompiledDeploymentPlan> {
let providers = [ready_odin_provider("odin", "odin-yggdrasil", 1)];
compile_deployment_plan(
RECIPE.as_bytes(),
binding.as_bytes(),
source(RECIPE),
"service-incarnation-1",
Some(18001),
110,
&providers,
)
}
#[test]
fn a_compiled_plan_freezes_idunn_default_deadlines() {
let plan = plan();
assert_eq!(plan.schema, COMPILED_DEPLOYMENT_PLAN_SCHEMA);
assert_eq!(plan.deadlines, Some(PhaseDeadlines::IDUNN_DEFAULTS));
assert_eq!(plan.phase_deadlines(), PhaseDeadlines::IDUNN_DEFAULTS);
plan.validate().unwrap();
}
#[test]
fn a_binding_overrides_only_the_deadlines_it_names() {
let binding = binding_with_deadlines("[deadlines]\nawaiting_ready_seconds = 45\n");
let plan = plan_under(&binding).unwrap();
let frozen = plan.phase_deadlines();
assert_eq!(frozen.awaiting_ready_seconds, 45);
assert_eq!(
PhaseDeadlines {
awaiting_ready_seconds: DEFAULT_AWAITING_READY_DEADLINE_SECONDS,
..frozen
},
PhaseDeadlines::IDUNN_DEFAULTS
);
}
#[test]
fn deadline_bounds_and_unknown_phases_are_refused() {
for table in [
"[deadlines]\nrouting_seconds = 0\n",
"[deadlines]\nrouting_seconds = 86401\n",
"[deadlines]\nwarming_seconds = 5\n",
] {
assert!(
OperatorBinding::parse(&binding_with_deadlines(table)).is_err(),
"{table}"
);
}
}
#[test]
fn frozen_deadlines_must_agree_with_the_binding_and_the_plan_schema() {
let binding = binding_with_deadlines("[deadlines]\nrouting_seconds = 45\n");
let sealed = |mut plan: CompiledDeploymentPlan| {
plan.plan_id = plan.recomputed_plan_id().unwrap();
plan
};
let honest = plan_under(&binding).unwrap();
let mut drifted = honest.clone();
drifted.deadlines.as_mut().unwrap().routing_seconds = 46;
assert!(sealed(drifted).validate().is_err());
let mut absent = honest.clone();
absent.deadlines = None;
assert!(sealed(absent).validate().is_err());
let mut v2_with_deadlines = honest.clone();
v2_with_deadlines.schema = COMPILED_DEPLOYMENT_PLAN_SCHEMA_V2.into();
assert!(sealed(v2_with_deadlines).validate().is_err());
// A plan sealed before deadlines existed keeps its nine-field encoding,
// so its plan id still holds, and it runs on Idunn's defaults.
let mut v2 = plan();
v2.schema = COMPILED_DEPLOYMENT_PLAN_SCHEMA_V2.into();
v2.deadlines = None;
let v2 = sealed(v2);
v2.validate().unwrap();
assert_eq!(v2.phase_deadlines(), PhaseDeadlines::IDUNN_DEFAULTS);
assert_eq!(rmp_serde::to_vec(&v2).unwrap()[0], 0x99);
assert_eq!(rmp_serde::to_vec(&honest).unwrap()[0], 0x9a);
}
}

View file

@ -5387,6 +5387,8 @@ impl NginxRouteDriver {
self.restore(preflight.incumbent_configuration.as_deref())
}
/// A fragment already equal to the admitted membership is left alone: no
/// write, no `nginx -t`, no firewall call, no reload.
pub fn restore_admitted_membership(
&self,
expected: &IdunnExpectedIncarnationRecord,
@ -5397,10 +5399,11 @@ impl NginxRouteDriver {
membership_sha256 == sha256_id(&rendered),
"admitted route receipt does not describe the expected membership"
);
self.validate_candidate_in_private_mount(&rendered)?;
if self.current_configuration()?.as_deref() != Some(rendered.as_slice()) {
atomic_replace(&self.binding.config_path, &rendered)?;
if self.current_configuration()?.as_deref() == Some(rendered.as_slice()) {
return Ok(());
}
self.validate_candidate_in_private_mount(&rendered)?;
atomic_replace(&self.binding.config_path, &rendered)?;
if let Err(reload) = self.admit_endpoint().and_then(|()| self.reload()) {
return match self.write_fragment(None) {
Ok(()) => Err(reload).context("reloading the exact admitted route membership"),
@ -10285,6 +10288,83 @@ mod tests {
Ok(())
}
/// Observation observes: restoring a membership whose fragment is already
/// exact touches nothing, and drifted bytes are restored with one reload.
#[cfg(unix)]
#[test]
fn restoring_an_exact_admitted_membership_actuates_nothing_and_drift_reloads_once()
-> Result<()> {
use std::os::unix::fs::PermissionsExt;
let temp = tempfile::tempdir()?;
let calls = temp.path().join("calls");
let program = |name: &str| -> Result<PathBuf> {
let path = temp.path().join(name);
fs::write(
&path,
format!("#!/bin/sh\necho \"{name} $*\" >> '{}'\nexit 0\n", calls.display()),
)?;
fs::set_permissions(&path, fs::Permissions::from_mode(0o755))?;
Ok(path)
};
let config = temp.path().join("service.conf");
let driver = NginxRouteDriver {
binding: RouteBinding {
driver: RouteDriver::NginxStreamTcp,
route_id: "service-route".into(),
stable_endpoint: "http://127.0.0.1:4103".into(),
private_host: "127.0.0.1".into(),
private_port_start: 4104,
private_port_end: 4109,
config_path: config.clone(),
reload_unit: "nginx.service".into(),
},
nginx_program: program("nginx")?,
systemd_run_program: program("systemd-run")?,
systemctl_program: program("systemctl")?,
ufw_program: program("ufw")?,
preflight_root: temp.path().join("preflight"),
};
let mut candidate = expected();
candidate.route = Some(cultnet_rs::IdunnExpectedRoute {
route_id: "service-route".into(),
transport: "http".into(),
stable_endpoint: "http://127.0.0.1:4103".into(),
candidate_endpoint: "http://127.0.0.1:4104".into(),
});
let rendered = driver.render(&candidate)?;
let membership_sha256 = sha256_id(&rendered);
let count = |prefix: &str| -> Result<usize> {
Ok(fs::read_to_string(&calls)
.unwrap_or_default()
.lines()
.filter(|line| line.starts_with(prefix))
.count())
};
fs::write(&config, &rendered)?;
let modified = fs::metadata(&config)?.modified()?;
driver.restore_admitted_membership(&candidate, &membership_sha256)?;
driver.restore_admitted_membership(&candidate, &membership_sha256)?;
assert!(!calls.exists(), "an exact fragment must run no program");
assert!(!driver.preflight_root.exists());
assert_eq!(fs::read(&config)?, rendered);
assert_eq!(fs::metadata(&config)?.modified()?, modified);
fs::write(&config, b"drifted bytes\n")?;
driver.restore_admitted_membership(&candidate, &membership_sha256)?;
assert_eq!(fs::read(&config)?, rendered);
assert_eq!(count("systemctl reload")?, 1);
assert_eq!(count("systemd-run")?, 1);
assert_eq!(count("ufw allow")?, 1);
assert_eq!(count("nginx -t")?, 1);
driver.restore_admitted_membership(&candidate, &membership_sha256)?;
assert_eq!(count("systemctl reload")?, 1, "restored bytes never reload again");
assert_eq!(count("ufw")?, 1);
Ok(())
}
#[test]
fn an_empty_route_fragment_is_absence_not_a_membership() -> Result<()> {
let temp = tempfile::tempdir()?;

View file

@ -0,0 +1,24 @@
# Legacy control-record wire fixtures
Each `*.hex` file is two lines: the CultCache envelope `schema_id`, then the
record's MessagePack payload in hex. They are the exact bytes the encoder at
Idunn `9001b58` (the base of the F0 cut) wrote for records built through that
revision's own constructors: `DeploymentTransaction::new`,
`AdmittedGeneration::from_transaction`, `SealedRelease::new`,
`compile_deployment_plan`, and `rmp_serde::to_vec`. A throwaway test on a
scratch commit over `9001b58` printed them; it is not kept.
Everything in them is synthetic: identities were enrolled fresh in a temporary
directory, the Odin receipts are placeholder bytes with correct digests, and
the plan is the `deployment_plan` test recipe. No byte comes from a live store.
| File | Schema | What it is |
|---|---|---|
| `generation-with-receipts` | `idunn.admitted_generation.v2` | routed, stateless generation with Ready and latest Odin receipts |
| `generation-route-repair-started` | `idunn.admitted_generation.v2` | the same with `route_repair_started_at_unix_millis` set |
| `transaction-fencing` .. `transaction-committing` | `idunn.deployment_transaction.v3` | one continuity transaction in each post-fencing phase |
| `transaction-committing-v2` | `idunn.deployment_transaction.v2` | the Committing record in the v2 layout: the v3 tuple without key 34 (base code stops writing v2, so this one is the v3 encoding with its trailing nil slot dropped and the header count lowered) |
| `transaction-failed-after-fencing` | `idunn.deployment_transaction.v3` | terminal post-fencing failure with complete abort evidence |
`control_plane.rs` decodes these through `LegacyDeploymentTransaction` and
`LegacyAdmittedGeneration`. The fixtures die with those structs.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long