From 1332c2a576db6aa784fab14e1f985efdf11878ed Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 20 Nov 2026 11:29:13 -0700 Subject: [PATCH] test(mcp): the sessions test waits for each client's name instead of assuming a notification was handled initialized is a notification the server handles after its 202; on a loaded machine the list was read first. Co-Authored-By: Claude Sonnet 5.5 --- crates/ledger-cli/tests/book_open_close.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/ledger-cli/tests/book_open_close.rs b/crates/ledger-cli/tests/book_open_close.rs index 9886f10d..d0189af3 100644 --- a/crates/ledger-cli/tests/book_open_close.rs +++ b/crates/ledger-cli/tests/book_open_close.rs @@ -206,6 +206,16 @@ fn the_sessions_request_names_each_connection_and_never_its_token() { Response::Sessions(all) => all, other => panic!("{other:?}"), }; + // `initialized` is a notification, handled after its 202: each client's + // name is known once the server has (waited for, not guessed). + wait_for("both clients are known", Duration::from_secs(60), || { + sessions(&home) + .iter() + .find(|b| b.book == A) + .is_some_and(|a| { + a.sessions.len() == 2 && a.sessions.iter().all(|s| s.client_name.is_some()) + }) + }); let all = sessions(&home); let text = serde_json::to_string(&all).unwrap(); for token in [&one, &two] {