Dead-code candidates that need a maintainer decision
Refs #4785
A dead-code sweep found these items. Each one is either never produced or only reached from tests. They were not removed because each looks like the start of a feature, and someone needs to decide whether to finish it or delete it. Every claim below was checked with grep -rn across crates/ on current main.
1. SidebarRowAction::PrefillCommand is never created (crates/tui/src/tui/app.rs:1289)
- What happens: the variant is matched in
mouse_ui.rs:898andmouse_ui.rs:1643. The only constructor (mouse_ui.rs:1650) re-wraps a value that is already aPrefillCommand. No sidebar row ever starts out as one, so the destructive-command "prefill, then press Enter" path cannot be reached. The allow comment cites TUI-DOG-008, but that ID is about working/phase chrome (docs/MOTION_CONTRACT.md:25), not this path. - Expected: either a destructive sidebar row produces
PrefillCommand, or the variant and its two match arms are removed.
2. FleetListOutcome::OpenDetail / FleetListOutcome::None are never created (crates/tui/src/tui/views/fleet_list.rs:46-55)
- What happens:
select_highlightedandconfirm_deleteonly returnFleetListOutcome::Done.outcome_to_action(line 602) mapsOpenDetailtoViewEvent::FleetListOpenDetailRequested, andui/handlers.rs:2582handles that event by openingFleetDetailView. That whole chain cannot run. The allow says it is "reserved for the qualified-name flow". - Expected: wire the qualified-name flow so selecting a fleet can open its detail view, or remove
OpenDetail,None,ViewEvent::FleetListOpenDetailRequestedand its handler.
3. RunReceipt / VerificationReceipt / VerificationOutcome are only used by tests (crates/engine/src/core/runtime_contract/termination.rs:111-165)
- What happens: no non-test code outside
termination.rsnames these types.RunReceipt::validateandRunReceipt::pass_at_onerun only in that file's tests. The removed module allow said that "stream JSON is the first consumer", but no stream JSON code builds aRunReceipt. - Expected: emit a run receipt from the stream-JSON / exec surface, or delete the types and their tests.
4. SkillMutationReceipt.before_digest / after_digest are written but never read (crates/skills/src/mutation.rs:113-116)
- What happens: every mutation path fills both fields (mutation.rs:615-994), and a TUI test builds them as
None(tui/src/commands/contract.rs:7038). No code reads either field. The allow says "reserved for digest-diff UI".actionon the same struct has a similar "future receipt toast" allow. - Expected: show the digest diff in the skills manager / receipt toast, or stop computing and storing the digests.
5. Fleet ledger/scheduler/executor functions only reached from tests (crates/engine/src/fleet/)
ledger.rs:1770 FleetLedger::claim_next: only callers are tests (ledger.rs:3306, 3401)ledger.rs:1533 FleetLedger::record_alert: only caller is a test (ledger.rs:4453)ledger.rs:788 FleetLedger::mark_task_terminal_status_if_unchanged: only caller is a test (ledger.rs:3707)scheduler.rs:107 FleetScheduler::cancel_run: only caller is a test (scheduler.rs:1048)executor.rs:1150 all_terminal: only callers are tests (executor.rs:2016, 2303)task_spec.rs:617 record_verification_receipt: only caller is a test (task_spec.rs:1393)roster.rs:729 shadowed_for: only caller is a test (fleet/tests/roster_shadow_and_trust.rs:38)
What happens: ledger.rs, scheduler.rs and executor.rs have #![allow(dead_code)] for the whole module. task_spec.rs and roster.rs items are pub. In both cases the compiler does not flag these functions. Production code claims tasks, cancels runs and records verification some other way, or does not do it yet.
Expected: for each function, either route the production path through it (for example operator cancel → cancel_run, alert delivery → record_alert), or move it under #[cfg(test)] / delete it. Then drop the module-level allows so new dead code shows up again.
Body:
What and why
This removes code that nothing calls and dead_code allows on items that are in use, which lowers the dead-code budget from 137 to 119.
- engine: drop the stale allows on
SubAgentManager.workspace,ProjectContext.project_root, the fourMcpConnection/McpPoolaccessors,UserInputProvenance, the fourTokenEstimateCachemethods, and the module allows intermination.rsandauto_review.rs - engine: remove unused
_assert_var_handle_shape,merge_contexts(and its test), and the privateFleetManager::record_task_timeout - engine: delete
trailing_start_marker_prefix_len; its caller now usestrailing_marker_prefix_len(.., &TOOL_CALL_START_MARKERS), which checks the same 30 markers in the same order - engine: the workflow tool reuses
cargo_failure_summary::truncate_charsinstead of keeping its own copy - tui: drop the stale allows on
App::cell_at_virtual_index,AppAction::LoadSessionandActiveCell::revision(all have live callers) - runtime: reduce
resource_telemetrytoestimate_output_tokens_from_text, its only outside use; removeSessionJournal::children_of - app-server: remove the unused
run_daemon_socket,run_stdioanddaemon_client::forward_stdio(all platform variants and the re-export) scripts/dead-code-budget.jsonregenerated
Items that need a decision instead of removal are listed in #ISSUE.
Related issue (optional)
Refs #4785 Refs #ISSUE
How I tested it
cargo check -p codewhale-engineandcargo check -p codewhale-engine --all-targets: no warningscargo clippy -p codewhale-runtime -p codewhale-app-server -p codewhale-engine -p codewhale-tui --all-targets --all-features --locked -- -D warnings: cleancargo test -p codewhale-runtime --lib -- resource_telemetry session_tree: 26 passedcargo test -p codewhale-app-server --lib -- daemon_socket daemon_client: 20 passedcargo test -p codewhale-engine --lib -- tool_call marker cargo_failure_summary tools::workflow project_context: 385 passed (withRUST_MIN_STACK=16777216)cargo fmt --all -- --check,python3 scripts/check-dead-code-budget.py: pass
Checklist
- [x] One focused change, started from current
main(no need to rebase whenmainmoves) - [x]
cargo fmt --allpasses, and tests cover new or changed behavior
Also test-only after the cleanup PR (pub, so the lint never fires): TokenEstimateCache::{bump_messages_revision, invalidate, stats, recent_audit} (crates/engine/src/core/engine/token_estimate_cache.rs) and the ProjectContext.project_root field, read only in project_context_cache.rs tests.
Thank you @luochen211 for separating these five design-sensitive candidates out of your dead-code sweep and for landing the unambiguous removals in 4d3bd65eee (#7272, dead-code budget 137 to 119); that is on main as 0.10.3 candidate work, not yet in a published release.
Each of the five items (SidebarRowAction::PrefillCommand, FleetListOutcome::OpenDetail, RunReceipt / VerificationReceipt, the before/after digests on SkillMutationReceipt, and the test-only fleet/ methods) is still present on current main and is a choice between finishing an unwired surface and deleting scaffolding. We are not making those calls during the 0.10.3 release freeze; they are not part of the 0.10.3 candidate. We will reply with a keep-or-remove decision per item after 0.10.3 is tagged.
Written by Claude Sonnet 5.5 for the Codewhale maintainers.
Thanks again @luochen211 for checking each of these five by hand and keeping them separate from the removals that landed in v0.10.3 (4d3bd65eee). 0.10.3 is tagged, so here is where they stand: all five are still on main, and we're taking them into 0.10.5, which is a release about removing unused paths. Our default for each is removal unless we wire it up in the same release. That covers the PrefillCommand variant, FleetListOutcome::OpenDetail/None with its event and handler, the test-only RunReceipt/VerificationReceipt, and the never-read digests on SkillMutationReceipt. If you'd like to take any of the removals as a PR, it would be very welcome. Tell us which ones and we'll make sure nobody duplicates them.
Written by Claude Fable 5.2 (AI), working with Hmbown.
Thanks @Hmbown. I took the four removals you listed in one PR: #7491.
Item 5 (the test-only fleet/ methods) is not in it.