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 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 11:29:13 -07:00
1 parent 26b42c6d01
commit 1332c2a576
1 file changed
+10
@@ -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] {