chore: clean up dead code, fix broken test

- Remove unused methods: append_response_text, clear_response,
  has_pending_function_calls, take_function_calls
- Add #[allow(dead_code)] for intentionally kept future-use methods
  and response modification helpers
- Remove unused now_unix import from gemini.rs
- Fix test_modify_strips_all_tools: tools key is removed entirely
  when no custom tools provided, not left as empty array
- Zero warnings, 32 tests passing
This commit is contained in:
Nikketryhard
2026-02-15 01:14:51 -06:00
parent 981fb3b18d
commit 735c3e357d
4 changed files with 13 additions and 41 deletions

View File

@@ -281,26 +281,6 @@ impl MitmStore {
self.has_active_function_call.store(false, Ordering::SeqCst);
}
/// Check if there are pending function calls for a cascade.
pub async fn has_pending_function_calls(&self, cascade_id: &str) -> bool {
let pending = self.pending_function_calls.read().await;
pending.get(cascade_id).map_or(false, |v| !v.is_empty())
}
/// Take (consume) pending function calls.
pub async fn take_function_calls(&self, cascade_id: &str) -> Option<Vec<CapturedFunctionCall>> {
let mut pending = self.pending_function_calls.write().await;
let calls = pending.remove(cascade_id);
let result = if calls.is_none() {
pending.remove("_latest")
} else {
calls
};
if result.is_some() {
self.has_active_function_call.store(false, Ordering::SeqCst);
}
result
}
/// Take any pending function calls (ignoring cascade ID).
pub async fn take_any_function_calls(&self) -> Option<Vec<CapturedFunctionCall>> {
@@ -381,15 +361,7 @@ impl MitmStore {
// ── Direct response capture (bypass LS) ──────────────────────────────
/// Append text to the captured response.
pub async fn append_response_text(&self, text: &str) {
let mut resp = self.captured_response_text.write().await;
if let Some(ref mut existing) = *resp {
existing.push_str(text);
} else {
*resp = Some(text.to_string());
}
}
/// Set (replace) the captured response text.
pub async fn set_response_text(&self, text: &str) {
@@ -416,14 +388,7 @@ impl MitmStore {
self.response_complete.load(Ordering::SeqCst)
}
/// Clear captured response state (call at start of new request).
pub fn clear_response(&self) {
self.response_complete.store(false, Ordering::SeqCst);
// Can't use async in sync fn, so we spawn a task... or just use try_write
if let Ok(mut resp) = self.captured_response_text.try_write() {
*resp = None;
}
}
/// Async version of clear_response.
pub async fn clear_response_async(&self) {
@@ -458,11 +423,13 @@ impl MitmStore {
}
/// Get the active cascade ID.
#[allow(dead_code)]
pub async fn get_active_cascade(&self) -> Option<String> {
self.active_cascade_id.read().await.clone()
}
/// Clear the active cascade ID (called after response is complete).
#[allow(dead_code)]
pub async fn clear_active_cascade(&self) {
*self.active_cascade_id.write().await = None;
}