hivectl: batch QueueNodes polling by id set, drop remaining dag wording

This commit is contained in:
damocles 2026-08-03 20:17:16 +02:00 committed by mara
commit 0c4d56a585
8 changed files with 182 additions and 125 deletions

View file

@ -214,15 +214,19 @@ 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 node plus its live subtree, as generic
/// `hive-jobq-wire` nodes — `hivectl`'s wait/progress loop. Sibling of
/// [`Self::QueueDag`]: same graph, same `id`, through the generic
/// Fetch one or more job-queue nodes plus their live subtrees, as
/// generic `hive-jobq-wire` nodes — `hivectl`'s wait/progress loop.
/// Sibling of [`Self::QueueDag`]: same graph, through the generic
/// projection instead of the typed `DagView`/`NodeView` (kept for
/// `QueueDag`'s other consumer, `/api/state.rebuild_queue`). No
/// assumption that `id` names a DAG container or root — whatever node
/// has that id, the backend hands back its subtree as-is. Result:
/// assumption that an id names a DAG container or root — whatever
/// node has that id, the backend hands back its subtree as-is. A
/// batch op that submits several independent roots (e.g. one per
/// agent on a hive-wide restart) is a single request naming all of
/// them, not one request per id — the caller owns bundling `ids`,
/// this request just answers whatever it's asked. Result:
/// [`HostResponse::nodes`].
QueueNodes { id: u64 },
QueueNodes { ids: Vec<u64> },
/// List pending approval requests.
Pending,
/// Approve a pending request by id; the action runs immediately.
@ -548,13 +552,14 @@ 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 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 node in the graph (today: an
/// unknown id — see `JobQueue::node_subtree`'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.
/// `QueueNodes` result — the requested nodes plus their live subtrees,
/// as generic `hive-jobq-wire` nodes, all roots' subtrees combined in
/// one flat list. `None` for every other request kind. An id with no
/// live node in the graph is silently dropped rather than erroring
/// the whole batch — see `JobQueue::node_subtrees`'s doc comment for
/// why a *completed* DAG's nodes don't vanish the same way
/// `QueueDag`'s do; callers should read each root node's `state` for
/// terminality, not absence.
#[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