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:
parent
bd6009ff33
commit
739c35757a
1 changed files with 140 additions and 72 deletions
|
|
@ -695,11 +695,8 @@ pub async fn join_room(client: &Client, room_ref: &str) -> DaemonResponse {
|
|||
// Clear the invite todo so the accepted invite drops out of
|
||||
// `get_loose_ends` immediately (the sweep would also clear it
|
||||
// on its next tick, but this makes it instant).
|
||||
let _ = crate::wake::send_todo_clear(
|
||||
Some(&crate::timeline::invite_key(room.room_id())),
|
||||
false,
|
||||
)
|
||||
.await;
|
||||
let _ =
|
||||
crate::wake::send_todo_clear(&crate::timeline::invite_key(room.room_id())).await;
|
||||
DaemonResponse::ok(&serde_json::json!({
|
||||
"joined": true,
|
||||
"room_id": room.room_id().to_string(),
|
||||
|
|
@ -733,11 +730,9 @@ pub async fn resolve_invite(
|
|||
match room.leave().await {
|
||||
Ok(()) => {
|
||||
// Clear the invite todo immediately on reject.
|
||||
let _ = crate::wake::send_todo_clear(
|
||||
Some(&crate::timeline::invite_key(room.room_id())),
|
||||
false,
|
||||
)
|
||||
.await;
|
||||
let _ =
|
||||
crate::wake::send_todo_clear(&crate::timeline::invite_key(room.room_id()))
|
||||
.await;
|
||||
DaemonResponse::ok(&serde_json::json!({
|
||||
"rejected": true,
|
||||
"room_id": room.room_id().to_string(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue