hyperhive/hive-jobq-wire
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas fe0906c043 jobq-wire: name every outcome, keep the enum spellings, document the schema
Three things, all from review:

Accepted outcomes were built from a hand-listed [Done, Failed, Cancelled,
Skipped] array. Exhaustive today, silently short the day someone adds a
variant — the new outcome would vanish from every edge that accepts it.
BitFlags::ALL asks the type instead.

TerminalState carried rename_all = "snake_case" while its sibling State did
not, so one enum shipped "done" and the other "Done". A rename is a second
spelling of a name that then has to be kept in agreement by hand; both now
serialise their variant names verbatim. Nothing else reads TerminalState off
a wire, so no consumer moves. GraphDep's tag values likewise.

The endpoint documented its body as serde_json::Value, which tells a spec
reader nothing. hive-jobq-wire now derives ToSchema. State and TerminalState
are foreign types here and utoipa stays out of the scheduler crate, so the
schema points at local mirror enums. A mirror that drifts is worse than none:
the conversions are exhaustive (a new upstream variant fails the build) and a
test asserts each documented name equals the serialised one, since an
exhaustive match still compiles when only the spellings diverge.
2026-08-03 00:39:14 +02:00
..
src jobq-wire: name every outcome, keep the enum spellings, document the schema 2026-08-03 00:39:14 +02:00
Cargo.toml jobq-wire: name every outcome, keep the enum spellings, document the schema 2026-08-03 00:39:14 +02:00
README.md jobq-wire: move the generic graph projection into its own crate 2026-08-03 00:39:14 +02:00

hive-jobq-wire

Wire types for serving a hive-jobq graph to a viewer, plus the traits a host implements to say how its graph renders.

Why this is not part of hive-jobq. The scheduler crate is logic: a graph, a resource pool, a run loop. Presentation is a different concern with a different audience, and folding it in means every consumer of the scheduler also carries a JSON vocabulary it may never serve — the two get remixed and stay that way. A separate crate keeps that boundary where it can be seen.

A host implements WireNode for its node payload N and WireResource for its resource name R. GraphWire::wire_snapshot is then blanket-implemented for hive_jobq::Graph<N, R> — so the projection exists exactly when both types have said how they render, and a payload that hasn't cannot reach a viewer at all.