refactor(yipd): split peer_manager.rs into a module directory (#11) #119
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
femboy/yip!119
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/peer-manager-module-split"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pure code-movement refactor — prerequisite for multi-core sharding (#10). Splits the 9,434-line
bin/yipd/src/peer_manager.rsinto apeer_manager/module directory. Zero behavior change.Approach
The
PeerManagerstruct stays whole inmod.rs; method groups move into concern-focused sibling files as additionalimpl PeerManager { … }blocks (Rust allows split inherent impls). Methods called by sibling modules were raised private→pub(super)(never wider). Tests moved beside the code they exercise; shared test helpers live intestutil.rs.Result
mod.rs9,434 → 3,503 lines (~1,314 production — the plan's target — plus 2,188 integration tests left in place). New files:handshake.rs,rekey.rs,relay.rs,routing.rs,obf.rs,gossip.rs,testutil.rs. The 3 dispatch drivers (on_udp_dispatch/on_tun_dispatch/tick_dispatch) stay inmod.rs—tick_dispatchholds the #116 escalation arm.How it was built & verified
Executed as 8 sequential byte-verified moves (one commit each), each gated on: full
cargo test -p yipd --bins= 262 passed, 0 failed (same names), fmt+clippy clean, and a per-commit "pure relocation" diff review. Confirmed on real rebuilds at every step. The #116 punch→relay netns money-test passes on this branch (DISTINCT_INIT_EPHEMERALS=2). All 37 methods verified defined exactly once across the module.A whole-branch review (most-capable model) verdict: mergeable, coherent split, visibility hygiene clean, no circular deps, no duplicated helpers.
Documented follow-up (not in this PR)
Extract
mod testsfrommod.rsintopeer_manager/tests.rs(mechanical, zero visibility changes — accounts for themod.rsline count).tick_dispatch's size is pre-existing, separate future work.Spec:
docs/2026-07-26-peer-manager-module-split-design.md(included in this branch). Each commit is reviewable as an isolated pure move.