Skip to content

fix(cli): remove dead peer turn session helpers and their test-only callers - #2575

Open
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-peer-host-dead-code
Open

fix(cli): remove dead peer turn session helpers and their test-only callers#2575
1688mengdie wants to merge 1 commit into
GCWing:mainfrom
BitFun-SIG:fix/ci-warning-peer-host-dead-code

Conversation

@1688mengdie

Copy link
Copy Markdown

Summary

Fixes #2569

Delete the dead session-scoped turn helpers in src/apps/cli/src/peer_host/state.rs together with their test-only callers:

  • PeerTurnTracker::drain_session_turns (zero non-test references left)
  • session_tree_keys (private helper of the above)
  • remove_completed_background_sources_for_session (private helper of the above)
  • the four unit tests that exclusively exercise drain_session_turns: draining_a_parent_session_after_root_completion_returns_the_active_child_only, draining_a_child_session_releases_its_early_follow_up_reservation, draining_a_sibling_child_does_not_release_another_childs_reservation, explicit_drains_quarantine_removed_turn_ids

After the upstream transactional session rollback rework, session-level turn cleanup moved into the Agent Runtime rollback path; the CI logs report all three symbols as dead code (see issue #2569 for the run evidence with file:line and rule names).

Type and Areas

Type: bug fix (dead code removal, no behavior change)

Areas: Rust CLI

Motivation / Impact

No direct user-facing change. Live peer-turn functionality is untouched: PeerTurnDrain, interrupt_event_stream, drain_peer_turns, peer_turns_for_cancellation and all remaining peer-host tests stay. The crate stops carrying three dead symbols and four orphaned tests, and the CI logs stop reporting the three dead_code warnings on every full run.

Verification

  • cargo check --locked -p bitfun-cli on Windows: exit 0, the three dead_code warnings gone.
  • cargo test --locked -p bitfun-cli --bin bitfun peer_host on Windows: 77 passed, 0 failed (the remaining peer-host test suite is intact after the four drain-only tests were removed).
  • Full cross-platform test surface depends on the CI ubuntu/macos runners: the CLI Tests jobs should confirm the removal compiles clean on all platforms (n/a locally — no Linux/macOS machine available; the platform matrix in CI is exactly the place this gets verified).

Reviewer Notes

  • Single file, −171 lines, pure deletion (0 additions): no new code, no #[allow(dead_code)] suppression.
  • Deletion rationale is grep-based (zero production callers) plus the upstream CI dead_code logs; removal of the four tests is exactly scoped to the ones that exercise only the deleted entry point.
  • AI-assisted change, lightly tested (cargo check + targeted unit tests on Windows; cross-platform behavior verified by CI).

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable. (n/a — no user-facing change)

callers

After the upstream transactional session rollback rework, the session-level
turn cleanup moved into the Agent Runtime rollback path and no production
caller is left for PeerTurnTracker::drain_session_turns: a full-crate grep
finds zero non-test references, and the upstream CI build logs report the
method (plus its two private helpers session_tree_keys and
remove_completed_background_sources_for_session) as dead code.

Following the upstream BREAKING semantics that already accepted removing
session-scoped helpers, delete the three dead symbols and the four tests
that exclusively exercise drain_session_turns:
- draining_a_parent_session_after_root_completion_returns_the_active_child_only
- draining_a_child_session_releases_its_early_follow_up_reservation
- draining_a_sibling_child_does_not_release_another_childs_reservation
- explicit_drains_quarantine_removed_turn_ids

No allow(dead_code) suppression is introduced.

Test: cargo check --locked -p bitfun-cli exit 0 with the three dead_code
warnings gone; cargo test -p bitfun-cli --bin bitfun peer_host exit 0.
AI: implemented with AI assistance, lightly tested (cargo check + targeted
unit tests).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: dead_code warnings for peer-host session turn drain helpers with no production callers

1 participant