fix(#2756): a cancelled DAG must not read back as Queued
Review catch from argus on #2770: with the terminal hook gone, cancel spares the DAG's tail node so it can report the cancellation — which leaves that node `Pending` until the scheduler's next pass. `post_rebuild_queue_cancel` emits its snapshot synchronously, and `rollup_state` ranked `Queued` above `Cancelled`, so the operator who just cancelled a DAG saw it go back to **Queued**: "the cancel didn't take". Asserted in `cancel_clears_queued_dag`, which failed before this. Fixing it surfaced an older disagreement. `builds.js::rollupState` has always been `failed > cancelled > running > queued`; the Rust was `failed > running > queued > cancelled`. The two had silently diverged under a doc-comment claiming they agree. Harmless until now only because cancelled nodes never coexisted with live ones — a spared tail running over cancelled work would have rendered `Running` host-side and `Cancelled` in the dashboard. The JS was the correct side, so the Rust moves to match it exactly: `Failed > Cancelled > Running > Queued > Done`. No frontend change.
This commit is contained in:
parent
e8e6998ac5
commit
36918e0432
2 changed files with 21 additions and 5 deletions
|
|
@ -934,6 +934,11 @@ fn cancel_clears_queued_dag() {
|
|||
let q = JobQueue::new(1);
|
||||
let id = submit(&q, rebuild("agent-a", "r"));
|
||||
assert!(q.cancel(id), "fully-queued dag cancels");
|
||||
// The operator sees `Cancelled` the moment the cancel returns — the spared
|
||||
// tail is still `Pending`, and a DAG must not read `Queued` back to the
|
||||
// operator who just cancelled it (the dashboard renders this roll-up from
|
||||
// the snapshot `post_rebuild_queue_cancel` emits synchronously).
|
||||
assert_eq!(state_of(&q, id), State::Cancelled, "no stale Queued gap");
|
||||
// Every work node is `Cancelled`, but the tail is spared so it can still
|
||||
// report the cancellation — so it is the one thing left to claim.
|
||||
let tail = claim_one(&q);
|
||||
|
|
|
|||
Loading…
Reference in a new issue