hyperhive/hive-jobq/src
Repository files (latest commit first)
Filename Latest commit message Latest commit date
atlas a2edad715f jobq: make the builder the only way nodes enter a graph
`Graph::insert` was public and validating, and the builder's insert loop
called it with `?`. That made job-level atomicity an accident: the loop
mutates as it goes, so a rejection at node `i` left `0..i` already in the
graph — the error fired loudly *after* the corruption, not instead of it.
It held only because `check_job_shape` happens to be exhaustive, with
nothing in the types saying so.

Make the guarantee structural instead. `Graph::insert` becomes
`pub(crate)`; the builder drains into a new infallible
`insert_unchecked` (via `Scheduler::append_unchecked`), so
`insert_with`'s sink returns a bare `NodeId` and a half-built job is no
longer expressible. Re-checking at the sink cannot add safety anyway — it
can only report after the mutation it was meant to prevent.

Drop `BuildError::Graph`: nothing in the builder path can produce a
`GraphError` any more. Clippy could not see this (an unreachable variant
of a `pub` enum is still constructible from outside the crate).

`Scheduler::append` stays public and validating — hive-c0re inserts a
DAG's container node through it. Folding that away means removing the
container/DagView indirection, which is out of scope here.
2026-08-02 15:45:27 +02:00
..
builder.rs jobq: make the builder the only way nodes enter a graph 2026-08-02 15:45:27 +02:00
lib.rs jobq: make the builder the only way nodes enter a graph 2026-08-02 15:45:27 +02:00
resources.rs refactor(#2500): encapsulate the jobq lock, drop the dead borrowed-guard layer 2026-07-19 15:24:11 +02:00
scheduler.rs jobq: make the builder the only way nodes enter a graph 2026-08-02 15:45:27 +02:00