Move patch/redirect/mod.rs's inline test modules into sibling test files
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start at crates/socket-patch-core/src/patch/redirect/mod.rs: production code ends at L7622, and mod tests runs L7623–L21402 plus five more #[cfg(test)] modules down to L21936. Move each module body verbatim into a sibling file (redirect/tests.rs, python_lock_warning_tests.rs, etc.), declaring them as #[cfg(test)] mod ...; from mod.rs, using use super::* for visibility and the existing *_equivalence_tests.rs files (L33–L49) as the pattern. Done when cargo test -p socket-patch-core redirect:: shows 307/322 tests passing as before, cargo clippy -p socket-patch-core --all-targets is clean, and git diff --color-moved=zebra shows only moved blocks.
Written by the indexing model from the issue text.
Description
[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.
- Dominant language
- Rust
- Stars
- 8
- Forks
- 0
- Avg merge
- 19h 21m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SocketDev/socket-patch
-
agent:triaged bug bughunt pm:npm priority:p3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
SocketDev/socket-patch#1072 · 1 comment ·
Maintainers usually reply within 1 day
-
Hosted gem `rollback` / `remove` strips the `DEPENDENCIES` `!` of a gem the user declared inside a `source "https://rubygems.org" do` block, so every frozen install fails after the unwindPossibly taken @mikolalysenko claimed this today. Openagent:triaged bug bughunt pm:bundler priority:p1
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
SocketDev/socket-patch#1056 · 1 comment ·
Maintainers usually reply within 1 day
-
agent:triaged bug bughunt pm:bundler priority:p1
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
SocketDev/socket-patch#896 · 1 comment ·
Maintainers usually reply within 1 day
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
SocketDev/socket-patch#783 · 1 comment ·
Maintainers usually reply within 1 day
-
agent:triaged bug bughunt pm:cargo priority:p2
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
SocketDev/socket-patch#651 · 3 comments ·
Maintainers usually reply within 1 day
All issues in SocketDev/socket-patch
Similar issues
-
bug user-priority/P2
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
rescript-lang/rescript#8765 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nautechsystems/nautilus_trader#5287 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
farion1231/cc-switch#8072 ·
Maintainers usually reply within 1 day
-
Python 3.15 supportPossibly taken @amnesiaof claimed this today. OpenL: python L: python:uv
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dependabot/dependabot-core#16524 · 1 comment ·
Maintainers usually reply within 1 day