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.
This commit is contained in:
parent
7966d5eb66
commit
fe0906c043
5 changed files with 148 additions and 18 deletions
|
|
@ -660,9 +660,8 @@ fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
|
|||
dependency edges with their accepted-outcome sets, lifecycle, and \
|
||||
one opaque per-node payload. Group roots ride as ordinary nodes \
|
||||
(`parent: null`) and `Done` nodes are not filtered — a consumer \
|
||||
renders the graph without knowing what any node means. Each element \
|
||||
is a `hive_jobq_wire::GraphNode`",
|
||||
body = serde_json::Value),
|
||||
renders the graph without knowing what any node means.",
|
||||
body = Vec<hive_jobq_wire::GraphNode>),
|
||||
),
|
||||
tag = "state_snapshot"
|
||||
)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue