refactor(#2808): the wire state enum is the scheduler's own

`hive_host_sock::jobs::State` was a hand-maintained copy of
`hive_jobq::State` — five variants spelled the same in both, kept in sync
by whoever remembered. Adding `Skipped` last week meant adding it twice.
The wire crate now re-exports the scheduler's enum and `to_wire_state` is
gone.

Two states that were hidden now reach clients. `to_wire_state` renamed
`Pending` to `Queued` and folded `Finishing` into `Running`, so the
dashboard could not distinguish a node waiting on its dependencies from
one whose own work is done while its sub-nodes still run. Both are now
visible, and consumers say which they mean.

Every consumer had to move with it, and only the Rust ones said so: the
exhaustive matches in `hivectl` and `DagView::rollup_state` failed to
compile, while the dashboard's fourteen string comparisons would have
gone quietly wrong — a `finishing` node no longer counting as running,
a `pending` node no longer as queued.

The frontend also builds CSS class names out of the state string
(`rqe-` + state, `rqe-node-` + state) and keys its glyph map on it, all
lowercase. Those go through a `stateSlug` helper now; comparisons use the
wire spelling, presentation lowercases. Without that split every queue
entry and node chip would have silently lost its styling.

Dropping the `State as JobState` alias in hive-c0re falls out of this:
the alias only existed to tell two `State` types apart, and there is one
now.
This commit is contained in:
atlas 2026-07-27 21:50:24 +02:00
commit b9aab7e923
8 changed files with 72 additions and 93 deletions

View file

@ -205,6 +205,11 @@ pub enum Dep<R> {
}
/// A node's lifecycle state.
///
/// This type *is* the wire representation — `hive-host-sock` hands it to
/// clients verbatim rather than mapping it through a parallel enum — so the
/// serialised names (`"Pending"`, `"Running"`, …) are what every consumer,
/// including the dashboard's JS, matches on.
#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum State {
/// Waiting on dependencies (node or resource).
@ -213,9 +218,9 @@ pub enum State {
Running,
/// Own logic finished successfully, but the node is *not yet terminal*: it
/// waits here until all its sub-nodes ([`Node::parent`] children) are
/// terminal, then rolls up to [`State::Done`] (every child `Done`) or
/// [`State::Failed`] (any child `Failed`/`Cancelled`). A node with no
/// children never rests here — it goes straight to a terminal state.
/// terminal, then rolls up — `Failed` if any child failed, else `Cancelled`
/// if any was dropped, else `Done`. A node with no children never rests
/// here — it goes straight to a terminal state.
Finishing,
/// Completed successfully — own logic done *and* every sub-node `Done`.
Done,