Move patch/redirect/mod.rs's inline test modules into sibling test files
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 82/100
Hướng nghiên cứu
Bắt đầu tại crates/socket-patch-core/src/patch/redirect/mod.rs: mã sản xuất kết thúc ở L7622, mod tests chạy từ L7623–L21402 cộng với năm module #[cfg(test)] khác cho tới L21936. Di chuyển thân của từng module nguyên văn vào một file anh em (redirect/tests.rs, python_lock_warning_tests.rs, v.v.), khai báo chúng là #[cfg(test)] mod ...; từ mod.rs, dùng use super::* cho phạm vi nhìn thấy và lấy các file *_equivalence_tests.rs hiện có (L33–L49) làm mẫu. Xong khi cargo test -p socket-patch-core redirect:: cho thấy 307/322 test đạt như trước, cargo clippy -p socket-patch-core --all-targets sạch và git diff --color-moved=zebra chỉ hiển thị các khối đã di chuyển.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: register comment.
Kind: refactor. Source: §3.7 #1 (step 1 of tracking #1010). Register E30.
Problem
About two thirds of patch/redirect/mod.rs (21,936 lines at db83f01) is inline tests:
mod tests, L7623–L21402: 13,780 lines and 307 tests (322 across all six modules), covering every ecosystem's rewriter;python_lock_warning_tests(L21403),python_metadata_pairing_tests(L21445),hatch_tests(L21546),hosted_patch_uuid_tests(L21665) andsuperseding_repin_tests(L21792–L21936).
The production code ends at L7622. The sibling *_equivalence_tests.rs files already use the sibling-file pattern (L35–L45).
Impact
- Each hosted test addition creates a conflict hotspot in the same file as the production code.
- Production review is buried in a 22K-line file.
- This is the cheapest step of the split, and it removes about 14.3K lines from
mod.rswithout touching a production line.
Proposed change
- Declare the modules from
mod.rsand move each one's body verbatim into its own file:#[cfg(test)] mod tests;→redirect/tests.rs, and likewisepython_lock_warning_tests.rs,python_metadata_pairing_tests.rs,hatch_tests.rs,hosted_patch_uuid_tests.rsandsuperseding_repin_tests.rs. - Inside each file,
use super::*keeps the same visibility, so no item changes visibility. - Optional, in a follow-up and not this PR: split
tests.rsper ecosystem once the production split (later steps of #1010) lands.
Deleted from mod.rs: L7623–L21936.
Size and scope
- Files:
redirect/mod.rsand six new sibling files. - About 14.3K moved lines, 0 changed production lines, and about 12 added declaration lines.
- Out of scope: any production move, any test edit or rename, and the equivalence suites.
Acceptance criteria
-
git diff --color-moved=zebrashows only moved blocks, plus the sixmoddeclarations. -
mod.rsis ≤ ~7.7K lines. -
cargo test -p socket-patch-core redirect::runs the same number of tests before and after (307 intestsand 322 across the six modules), and all of them pass. -
cargo clippy -p socket-patch-core --all-targetsis clean (no newunusedwarnings from the move).
Dependencies
None. It is best landed when few PRs touching redirect/mod.rs tests are open, because open PRs will need a trivial rebase onto the moved file. It is step 1 of #1010 and unblocks nothing technically, but it makes steps 2–7 reviewable.
- Ngôn ngữ chính
- Rust
- Star
- 8
- Fork
- 0
- Merge trung bình
- 1 ngày 1 giờ
- Pull request đã merge (30 ngày)
- 257
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SocketDev/socket-patch
-
agent:triaged bug bughunt pm:npm priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
SocketDev/socket-patch#1127 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:bundler priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
SocketDev/socket-patch#1125 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:pipenv priority:p1
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
SocketDev/socket-patch#1122 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:npm priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
SocketDev/socket-patch#1072 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged arch-audit bug priority:p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
SocketDev/socket-patch#1062 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-patch
Issue tương tự
-
status:needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
agentic-os-org/ANOLISA#6742 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Kc1t/alethe-agents#312 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
api: storage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
googleapis/google-cloud-rust#7153 ·
Maintainer thường phản hồi trong vòng 1 ngày