Watch
0
0
Fork
You've already forked hyperhive
0

auto-update: a rebuild is live until its whole subtree is terminal

rebuild_live checked only MetaSync, which finishes in 0.2 s, so the next
5-min pass queued a second rebuild while the first still held the stop,
swap and start. It now covers MetaSync, AgentWindow, Prebuild,
StopForUpdate, Swap and RebuildBookkeeping. AgentWindow is also the brace
of a pause window, so an open pause skips that agent's pass too; the docs
say so and a test pins it.
This commit is contained in:
atlas 2026-11-19 00:48:25 +01:00 • committed by mara
commit 12e797e7e3

View file

@ -268,4 +268,31 @@ mod tests {
assert_eq!(running(&q), ["knowledge_pull"]);
second.await;
}
/// A rebuild stays live for its agent after its `MetaSync` finishes, until
/// the swap steps behind it are done too.
#[tokio::test]
async fn a_rebuild_is_live_until_its_swap_steps_finish() {
let q = JobQueue::new(1);
q.insert_job(|b| templates::rebuild(b, "alice"))
.expect("insert");
assert!(q.rebuild_live("alice"), "control: queued rebuild is live");
let meta_sync = claim(&q).expect("MetaSync is the first runnable node");
assert_eq!(running(&q), ["meta_sync"]);
meta_sync.await;
assert!(
q.rebuild_live("alice"),
"MetaSync is done but the swap steps are pending"
);
assert!(!q.rebuild_live("bob"), "another agent is not affected");
while let Some(node) = claim(&q) {
node.await;
}
assert!(
!q.rebuild_live("alice"),
"every node of the rebuild is terminal"
);
}
}