fix(#2591): validate() rejects out-of-bounds/forward parent index (argus review)

This commit is contained in:
atlas 2026-07-20 21:58:42 +02:00 committed by mara
commit 456847eaa1
2 changed files with 29 additions and 3 deletions

View file

@ -147,6 +147,21 @@ fn unknown_dep_is_rejected_at_submit() {
assert!(q.submit(spec).is_err());
}
#[test]
fn invalid_parent_is_rejected_at_submit() {
let q = JobQueue::new(1);
let mut spec = rebuild("agent-a", "bad parent");
// A forward/out-of-bounds parent index must be refused at validate, not
// panic in `insert_group`.
spec.nodes = vec![NodeSpec {
agent: "agent-a".to_owned(),
kind: NodeKind::Reconcile,
deps: Vec::new(),
parent: Some(3),
}];
assert!(q.submit(spec).is_err());
}
// ---- dependency order within a DAG ----
#[test]