Skip to content

chore: delete unreachable code behind the dead-code allowlist - #8900

Merged
oferchen merged 3 commits into
masterfrom
chore/dead-code-allowlist-resolve-2
Nov 28, 2026
Merged

oferchen merged 3 commits into
masterfrom
chore/dead-code-allowlist-resolve-2

Conversation

@oferchen

@oferchen oferchen commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

The dead-code allowlist (tools/ci/dead_code_allowlist.tsv) held 52 rows that all expire on 2026-12-10. On that date the census gate fails master. This PR clears 42 of the 52 rows. The other 10 stay, held for an owner decision.

  • Census fix (1 row). tools/ci/dead_code_census.py now follows use X as Y renames, so a reference to Y counts for X. Without this, is_enabled_by_env (core async_ssh_transport.rs), which is reached only as async_ssh_enabled, was reported dead. Its stale row is removed. The new test is in tools/tests/test_dead_code_census.py.
  • Deletions (41 rows). Each function had no production caller and no test reference. Each is deleted together with its row.

Rows deleted with their function

Crate Functions
apple-fs standard_id
batch read_all_delta_ops
core registered_waker_count
daemon run_stdio_session (whole sections/stdio_session.rs), all_sessions, update_bytes
engine reference_directory, drop_devices_enabled
fast_io cached_sort_by_cmp, unlinkat_at, buffer_slice, read_into, operator_link, process_files, with_thread_count
logging init_tracing_with_filter
matching set_role
protocol read_ndx_from_carry_async, flist_stats, xattr_cache_mut, is_io_error_end_marker
rsync_io take_stdin, take_stdout, into_sync_halves
signature strong_digest
transfer with_negotiated_algorithms, wire_bits, drain_new_redo_indices, match_uid, match_gid, set_deletion_filter_chain, exchange_compat_flags_direct, with_crtimes, with_flag_string, as_full_mut_slice
xtask print_summary, run_and_extract_messages, get_groups_for_scenario, get_messages_for_scenario, version_string, get_oc_rsync_binary

Two deletions were checked by hand because their comments described live paths:

  • run_stdio_session claimed to serve remote-shell daemon mode (main.c:1975-1979). The live path is daemon::run_daemon_stdio, called from crates/cli/src/frontend/server/daemon.rs. The deleted function was an unused duplicate.
  • into_sync_halves was the only constructor of rsync_io's SyncReader / SyncWriter. connect_and_exec does not use them: it builds its own ChannelReader / ChannelWriter in embedded/connect.rs.

Follow-on removals

Deleting into_sync_halves left SyncReader, SyncWriter and their BridgeSyncReader / BridgeSyncWriter re-exports with no production constructor. They are removed too, with:

  • their 10 unit tests;
  • the round_trip_via_channel_pump / round_trip_via_bridge helpers and the 5 wire_byte_parity_* tests, which compared the bridge against the removed pump.

SyncAsyncBridge, ChunkPool and drain_into stay, with their tests. connect.rs still uses ChunkPool and drain_into.

The sync_bridge.rs module docs no longer describe the removed halves. Two docs pointed at into_sync_halves and now point at connect.rs: docs/architecture/session-overview-ddp-async-iouring.md and docs/design/russh-async-native-path.md.

Imports left unused by the deletions are removed (transfer setup/compat.rs, xtask shared/util.rs).

Not covered: 10 rows held for the owner

Untouched, still expiring 2026-12-10:

  • fast_io iocp/rio.rs: as_rio_buf, as_rio_buf_with_len, rio_send, rio_recv, rio_create_request_queue, rio_notify
  • fast_io adaptive_dispatch.rs: pick
  • engine directory/planner.rs: plan_directory_entries_parallel
  • engine throughput governor: current_ceiling (rope.rs), into_parts_with_rope (work_queue.rs)

dead_code_census.py gate --today 2026-12-11 lists exactly these 10 as expired, and nothing else.

Verification

Branch head f2aa32c, on master df6f15f.

  • cargo fmt --all -- --check: clean
  • cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings: clean
  • the same clippy for x86_64-pc-windows-gnu: clean
  • cargo nextest run --all-features --lib for every touched crate (rsync_io, batch, signature, matching, logging, apple-fs, fast_io, protocol, transfer, core, daemon, engine): 20,215 run, 20,203 passed. After cargo build -p bin, batch passes 148/148; its 9 failures were the missing-binary panic at test-support/src/bin_path.rs:64. The other 3 failures are rsync_io ssh_config_differential cells. They compare oc's ssh_config parser against the host's ssh -G, which is OpenSSH 10.6p2 rather than the pinned 10.0p2 oracle. This change does not touch the parser. I did not rerun these 3 cells on master. After the rebase onto fix: walk a network receiver destination before mkdir #8899: fast_io + transfer --lib 4,121/4,121
  • python3 tools/ci/dead_code_census.py gate: OK (10 rows, all allowlisted and unexpired)
  • tools/ci/run_tools_tests.sh: 420 tests, OK (3 skipped, all pre-existing)
  • xtask no-placeholders, xtask citations, citation_drift_audit.py --ratchet, unsafe_owner_deps.py, test_seam_gate.py: OK
  • xtask no-binaries fails the same way on master: 7 tests/protocol_handshakes/*.bin fixtures, none touched here, and no workflow runs it.

A function reached only through a renamed import (use X as Y) was
reported as having no callers. is_enabled_by_env, called as
async_ssh_enabled, sat on the allowlist for that reason; its row is
dropped.
Removes 41 functions with no production caller and no test reference,
with their allowlist rows. The 10 rows held for a decision stay.

into_sync_halves was the only constructor of the embedded SSH
SyncReader/SyncWriter halves; connect_and_exec uses connect.rs's
ChannelReader/ChannelWriter. The orphaned halves, their re-exports and
tests go with it, and the docs that named them now point at connect.rs.
@oferchen oferchen added this to the 0.6.5 milestone Nov 28, 2026
@github-actions github-actions Bot added the chore label Nov 28, 2026
@oferchen
oferchen merged commit 81fea00 into master Nov 28, 2026
90 checks passed
@oferchen
oferchen deleted the chore/dead-code-allowlist-resolve-2 branch November 28, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant