From 2d68b880c29095956ecdc57362c52e3e2ece6e16 Mon Sep 17 00:00:00 2001 From: Alix-007 <267018309+Alix-007@users.noreply.github.com> Date: Thu, 19 Mar 2026 12:19:31 +0800 Subject: [PATCH] Fix /new regression test lint scope --- src/channels/mod.rs | 78 ++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/src/channels/mod.rs b/src/channels/mod.rs index 768205ff9..719bc65b1 100644 --- a/src/channels/mod.rs +++ b/src/channels/mod.rs @@ -7637,25 +7637,27 @@ BTC is currently around $65,000 based on latest tool output."# ) .await; - let histories = runtime_ctx - .conversation_histories - .lock() - .unwrap_or_else(|e| e.into_inner()); - assert!( - !histories.contains_key("telegram_alice"), - "/new should clear the cached sender history before the next message" - ); - drop(histories); + { + let histories = runtime_ctx + .conversation_histories + .lock() + .unwrap_or_else(|e| e.into_inner()); + assert!( + !histories.contains_key("telegram_alice"), + "/new should clear the cached sender history before the next message" + ); + } - let pending_new_sessions = runtime_ctx - .pending_new_sessions - .lock() - .unwrap_or_else(|e| e.into_inner()); - assert!( - pending_new_sessions.contains("telegram_alice"), - "/new should mark the sender for a fresh next-message prompt rebuild" - ); - drop(pending_new_sessions); + { + let pending_new_sessions = runtime_ctx + .pending_new_sessions + .lock() + .unwrap_or_else(|e| e.into_inner()); + assert!( + pending_new_sessions.contains("telegram_alice"), + "/new should mark the sender for a fresh next-message prompt rebuild" + ); + } process_channel_message( runtime_ctx, @@ -7672,25 +7674,27 @@ BTC is currently around $65,000 based on latest tool output."# ) .await; - let calls = provider_impl - .calls - .lock() - .unwrap_or_else(|e| e.into_inner()); - assert_eq!(calls.len(), 2); - assert_eq!(calls[0][0].0, "system"); - assert_eq!(calls[1][0].0, "system"); - assert!( - !calls[0][0].1.contains("refresh-test"), - "pre-/new prompt should not advertise a skill that did not exist yet" - ); - assert!( - calls[1][0].1.contains(""), - "post-/new prompt should contain the refreshed skills block" - ); - assert!( - calls[1][0].1.contains("refresh-test"), - "post-/new prompt should include skills discovered after the reset" - ); + { + let calls = provider_impl + .calls + .lock() + .unwrap_or_else(|e| e.into_inner()); + assert_eq!(calls.len(), 2); + assert_eq!(calls[0][0].0, "system"); + assert_eq!(calls[1][0].0, "system"); + assert!( + !calls[0][0].1.contains("refresh-test"), + "pre-/new prompt should not advertise a skill that did not exist yet" + ); + assert!( + calls[1][0].1.contains(""), + "post-/new prompt should contain the refreshed skills block" + ); + assert!( + calls[1][0].1.contains("refresh-test"), + "post-/new prompt should include skills discovered after the reset" + ); + } let sent_messages = channel_impl.sent_messages.lock().await; assert!(sent_messages