Repository navigation
RUST-REF-005: Decompose oversized Rust modules #7
Copy link
Copy link
Open
Description
RUST-REF-005 - Decompose oversized Rust modules by responsibility
Summary
Reduce the Rust client's legacy oversized source files through small,
behavior-preserving extractions. Start with emulebb-core/src/lib.rs, which is
13,711 lines at the start of this item, then continue through the largest
responsibility-mixed production and test modules.
Release Triage (2026-09-30)
Post-beta. Responsibility-based decomposition remains worthwhile, but the
quality policy treats file size as an advisory and the candidate passes policy,
Clippy, tests, and the hosted OS matrix. No remaining module-size concern is a
release defect; resume this as small post-beta maintenance slices.
Invariants
- Preserve public Rust paths, REST/OpenAPI behavior, serialization, persistence,
and configuration semantics. - Preserve stock-compatible eD2K/Kad behavior and all VPN fail-closed boundaries.
- Keep module boundaries responsibility-based; do not split cohesive control flow
solely to satisfy a mechanical line count. - Remove private dead code and dependencies only when repository-wide references,
all-target Clippy, and tests prove they are unused. - Deliver each extraction as a separate reviewed and validated commit.
Work Plan
- Split the inline
emulebb-coretests into responsibility-focused modules. - Move the
EmulebbCorefacade and API implementations into focused modules. - Split download and Kad orchestration into explicit runtime responsibilities.
- Use non-failing maintainability advisories to identify files that deserve a
responsibility review; do not treat line count as a validation limit. - Continue with the largest mixed-responsibility modules in the core and
protocol crates.
Acceptance Criteria
-
emulebb-core/src/lib.rsis a thin crate root with stable public re-exports. - Inline core tests are grouped by subsystem with unchanged assertions.
- Static IPv4 and P2P binding audits cover every relocated boundary.
- No repository-local Cargo
targetdirectory is created. - Workspace format, Clippy, tests, Kad swarm, and VPN leak gates pass.
- Remaining large files are reviewed by responsibility without hard limits
or per-file allowlist rationales. - Substantial tests live in sibling test modules or integration-test trees;
only focused white-box tests remain inline with production code.
Validation
python tools\rust_quality_gate.py policypython -m emule_workspace validate --include-product-family --product-family-tier full- Rust workspace, isolated Kad swarm, and VPN leak gates through supported
workspace orchestration.
Current Evidence
fcd6f36makes the UI executable a three-line entry point over a library
application boundary.86b64da,4a94087,8caaef7,5087dab, and8a326e2separate UI
presentation, models, REST transport, background commands, and rendering from
application wiring. Each extraction passed isolated all-target UI Clippy.50070b3moves the 1,796-linekad_storetest suite into a sibling test
module; all 41 focused tests pass and the production module is 539 lines.cf380fdreplaces permanent lint allows with checked, reasoned expectations;
two obsolete expectations and one ownership-only dead-code field suppression
were removed during the review.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
itlezy commentedon Jul 10, 2026
2026-07-10 implementation wave
Completed and pushed 23 granular
RUST-REF-005commits.crates/emulebb-core/src/lib.rsfrom 13,711 to 6,132 lines.lib.rshard limit to 6,132 and removed the temporary core-test allowlist.network_api.rsboundary.-D warnings.Evidence:
cargo test --workspace --locked -- --skip local_kad_swarmpasses.targetdirectory exists.The workspace-wide
validate --include-product-familyentrypoint remains blocked before product checks by 67 pre-existing virtual-environment binaries under other managed repositories; no unrelated environments were deleted.Next wave: split the remaining Kad publish/runtime and core download orchestration blocks, then address
kad_store/mod.rs, the Slint UI client, and upload queue hotspots.itlezy commentedon Jul 11, 2026
Additional responsibility-based decomposition landed in granular commits: fcd6f36 (thin UI binary), 86b64da (presentation), 4a94087 (models), 8caaef7 (REST client), 5087dab (worker), 8a326e2 (rendering), and 50070b3 (kad_store sibling tests). The UI app wiring is now 495 lines with cohesive modules; kad_store production is 539 lines and its 41-test suite is separate. cf380fd also replaces permanent lint allows with checked reasoned expectations. Focused tests and all-target Clippy pass.
itlezy commentedon Sep 30, 2026
Phase C backlog triage: reclassified to post-beta polish. Current candidate policy, Clippy, tests, and hosted OS CI are green; no remaining module-size concern is a beta release defect. Suite project status returns to Todo.
itlezy commentedon Sep 30, 2026
Beta code freeze is active as of 2026-09-30. This refactor remains valid post-beta work, but it must not start during the freeze. The
good first issueandhelp wantedlabels have been removed so they do not conflict with the freeze admission rules in RUST-FEAT-033.