GCWing / GCWing/OpenBitFun

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

Đã đóng Phù hợp với người mới
#2,569 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
2.3k
Fork
231
Merge trung bình
2 giờ 49 phút
Pull request đã merge (30 ngày)
589

Mô tả

## Summary

The upstream CI logs for `main` report three dead-code warnings in the peer host turn tracker. Evidence from GitHub Actions run [33035362609](https://github.com/GCWing/BitFun/actions/runs/33035362609) (reproduced across runs 33050974141 and 33047041028):

- `warning: method drain_session_turns is never used` --> `src/apps/cli/src/peer_host/state.rs:426:19`
- `warning: function session_tree_keys is never used` --> `src/apps/cli/src/peer_host/state.rs:662:4`
- `warning: function remove_completed_background_sources_for_session is never used` --> `src/apps/cli/src/peer_host/state.rs:737:4`

Cross-checking the crate: `PeerTurnTracker::drain_session_turns` has zero non-test references, and `session_tree_keys` / `remove_completed_background_sources_for_session` are called only by `drain_session_turns` itself and by tests that exclusively exercise it. Four unit tests exist solely to exercise `drain_session_turns`.

## Root Cause Analysis

- After the upstream transactional session rollback rework, session-level turn cleanup moved into the Agent Runtime rollback path. The old session-scoped drain entry point on `PeerTurnTracker` lost all production callers, and its two private helpers plus the four tests that only exercise it became dead weight.
- rustc therefore reports all three symbols as dead code on every full CI run of `main` (runs 33035362609 / 33050974141 / 33047041028).

## Proposed Fix

Delete the three dead symbols (`drain_session_turns`, `session_tree_keys`, `remove_completed_background_sources_for_session`) together with 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`

Live peer-turn functionality (`PeerTurnDrain`, `interrupt_event_stream`, `drain_peer_turns`, `peer_turns_for_cancellation`, and the remaining 70+ peer_host tests) is untouched. No `#[allow(dead_code)]` suppression is involved.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu tại src/apps/cli/src/peer_host/state.rs, ở ba symbol đã được báo cáo, và kiểm tra bốn test được nêu tên chỉ thực thi drain_session_turns. Xác minh rằng các test peer-turn còn lại vẫn bao phủ chức năng đang hoạt động, sau đó chạy bộ test peer_host và một bản build đầy đủ hoặc kiểm tra tương đương với CI. Công việc được xem là hoàn tất khi các symbol và test đã lỗi thời được xóa mà không có cảnh báo mã chết hoặc hồi quy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
rust
Lĩnh vực
cli, tooling
Loại issue
Tái cấu trúc
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
86/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.