From fafb76063dc50e0bc850a895741537b0b82f204f Mon Sep 17 00:00:00 2001 From: Hunter Bown Date: Sat, 25 Apr 2026 13:21:16 -0500 Subject: [PATCH] ci: fix unused import + cargo fmt drift from #27 The #27 per-mode context budget commit (1be18e69) replaced calls to compaction_threshold_for_model with compaction_threshold_for_model_and_effort but left the old name in the import list, which fails under -Dwarnings on Build, Test, and the npm wrapper smoke job. Also re-runs cargo fmt over the four files the lint job flagged. --- crates/tui/src/core/engine.rs | 4 ++-- crates/tui/src/models.rs | 3 ++- crates/tui/src/tui/app.rs | 8 +++----- crates/tui/src/tui/ui/tests.rs | 5 ++++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/crates/tui/src/core/engine.rs b/crates/tui/src/core/engine.rs index 77746337..513da80c 100644 --- a/crates/tui/src/core/engine.rs +++ b/crates/tui/src/core/engine.rs @@ -2895,8 +2895,8 @@ impl Engine { // assistant message in the conversation history. Saving a // placeholder here keeps the on-disk session structurally // correct so subsequent requests won't 400. - let needs_thinking_block = !tool_uses.is_empty() - || tool_parser::has_tool_call_markers(¤t_text_raw); + let needs_thinking_block = + !tool_uses.is_empty() || tool_parser::has_tool_call_markers(¤t_text_raw); let thinking_to_persist = if !current_thinking.is_empty() { Some(current_thinking.clone()) } else if needs_thinking_block { diff --git a/crates/tui/src/models.rs b/crates/tui/src/models.rs index df096e0f..67a85f75 100644 --- a/crates/tui/src/models.rs +++ b/crates/tui/src/models.rs @@ -297,7 +297,8 @@ pub fn compaction_threshold_for_model_and_effort( reasoning_effort: Option<&str>, ) -> usize { let lower = model.to_lowercase(); - if !lower.contains("deepseek") || !(lower.contains("v4") || is_current_deepseek_v4_alias(&lower)) + if !lower.contains("deepseek") + || !(lower.contains("v4") || is_current_deepseek_v4_alias(&lower)) { return compaction_threshold_for_model(model); } diff --git a/crates/tui/src/tui/app.rs b/crates/tui/src/tui/app.rs index c8a0b38d..98d871da 100644 --- a/crates/tui/src/tui/app.rs +++ b/crates/tui/src/tui/app.rs @@ -13,7 +13,7 @@ use crate::config::{ApiProvider, Config, has_api_key, save_api_key}; use crate::core::coherence::CoherenceState; use crate::hooks::{HookContext, HookEvent, HookExecutor, HookResult}; use crate::models::{ - Message, SystemPrompt, compaction_message_threshold_for_model, compaction_threshold_for_model, + Message, SystemPrompt, compaction_message_threshold_for_model, compaction_threshold_for_model_and_effort, }; use crate::palette::{self, UiTheme}; @@ -623,10 +623,8 @@ impl App { let max_input_history = settings.max_input_history; let ui_theme = palette::ui_theme(&settings.theme); let model = settings.default_model.clone().unwrap_or(model); - let compact_threshold = compaction_threshold_for_model_and_effort( - &model, - config.reasoning_effort(), - ); + let compact_threshold = + compaction_threshold_for_model_and_effort(&model, config.reasoning_effort()); // Start in YOLO mode if --yolo flag was passed let preferred_mode = AppMode::from_setting(&settings.default_mode); diff --git a/crates/tui/src/tui/ui/tests.rs b/crates/tui/src/tui/ui/tests.rs index fa294e7e..0b0468b8 100644 --- a/crates/tui/src/tui/ui/tests.rs +++ b/crates/tui/src/tui/ui/tests.rs @@ -445,7 +445,10 @@ fn footer_auxiliary_spans_show_cache_and_cost_when_roomy() { let roomy = spans_text(&footer_auxiliary_spans(&app, 32)); assert!(roomy.contains("cache 75%")); assert!(roomy.contains("$12.34")); - assert!(!roomy.contains("ctx"), "context % removed from footer — shown in header only"); + assert!( + !roomy.contains("ctx"), + "context % removed from footer — shown in header only" + ); } #[test]