Watch
0
0
Fork
You've already forked hyperhive
0

hive-matrix-mcp: test the retry path and the once-only todo clear

The startup todo wipe runs once in main, before any sync loop, so a
secondary that comes up later cannot clear the todos the running
accounts' sweeps already deduped. Nothing tested that.

main now reads HIVE_AGENT_SOCKET once at startup and hands the path to
wake::clear_all_todos, the only way left to wipe the whole set;
send_todo_clear clears one key only. bring_up_account is split into
restore_account (everything that talks to the network) and the
synchronous account_sync_loop, and the retry path restores with the
former and builds the loop itself. Neither the loop nor the retry path
is given the socket.

The new test runs a late secondary's retry and its sync loop against a
listener standing in for the harness socket, after startup's wipe, and
asserts the harness saw exactly one wipe. It pins that seam, not every
place in restore_account a wipe could be added.
This commit is contained in:
atlas 2026-10-14 05:44:06 +02:00 • committed by mara
commit 739c35757a
4 changed files with 140 additions and 72 deletions

View file

@ -60,10 +60,7 @@ pub async fn sweep_unread<S: BuildHasher>(
.collect()
};
for id in stale {
if wake::send_todo_clear(Some(id.as_str()), false)
.await
.is_ok()
{
if wake::send_todo_clear(id.as_str()).await.is_ok() {
notified.lock().await.remove(&id);
}
}
@ -121,10 +118,7 @@ pub async fn sweep_invites<S: BuildHasher>(
.collect()
};
for id in stale {
if wake::send_todo_clear(Some(&invite_key(&id)), false)
.await
.is_ok()
{
if wake::send_todo_clear(&invite_key(&id)).await.is_ok() {
notified.lock().await.remove(&id);
}
}