Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/palette/src/adapt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,6 @@ impl ColorDepth {
/// palette; ANSI-16 uses a generic nearest named color. Rendered semantic
/// foregrounds must go through [`adapt_fg_for_depth`] so role identity is not
/// inferred from RGB proximity.
#[allow(dead_code)]
#[must_use]
pub fn adapt_color(color: Color, depth: ColorDepth) -> Color {
match (color, depth) {
Expand All @@ -708,7 +707,6 @@ pub fn adapt_color(color: Color, depth: ColorDepth) -> Color {
/// Adapt a background color. On Ansi16 terminals background tints are noisy,
/// so we drop them to `Color::Reset` rather than attempt a coarse named-color
/// match — a quiet background reads cleaner than a wrong one.
#[allow(dead_code)]
#[must_use]
pub fn adapt_bg(color: Color, depth: ColorDepth) -> Color {
match (color, depth) {
Expand All @@ -722,7 +720,6 @@ pub fn adapt_bg(color: Color, depth: ColorDepth) -> Color {
/// Mix two RGB colors at `alpha` (0.0 = `bg`, 1.0 = `fg`). Anything that's not
/// RGB falls back to `fg` — there's no meaningful alpha blend on a named
/// palette entry.
#[allow(dead_code)]
#[must_use]
pub fn blend(fg: Color, bg: Color, alpha: f32) -> Color {
let alpha = alpha.clamp(0.0, 1.0);
Expand Down Expand Up @@ -773,7 +770,6 @@ pub fn pulse_brightness(color: Color, now_ms: u64) -> Color {
/// `adapt_color` on Ansi16 terminals; we lean on hue dominance + lightness so
/// brand colors land on the obviously-related named entry (sky → cyan, blue →
/// blue, red → red, etc.) rather than dithering around grey.
#[allow(dead_code)]
pub(crate) fn nearest_ansi16(r: u8, g: u8, b: u8) -> Color {
let lum = (u16::from(r) + u16::from(g) + u16::from(b)) / 3;
if lum < 24 {
Expand Down Expand Up @@ -840,7 +836,6 @@ pub(crate) fn nearest_ansi16(r: u8, g: u8, b: u8) -> Color {
/// Map an RGB color to the nearest xterm 256-color palette index. We use only
/// the stable 6x6x6 cube and grayscale ramp (16..255), not the terminal's
/// user-configurable 0..15 colors.
#[allow(dead_code)]
pub(crate) fn rgb_to_ansi256(r: u8, g: u8, b: u8) -> u8 {
const CUBE_LEVELS: [u8; 6] = [0, 95, 135, 175, 215, 255];

Expand Down
7 changes: 0 additions & 7 deletions crates/palette/src/contrast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ pub const AA_BODY_CONTRAST: f32 = 4.5;
/// Matches the WCAG 2.x AA threshold for large text and UI components (3:1).
/// Status roles qualify because they are redundant by design — every status
/// also carries a glyph and a word label, so color is never the only channel.
///
/// Consumed by the theme audit below, which runs as a test gate rather than
/// at runtime — hence the `dead_code` allowance on this audit surface.
#[allow(dead_code)]
pub const SECONDARY_CHROME_CONTRAST: f32 = 3.0;

/// Relative luminance per WCAG 2.x, in `0.0..=1.0`.
Expand Down Expand Up @@ -217,7 +213,6 @@ fn indexed_rgb(index: u8) -> (u8, u8, u8) {

/// A single theme color pair that fails its contrast floor. See
/// [`theme_contrast_violations`].
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ThemeContrastViolation {
/// Static name of the failing pair, e.g. `"text_muted on panel_bg"`.
Expand All @@ -240,7 +235,6 @@ pub struct ThemeContrastViolation {
/// so the audit neither passes nor fails them — it stands down. Deepsea paints
/// its authored RGB column later. This function is how callers tell the Flat
/// exemption apart from a clean bill of health.
#[allow(dead_code)]
#[must_use]
pub fn theme_uses_terminal_owned_surfaces(theme: &UiTheme) -> bool {
theme.surface_bg == Color::Reset
Expand Down Expand Up @@ -270,7 +264,6 @@ pub fn theme_uses_terminal_owned_surfaces(theme: &UiTheme) -> bool {
/// terminal-native themes are therefore partly exempt by design — see
/// [`theme_uses_terminal_owned_surfaces`], which makes that exemption explicit
/// rather than silent.
#[allow(dead_code)]
#[must_use]
pub fn theme_contrast_violations(theme: &UiTheme) -> Vec<ThemeContrastViolation> {
let mut violations = Vec::new();
Expand Down
2 changes: 0 additions & 2 deletions crates/palette/src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use ratatui::style::{Color, Style};
use super::themes::UiTheme;

/// The five visual families. Surface is the canvas, not a foreground ink.
#[cfg_attr(not(test), allow(dead_code))]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SemanticFamily {
Surface,
Expand Down Expand Up @@ -79,7 +78,6 @@ impl ChromeInk {
];

#[must_use]
#[cfg_attr(not(test), allow(dead_code))]
pub const fn family(self) -> SemanticFamily {
match self {
Self::Outcome | Self::Active => SemanticFamily::Live,
Expand Down
5 changes: 0 additions & 5 deletions crates/runtime/src/model_context/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub enum FragmentId {

impl FragmentId {
#[must_use]
#[allow(dead_code)] // public identity API for WorldState host adapters (TUI-DOG-011)
pub fn as_str(self) -> &'static str {
match self {
Self::Workspace => "workspace",
Expand Down Expand Up @@ -61,7 +60,6 @@ impl FragmentId {
}

#[must_use]
#[allow(dead_code)] // public identity API for WorldState host adapters (TUI-DOG-011)
pub fn role(self) -> FragmentRole {
match self {
Self::Workspace => FragmentRole::Workspace,
Expand All @@ -76,7 +74,6 @@ impl FragmentId {
}

#[must_use]
#[allow(dead_code)] // ordered enumeration for host rebuilds / inspectors (TUI-DOG-011)
pub fn all() -> &'static [FragmentId] {
&[
Self::Workspace,
Expand Down Expand Up @@ -114,7 +111,6 @@ pub enum FragmentRole {

impl FragmentRole {
#[must_use]
#[allow(dead_code)] // public role labels for inspectors / diffs (TUI-DOG-011)
pub fn as_str(self) -> &'static str {
match self {
Self::Workspace => "workspace",
Expand All @@ -137,7 +133,6 @@ pub enum FragmentRender {
/// New or changed content — inject the capped body.
Updated { fragment: ModelContextFragment },
/// Fragment was present before and is now absent.
#[allow(dead_code)] // produced by WorldState::clear; hosts wire clear next (TUI-DOG-011)
Cleared { marker: String },
}

Expand Down
3 changes: 1 addition & 2 deletions crates/runtime/src/retry_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type RateLimitPauses = HashMap<String, Instant>;
/// next request will fire — the UI subtracts `Instant::now()` from it
/// to render a live countdown.
#[derive(Debug, Clone)]
#[cfg_attr(not(test), allow(dead_code))]
pub struct RetryBanner {
/// 1-indexed retry attempt number (the first retry is attempt 1).
pub attempt: u32,
Expand All @@ -58,7 +57,7 @@ pub enum RetryState {
#[default]
Idle,
/// A request is sleeping before retrying. Show countdown banner.
Active(#[cfg_attr(not(test), allow(dead_code))] RetryBanner),
Active(RetryBanner),
/// All retries exhausted; show failure row until the next turn
/// starts. `since` records when the row was set so a future polish
/// pass can age it out automatically; today the engine clears it on
Expand Down
1 change: 0 additions & 1 deletion crates/tui/src/approval_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ impl ApprovalReceiptStore {
Self { sessions_dir }
}

#[cfg_attr(test, allow(dead_code))]
pub(crate) fn default_location() -> io::Result<Self> {
crate::session_manager::default_sessions_dir().map(Self::new)
}
Expand Down
1 change: 0 additions & 1 deletion crates/tui/src/core/engine/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const MAX_SCHEMA_CONTAINER_REPAIR_BYTES: usize = 64 * 1024;

// === Types ============================================================

#[allow(dead_code)] // `index` mirrors batch order for diagnostic ergonomics.
pub(super) struct ToolExecOutcome {
pub(super) index: usize,
pub(super) id: String,
Expand Down
3 changes: 0 additions & 3 deletions crates/tui/src/llm_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1077,11 +1077,9 @@ pub struct RetryConfig {
pub respect_retry_after: bool,

/// HTTP status codes that should trigger a retry
#[allow(dead_code)] // Used in tests via is_retryable_status()
pub retryable_status_codes: Vec<u16>,

/// Timeout for individual requests (seconds, 0 = no timeout)
#[allow(dead_code)] // Configuration field for retry consumers
pub request_timeout: f64,

/// Total timeout for all retry attempts (seconds, 0 = no total timeout)
Expand All @@ -1106,7 +1104,6 @@ impl Default for RetryConfig {
}
}

#[allow(dead_code)] // Public builder API, used in tests
impl RetryConfig {
/// Creates a new `RetryConfig` with default values
pub fn new() -> Self {
Expand Down
2 changes: 0 additions & 2 deletions crates/tui/src/route_billing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ impl BillingPresentation {
}

#[must_use]
#[allow(dead_code)] // label helpers for non-metered chip copy (TUI-DOG-010)
pub const fn label(self) -> Option<&'static str> {
match self {
Self::Metered => None,
Expand Down Expand Up @@ -919,7 +918,6 @@ pub fn usage_chip(

/// Compact footer/header chip text. `None` means omit the chip.
#[must_use]
#[allow(dead_code)] // shared chip formatter for footer/sidebar siblings (TUI-DOG-010)
pub fn format_usage_chip(chip: &UsageChip, locale: Locale) -> Option<String> {
match chip {
UsageChip::Money(amount) => Some(amount.clone()),
Expand Down
1 change: 0 additions & 1 deletion crates/tui/src/skills/mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ pub struct SkillMutationReceipt {
#[allow(dead_code)] // surfaced by manager detail / future receipt toast
pub action: SkillActionKind,
pub name: String,
#[allow(dead_code)] // surfaced by manager detail / future receipt toast
pub scope: SkillScope,
pub safe_target_path: String,
#[allow(dead_code)] // reserved for digest-diff UI
Expand Down
2 changes: 1 addition & 1 deletion crates/tui/src/tui/hotbar/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use codewhale_localization::{Locale, MessageId, tr};
pub const HOTBAR_COMPACT_LABEL_MAX_WIDTH: usize = 7;

/// Result of firing a hotbar action.
#[allow(dead_code, clippy::large_enum_variant)] // AppAction is intentionally large; boxing would force clone churn on the hot path
#[allow(clippy::large_enum_variant)] // AppAction is intentionally large; boxing would force clone churn on the hot path
#[derive(Debug, Clone, PartialEq)]
pub enum HotbarDispatch {
/// The action was fully handled by mutating [`App`].
Expand Down
1 change: 0 additions & 1 deletion crates/tui/src/tui/transcript_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ impl TranscriptCache {

/// Drop every cached entry. Used when the underlying transcript shape
/// changes drastically (e.g. session reset).
#[allow(dead_code)] // Reserved for /clear and session-reset call sites.
pub fn clear(&mut self) {
self.entries.clear();
self.insertion_order.clear();
Expand Down
2 changes: 0 additions & 2 deletions crates/tui/src/tui/widgets/tool_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ pub fn family_label(family: ToolFamily) -> &'static str {
/// Position of a line within a multi-line card — drives the left-rail
/// glyph so the box reads as a contiguous group from top to bottom.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[allow(dead_code)] // wired by future card-refactor follow-ups
pub enum CardRail {
/// First line of the card — the header. `╭`.
Top,
Expand All @@ -330,7 +329,6 @@ pub enum CardRail {
/// Map a [`CardRail`] position to its rail glyph. Returned as a `&str`
/// because callers paste it into a span.
#[must_use]
#[allow(dead_code)] // wired by future card-refactor follow-ups
pub fn rail_glyph(rail: CardRail) -> &'static str {
match rail {
CardRail::Top => "\u{256D}", // ╭
Expand Down
20 changes: 8 additions & 12 deletions scripts/dead-code-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
"_comment": "Ceiling for dead-code suppressions across crates/, counting both `#[allow(dead_code)]` and `#[expect(dead_code)]`. `total` is the sum and is the ratcheted figure. It may go down freely; raising it needs a reviewer to say why in the PR. Regenerate with: python3 scripts/check-dead-code-budget.py --update",
"_issue": "https://github.com/codewhale-hq/CodeWhale/issues/4785",
"_expect_blind_spot": "Until #6241 this gate counted only the `allow` spelling, so rewriting an allow as an expect lowered the number without removing any dead code. The ceiling was re-based to the true combined count when that was fixed; it is not a regression.",
"total": 258,
"allow_total": 175,
"expect_total": 83,
"total": 222,
"allow_total": 141,
"expect_total": 81,
"per_crate": {
"app-server": {
"allow": 1,
"expect": 0
},
"cli": {
"allow": 0,
"expect": 1
Expand All @@ -23,24 +19,24 @@
"expect": 0
},
"models": {
"allow": 5,
"allow": 3,
"expect": 0
},
"palette": {
"allow": 20,
"allow": 9,
"expect": 0
},
"runtime": {
"allow": 9,
"allow": 2,
"expect": 2
},
"tools": {
"allow": 2,
"expect": 0
},
"tui": {
"allow": 131,
"expect": 80
"allow": 118,
"expect": 78
}
}
}
Loading