From 8834161fb93c19f0608c0051714604f924a80fae Mon Sep 17 00:00:00 2001 From: atlas Date: Mon, 20 Jul 2026 22:16:27 +0200 Subject: [PATCH] feat(#2591): add NodeKind::Dag DAG-container variant --- hive-c0re/src/job_queue/exec.rs | 4 ++++ hive-c0re/src/job_queue/model.rs | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/hive-c0re/src/job_queue/exec.rs b/hive-c0re/src/job_queue/exec.rs index 219ea1b2..52eba21b 100644 --- a/hive-c0re/src/job_queue/exec.rs +++ b/hive-c0re/src/job_queue/exec.rs @@ -103,6 +103,10 @@ pub(super) async fn run_node(coord: &Arc, claim: &Claim) -> Result< NodeKind::ResolveApproval => run_resolve_approval(coord, claim).await, NodeKind::EmitRebuilt => Ok(run_emit_rebuilt(coord, claim)), NodeKind::RevertIntent => run_revert_intent(coord, claim).await, + // Pure grouping container — no work; completing it lets it reach + // `Finishing` so its child template nodes start. The DAG's terminal + // hook fires when the container itself rolls up terminal. + NodeKind::Dag { .. } => Ok(NodeOutput::default()), } } diff --git a/hive-c0re/src/job_queue/model.rs b/hive-c0re/src/job_queue/model.rs index 619572b9..aa85eaf9 100644 --- a/hive-c0re/src/job_queue/model.rs +++ b/hive-c0re/src/job_queue/model.rs @@ -14,6 +14,8 @@ pub use hive_sh4re::jobs::{DagView, NodeId, PermPayload, Source, State, Template}; use serde::Serialize; +use crate::coordinator::TransientKind; + /// When a dependency edge is considered satisfied. #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)] #[serde(rename_all = "snake_case")] @@ -154,6 +156,24 @@ pub enum NodeKind { /// means "don't do it". Noop on any non-cancelled outcome. Appended weak-dep /// on the tails; slot/lease-exempt. RevertIntent, + /// The **DAG container** node: one per submitted DAG, carrying the group's + /// domain metadata. Every template node hangs *under* it (its subtree), so + /// the container's `NodeId` **is** the DAG id, its rolled-up state **is** the + /// DAG state, and it reaching terminal **is** the completion signal that + /// fires the DAG's inline hook (approval-resolve / rebuilt-emit / + /// intent-revert, dispatched off `template`). Pure grouping — lease- and + /// build-slot-exempt; the executor instant-completes it (`Done`) so it + /// reaches `Finishing` and its children start. + Dag { + template: Template, + source: Source, + reason: String, + transient: Option, + approval_id: Option, + inputs: Vec, + perm_payload: Option, + created_at: i64, + }, } impl NodeKind { @@ -179,6 +199,7 @@ impl NodeKind { NodeKind::ResolveApproval => "resolve_approval", NodeKind::EmitRebuilt => "emit_rebuilt", NodeKind::RevertIntent => "revert_intent", + NodeKind::Dag { .. } => "dag", } }