Dead-code sweep phases 2-4: 75 test-only markers, ~242 stale allows, blanket-allow conversions
- Dominant language
- Rust
- Stars
- 41k
- Forks
- 3.6k
- Avg merge
- 13h 59m
- Merged PRs (30d)
- 299
Description
Continuation of the audited sweep (phase 1 landed in e5ca0aa86: eight verified-dead items removed, facts-drift contract documented). Full audit of all 379 `allow(dead_code)` sites in crates/tui/src, classified with whole-workspace reference indexes:
- **TRULY DEAD, Tier B/C (18 remaining)**: paste_burst on_plain_char_no_hold / try_append_char_if_active, active_cell forget_tool, world_state render_incremental_text / is_noop / render_world_diff (whole WorldStateDiff surface is unwired), cost_status with_identity, tools/spec with_sandbox_policy, llm_client RetryConfig with_request_timeout / with_total_timeout, TranslationStatus enum, mcp disconnect_all, registry execute_full_with_context, runtime_threads resume_thread_with_agent_rebind (+ its only-caller helper collect_agent_rebind_hints), settings persist_provider_model_selection_as_default, provider_lake all_catalog_providers, ReasoningEffort cycle_next_for_provider, skills/audit AUDIT_MAX_PACKAGE_BYTES / AUDIT_MAX_FILES. Tier C items (mcp/registry/runtime_threads/settings) deserve an intent check before deletion.
- **Dead under blanket allows**: features.rs enabled_features / feature_spec_by_key; sandbox/policy.rs trait SandboxExecutor; fleet/profile.rs load_personal_agent_profiles_tolerant; tui/git_status.rs list_worktrees.
- **TEST-ONLY (75 markers)**: convert to #[cfg(test)] (largest honest win; full list in the audit). llm_client/mock.rs is a whole-module cfg(test) candidate.
- **STALE ALLOWS (~242)**: attribute guards a prod-used item. Authoritative pass: `RUSTFLAGS="--force-warn dead_code" cargo check -p codewhale-tui --all-targets` (overrides #[allow]), then drop every attribute it does not flag. tools/handle.rs both impl-level allows and settings.rs TuiPrefs impl are fully stale.
- **LEAVE ALONE (19)**: cfg_attr-gated platform items; PUBLIC_SANDBOX_BACKENDS (external facts-drift contract, now labeled); OpenRouter wire-capture fields; ToolExecGuard RAII variants; rlm.rs type-shape assertion.
- AGENTS.md caution-list files (context_budget, model_registry, prompt_zones, tools/remember, native_memory): confirmed to carry no removable allow(dead_code) at all — nothing in this sweep touches them.
Tracker: #5573. Related: #5582 (mega files).
Contributor guide
Research direction
Start with the audited sites under crates/tui/src and read Tracker #5573 plus the related issues for scope. Run `RUSTFLAGS="--force-warn dead_code" cargo check -p codewhale-tui --all-targets` to identify stale allows, then review the listed dead, test-only, and blanket-allowed items, checking Tier C intent before removal. Done means the verified dead code is removed, test-only markers are cfg(test), stale allows are dropped, and the leave-alone items remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100