chore(tui): one definition per constant; drop a dead fleet settings entry (#5808)

* chore(tui): one definition per constant; drop a dead fleet settings entry

- underwater.rs reuses ocean's pub COMPLETION_BREATH_MS (was a second
  800ms copy).
- DRAFT_TIMEOUT and PREVIEW_LIMIT hoisted to one module const each.
- CREATE_NO_WINDOW defined once in a cfg(windows) win32 module for both
  Command types.
- The 'fleet.exec.max_spawn_depth' row in the settings integer table was
  unreachable (its row is editable:false and meta() returns ReadOnly
  before table lookups run) — dropped.

cargo test -p codewhale-tui --lib -- preview underwater ocean draft:
343 passed; 0 failed.

Signed-off-by: CodeWhale Bot <[email protected]>

* chore(tui): one cfg(windows) on the win32 module

Codewhale review + Copilot on #5808: the module carried the attribute
twice (once above the doc comment, once below). Attribute-only change.

Signed-off-by: CodeWhale Bot <[email protected]>

---------

Signed-off-by: CodeWhale Bot <[email protected]>
Co-authored-by: CodeWhale Bot <[email protected]>
This commit is contained in:
Hunter BownandCodeWhale Bot authored and GitHub committed 2026-09-01 17:59:58 -07:00
1 parent 88ba3cd27f
commit 2be2cb4560
5 files changed
+17 -12

No files matched your search

+3 -4
View File
@@ -6,6 +6,9 @@
use std::borrow::Cow;
/// Cap on rows previewed per approval card.
const PREVIEW_LIMIT: usize = 7;
use serde_json::Value;
use crate::localization::{Locale, MessageId, tr};
@@ -176,8 +179,6 @@ fn append_preview_truncation(lines: &mut Vec<String>, line: String, limit: usize
}
pub(super) fn apply_patch_preview_lines(patch: &str) -> Option<Vec<String>> {
const PREVIEW_LIMIT: usize = 7;
let mut lines = Vec::new();
let mut omitted = 0usize;
for line in patch.lines().filter(|line| !line.trim().is_empty()) {
@@ -219,8 +220,6 @@ pub(super) fn apply_patch_preview_lines(patch: &str) -> Option<Vec<String>> {
}
fn changes_preview_lines(changes: &[Value]) -> Option<Vec<String>> {
const PREVIEW_LIMIT: usize = 7;
let mut lines = Vec::new();
let mut rendered_changes = 0usize;
for (idx, change) in changes.iter().enumerate() {
+4 -2
View File
@@ -5,6 +5,10 @@
use super::*;
/// How long a spawned constitution draft may run before the loop gives up
/// (#3757 review: never await it inline on the event loop).
const DRAFT_TIMEOUT: Duration = Duration::from_secs(20);
/// Persist a `# foo` quick-add through the native memory store and surface
/// a status note to the user. Errors land in the same status channel so a
/// missing memory directory becomes visible without crashing the composer.
@@ -225,7 +229,6 @@ pub(crate) async fn handle_setup_constitution_model_draft(
// Spawn the draft off the event loop (same pattern as the fleet drafter,
// #3757 review): awaiting it inline parked the whole TUI for up to the
// timeout. The loop polls constitution_draft_cell and delivers the result.
const DRAFT_TIMEOUT: Duration = Duration::from_secs(20);
let model_label = app.model_display_label();
let client = match DeepSeekClient::new(config) {
Ok(client) => client,
@@ -301,7 +304,6 @@ pub(crate) async fn handle_fleet_profile_model_draft(
// TUI for up to the timeout (#3757 review). Spawn it into the shared
// fleet_draft_cell and let the loop poll + deliver the result, keeping
// the wizard interactive with a drafting status.
const DRAFT_TIMEOUT: Duration = Duration::from_secs(20);
let model_label = app.model_display_label();
let client = match DeepSeekClient::new(config) {
Ok(client) => client,
+1 -1
View File
@@ -486,7 +486,7 @@ impl RunningToolFacts {
}
const WORKING_BUBBLE_FRAMES: [&str; 8] = ["⠀", "⢀", "⣀", "⣄", "⣤", "⣦", "⣶", "⣿"];
const COMPLETION_BREATH_MS: u128 = 800;
use super::ocean::COMPLETION_BREATH_MS;
const COMPLETION_RELEASE_MS: u128 = 560;
// The idle whale portrait rows (IDLE_WHALE_ROWS / UWU_IDLE_WHALE_ROWS) and
// their caustic shimmer were deleted per the 2026-08-29 founder directive:
-1
View File
@@ -3560,7 +3560,6 @@ fn config_integer_key(key: &str) -> bool {
| "thinking_preview_lines"
| "auto_compact_threshold_percent"
| "max_history"
| "fleet.exec.max_spawn_depth"
)
}
+9 -4
View File
@@ -62,12 +62,18 @@ pub fn redacted_identifier_for_log(identifier: &str) -> String {
format!("<redacted:{hash:016x}>")
}
/// Win32 process-creation flag: detach the child from the console so helper
/// exes don't flash a terminal window. One definition for every Command type.
#[cfg(windows)]
mod win32 {
pub(crate) const CREATE_NO_WINDOW: u32 = 0x0800_0000;
}
#[cfg(windows)]
pub(crate) fn suppress_console_window(cmd: &mut Command) {
use std::os::windows::process::CommandExt;
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
cmd.creation_flags(CREATE_NO_WINDOW);
cmd.creation_flags(win32::CREATE_NO_WINDOW);
}
#[cfg(not(windows))]
@@ -75,8 +81,7 @@ pub(crate) fn suppress_console_window(_cmd: &mut Command) {}
#[cfg(windows)]
pub(crate) fn suppress_tokio_console_window(cmd: &mut tokio::process::Command) {
const CREATE_NO_WINDOW: u32 = 0x0800_0000;
cmd.creation_flags(CREATE_NO_WINDOW);
cmd.creation_flags(win32::CREATE_NO_WINDOW);
}
#[cfg(not(windows))]