refactor(#2390): split provision out of the create node in the spawn dag

This commit is contained in:
damocles 2026-07-13 16:04:08 +02:00 committed by mara
commit 436adf6fd0
6 changed files with 79 additions and 35 deletions

View file

@ -9,7 +9,7 @@
//! restart(a): [wanted=Up] StopForUpdate(a) → Reconcile(a)
//! start(a): [wanted=Up] Reconcile(a)
//! stop(a): [wanted=Offline] Reconcile(a)
//! spawn(a): [wanted=Up] Create(a) → WriteDropin(a) → Reconcile(a)
//! spawn(a): [wanted=Up] Provision(a) → Create(a) → WriteDropin(a) → Reconcile(a)
//! perm-change(a): WritePermFile(a) → «rebuild subgraph»
//! meta-update(inp): MetaLock(inp) → «fan-out rebuild(a) per affected a»
//! startup sweep: MetaLock(hyperhive, non-fatal) → «fan-out rebuild(stale a)»
@ -194,9 +194,10 @@ pub fn reconcile_only(
}
}
/// First-deploy spawn (approval-driven): pre-start provisioning +
/// `nixos-container create`, drop-in write, then `Reconcile` starts the
/// container (`wanted = Up` written at approve time).
/// First-deploy spawn (approval-driven): `Provision` (proposed/applied
/// repos, state subvolume, meta registration) then `Create`
/// (`nixos-container create`), drop-in write, then `Reconcile` starts
/// the container (`wanted = Up` written at approve time).
pub fn spawn(agent: &str, approval_id: i64, reason: String) -> DagSpec {
DagSpec {
template: Template::Spawn,
@ -210,17 +211,21 @@ pub fn spawn(agent: &str, approval_id: i64, reason: String) -> DagSpec {
transient: Some(TransientKind::Spawning),
nodes: vec![
NodeSpec {
kind: NodeKind::Create,
kind: NodeKind::Provision,
deps: Vec::new(),
},
NodeSpec {
kind: NodeKind::WriteDropin,
kind: NodeKind::Create,
deps: after_ok(0),
},
NodeSpec {
kind: NodeKind::Reconcile,
kind: NodeKind::WriteDropin,
deps: after_ok(1),
},
NodeSpec {
kind: NodeKind::Reconcile,
deps: after_ok(2),
},
],
}
}