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
|
|
@ -9,6 +9,10 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
chrono = { workspace = true }
|
||||
enumflags2 = { workspace = true }
|
||||
hive-jobq = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
# `chrono` for the lifecycle timestamps' schema; the workspace default carries
|
||||
# only `axum_extras`, and features are additive so this affects nothing else.
|
||||
utoipa = { workspace = true, features = ["chrono"] }
|
||||
|
|
|
|||
Loading…
Reference in a new issue