hivectl: migrate dag_progress to hive-jobq-wire's generic GraphNode

This commit is contained in:
damocles 2026-08-03 18:47:22 +02:00 committed by mara
commit 10b0f640af
8 changed files with 272 additions and 175 deletions

View file

@ -214,6 +214,14 @@ pub enum HostRequest {
/// `hivectl`'s wait/progress loop. A multi-step op is a single DAG
/// (its whole graph in `nodes`). Result: [`HostResponse::dags`].
QueueDag { id: u64 },
/// Fetch one job-queue DAG's container node plus its live subtree, as
/// generic `hive-jobq-wire` nodes — `hivectl`'s wait/progress loop.
/// Sibling of [`Self::QueueDag`]: same DAG, same
/// `id` (the container's own node id, what `queued_dags` already
/// carries), through the generic projection instead of the typed
/// `DagView`/`NodeView` (kept for `QueueDag`'s other consumer,
/// `/api/state.rebuild_queue`). Result: [`HostResponse::nodes`].
QueueNodes { id: u64 },
/// List pending approval requests.
Pending,
/// Approve a pending request by id; the action runs immediately.
@ -539,6 +547,15 @@ pub struct HostResponse {
/// been evicted from the queue's history tail.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub dags: Option<Vec<jobs::DagView>>,
/// `QueueNodes` result — the requested DAG's container node plus its
/// live subtree, as generic `hive-jobq-wire` nodes. `None` for every
/// other request kind. An empty `Vec` means `id` names no live DAG in
/// the graph (today: an unknown id — see `JobQueue::dag_nodes`'s doc
/// comment for why a *completed* DAG's nodes don't vanish the same way
/// `QueueDag`'s do); callers should read the root node's `state` for
/// terminality, not emptiness.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub nodes: Option<Vec<hive_jobq_wire::GraphNode>>,
/// Free-form operator-facing output lines the client prints verbatim
/// (one per line). Carries results a request produced daemon-side that
/// have no structured home — e.g. a freshly-minted matrix token, a
@ -639,6 +656,17 @@ impl HostResponse {
}
}
/// `QueueNodes` result — the polled DAG's container + subtree, as
/// generic wire nodes.
#[must_use]
pub fn nodes(nodes: Vec<hive_jobq_wire::GraphNode>) -> Self {
Self {
ok: true,
nodes: Some(nodes),
..Self::default()
}
}
/// A success carrying operator-facing output lines the client prints
/// verbatim — the result shape for the `Matrix*` provisioning requests.
#[must_use]