fix(#948): pre-enqueue topology-sorted cascades on meta-update approval
This commit is contained in:
parent
11d74e1e17
commit
68fd7e08a5
1 changed files with 17 additions and 2 deletions
|
|
@ -64,15 +64,30 @@ pub async fn approve(coord: Arc<Coordinator>, id: i64) -> Result<()> {
|
||||||
// dashboard can show *which* inputs are about to bump.
|
// dashboard can show *which* inputs are about to bump.
|
||||||
let inputs: Vec<String> =
|
let inputs: Vec<String> =
|
||||||
serde_json::from_str(&approval.commit_ref).unwrap_or_default();
|
serde_json::from_str(&approval.commit_ref).unwrap_or_default();
|
||||||
coord.rebuild_queue.enqueue_full(
|
let parent_id = coord.rebuild_queue.enqueue_full(
|
||||||
crate::rebuild_queue::QueueKind::MetaUpdate,
|
crate::rebuild_queue::QueueKind::MetaUpdate,
|
||||||
approval.agent.clone(),
|
approval.agent.clone(),
|
||||||
crate::rebuild_queue::QueueSource::Approval,
|
crate::rebuild_queue::QueueSource::Approval,
|
||||||
format!("approval #{id} meta input update"),
|
format!("approval #{id} meta input update"),
|
||||||
None,
|
None,
|
||||||
inputs,
|
inputs.clone(),
|
||||||
Some(id),
|
Some(id),
|
||||||
);
|
);
|
||||||
|
// Pre-enqueue cascade rebuilds in topological order so
|
||||||
|
// agents depending on updated inputs are rebuilt after the
|
||||||
|
// lock bump, matching the dashboard post_meta_update path.
|
||||||
|
let cascade_agents =
|
||||||
|
crate::rebuild_queue::meta_update_cascade_agents(&inputs).await;
|
||||||
|
let cascade_reason = format!("approval #{id} meta input cascade");
|
||||||
|
for name in cascade_agents {
|
||||||
|
coord.rebuild_queue.enqueue(
|
||||||
|
crate::rebuild_queue::QueueKind::Rebuild,
|
||||||
|
name,
|
||||||
|
crate::rebuild_queue::QueueSource::MetaUpdate,
|
||||||
|
cascade_reason.clone(),
|
||||||
|
Some(parent_id),
|
||||||
|
);
|
||||||
|
}
|
||||||
coord.emit_rebuild_queue_snapshot();
|
coord.emit_rebuild_queue_snapshot();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue