Move patch/redirect/mod.rs's inline test modules into sibling test files
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 crates/socket-patch-core/src/patch/redirect/mod.rs 开始:生产代码到 L7622 结束,mod tests 占据 L7623–L21402,另有五个 #[cfg(test)] 模块一直到 L21936。将每个模块体原样(verbatim)移入同级文件(redirect/tests.rs、python_lock_warning_tests.rs 等),在 mod.rs 中以 #[cfg(test)] mod ...; 声明它们,用 use super::* 处理可见性,并以现有的 *_equivalence_tests.rs 文件(L33–L49)为范例。当 cargo test -p socket-patch-core redirect:: 显示 307/322 个测试照常通过、cargo clippy -p socket-patch-core --all-targets 无警告、且 git diff --color-moved=zebra 只显示被移动的代码块时即为完成。
由索引模型根据 Issue 内容生成。
描述
[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.
- 主要语言
- Rust
- 星标
- 8
- 派生
- 0
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 211
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SocketDev/socket-patch 的其他 Issue
-
agent:triaged arch-audit bug priority:p3
难度 2/5 1-3 小时 新手友好度 74/100
SocketDev/socket-patch#982 · 1 条评论 ·
维护者通常 1 天内回复
-
Hosted yarn classic pins give no berry-migration warning, so a yarn 2+ install silently drops them (vendored warns about the same trap)可能已有人在做 @mikolalysenko 于 1 天前认领。 未关闭agent:claimed agent:triaged bug bughunt pm:yarn-classic priority:p1
难度 2/5 1-3 小时 新手友好度 85/100
SocketDev/socket-patch#907 · 2 条评论 ·
维护者通常 1 天内回复
-
agent:triaged bug bughunt pm:bundler priority:p1
难度 2/5 1-3 小时 新手友好度 85/100
SocketDev/socket-patch#896 · 1 条评论 ·
维护者通常 1 天内回复
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
难度 2/5 1-3 小时 新手友好度 73/100
SocketDev/socket-patch#783 · 1 条评论 ·
维护者通常 1 天内回复
-
agent:triaged bug bughunt pm:pipenv priority:p1
难度 2/5 1-3 小时 新手友好度 83/100
SocketDev/socket-patch#744 · 1 条评论 ·
维护者通常 1 天内回复
查看 SocketDev/socket-patch 的全部 Issue
相似的 Issue
-
documentation
难度 1/5 1 小时以内 新手友好度 90/100
fastrevmd-lab/rustmistmcp#161 ·
-
bug user-priority/P2
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
opencode: an unanswered --version probe launches opencode 2 without per-session service isolation未关闭
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
security-advisory
难度 2/5 1-3 小时 新手友好度 85/100
MinBZK/regelrecht#1686 ·
维护者通常 1 天内回复
-
L: github:actions L: php:composer
难度 2/5 1-3 小时 新手友好度 88/100
dependabot/dependabot-core#16493 ·
维护者通常 1 天内回复