rebuild_queue: pre-enqueue meta-update cascade at submit time (closes #347)

This commit is contained in:
damocles 2026-05-23 12:36:06 +02:00
commit d81b430136
2 changed files with 166 additions and 28 deletions

View file

@ -1578,14 +1578,30 @@ async fn post_meta_update(
if inputs.is_empty() {
return error_response("meta-update: no inputs selected");
}
state.coord.rebuild_queue.enqueue_with_inputs(
let inputs_label = inputs.join(", ");
let parent_id = state.coord.rebuild_queue.enqueue_with_inputs(
crate::rebuild_queue::QueueKind::MetaUpdate,
"hyperhive".to_owned(),
crate::rebuild_queue::QueueSource::Manual,
format!("meta-update via dashboard ({})", inputs.join(", ")),
format!("meta-update via dashboard ({inputs_label})"),
None,
inputs,
inputs.clone(),
);
// Pre-enqueue cascade rebuilds NOW so they're visible in the queue
// alongside the parent (issue #347). The worker's MetaUpdate arm
// no longer enqueues children — it just runs the lock bump and
// (on failure) cancels these pre-queued children.
let cascade_agents = crate::rebuild_queue::meta_update_cascade_agents(&inputs).await;
let cascade_reason = format!("meta-update cascade ({inputs_label})");
for name in cascade_agents {
state.coord.rebuild_queue.enqueue(
crate::rebuild_queue::QueueKind::Rebuild,
name,
crate::rebuild_queue::QueueSource::MetaUpdate,
cascade_reason.clone(),
Some(parent_id),
);
}
state.coord.emit_rebuild_queue_snapshot();
(StatusCode::OK, "ok").into_response()
}