Files
DeepSeek-TUI/scripts/dead-code-budget.json
Hmbown f471f555d2 chore(tui): sweep verified-dead ToolRegistry API surface (#4785)
First dead-code sweep slice for #4785. All in
crates/tui/src/tools/registry.rs; 181 net production lines removed
(264 incl. orphaned inline tests), 16 #[allow(dead_code)] attributes
gone (482 -> 466, budget locked in via --update).

Deleted items (zero production callers; verified with rg across
crates/** and confirmed by warning-free cargo check/clippy in this
binary crate, where rustc flags unreachable pub items):

- ToolRegistry::len / is_empty        (test-only callers, in-file)
- ToolRegistry::execute               (test-only; live path is
                                       execute_full{,_with_context})
- ToolRegistry::filter_by_capability  (only caller: its own test)
- ToolRegistry::read_only_tools       (only caller: its own test)
- ToolRegistry::approval_required_tools   (no callers anywhere)
- ToolRegistry::approval_suggested_tools  (no callers anywhere)
- ToolRegistry::set_context / context_mut (no callers anywhere)
- ToolRegistry::remove                (test-only; live remove_tool
                                       also invalidates api_cache)
- ToolRegistry::clear                 (test-only)
- ToolRegistryBuilder::with_agent_tools
    (legacy allow_shell wrapper; comment admitted test-only)
- ToolRegistryBuilder::with_full_agent_surface{,_policy}
    (legacy wrappers; only caller was each other)

Attribute-only removals (items have live production callers):
- ToolRegistry::names      (engine.rs configure_plugin_tools x2)
- struct McpToolAdapter    (built by with_mcp_tools; all fields read)

Orphaned test code deleted: test_registry_remove, test_registry_clear,
test_registry_execute, test_registry_execute_unknown_tool,
test_filter_by_capability, test_read_only_tools. Tests re-pointed at
live APIs instead of deleted shims: remove_tool_invalidates_api_tools_cache
(remove_tool), legacy_file_aliases_replay_through_canonical_dispatch
(execute_full), three with_agent_tools_* tests rewritten against
with_agent_tools_policy(ShellPolicy::None/Full).

Gates (isolated CODEWHALE_HOME, CARGO_TARGET_DIR=.../v093-deadcode-sweep-a):
- cargo fmt --all -- --check                          PASS
- cargo test -p codewhale-tui --bin codewhale-tui --locked tools::registry
  36 passed, 0 failed
- ... tools::      1391 passed, 0 failed
- ... core::engine  435 passed, 0 failed (one flaky first-run failure,
  passed twice on rerun)
- cargo clippy -p codewhale-tui --all-features --locked -- -D warnings
  (+ brief's allow list)                                 PASS
- python3 scripts/check-dead-code-budget.py            PASS (466 at budget)
- python3 scripts/check-source-structure-budget.py     PASS
  (645410 <= 645603; was 645674, i.e. the +71 overage is offset)
2026-07-30 22:50:20 -07:00

11 lines
369 B
JSON

{
"_comment": "Ceiling for `#[allow(dead_code)]` across crates/. This number 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/Hmbown/CodeWhale/issues/4785",
"total": 466,
"per_crate": {
"config": 2,
"tools": 2,
"tui": 462
}
}