You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tracking: split patch/redirect/mod.rs into per-ecosystem modules and sibling test files #1010
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: register comment.
Kind: tracking. Source: §3.7 #1; Part 3.2. Register E30.
Problem
On main @ db83f01, patch/redirect/mod.rs is 21,936 lines. It was 17,517 lines at the review snapshot and 21,255 on 2026-10-06. It holds about 7.6K production lines (L1–L7622) and about 14.3K lines of inline tests: mod tests L7623–L21402 with 307 tests, plus five smaller test modules at L21403–L21936 (322 tests in all). The production half mixes:
gem, with the hosted-URL and grant-token grammar in the middle of it (L5862–L5995)
L5708–L6634
Maven, Go
L6635–L7622
The hosted-URL grammar lives here, not in hosted_url.rs beside it. The module also serves as a utility library for other modes and for formats/: cargo_socket_registry_pin / CargoRegistryPins (vendor/cargo.rs), gem_index_url_pattern (vendor/gem.rs, formats/gem/hosted.rs), NUGET_CONFIG_FILE_NAMES (vendor/nuget_feed.rs) and bare_sha256_hex. The last one is imported by the new formats/sbt/owned_file.rs#L625, which adds another formats → redirect edge (see #833). golang_local.rs is local/agent-mode code, called from apply.rs, rollback.rs, vex.rs, vendor/golang.rs and vendor/redownload.rs.
An ecosystem's rewriter can't be reviewed or owned on its own.
Risk: low. Every step is a move, and the public paths are kept through pub use re-exports.
Target shape
redirect/{model.rs, driver.rs, hosted_url.rs, npm_lock.rs, hatch.rs, cargo/{manifest,config,lock,pins}.rs, yarn_classic.rs, yarn_berry.rs, bun.rs, uv.rs, nuget.rs, gem.rs, maven.rs, golang.rs}, with tests in sibling files and mod.rs reduced to module declarations and re-exports. This is a mechanical split with net ~0 lines. Behavior work, such as the HostedRewriter trait (E31), comes after it and is out of scope here.
Ordered checklist (one PR each; every PR is a pure move with git diff --color-moved clean)
2. Move the hosted-URL and grant-token grammar (grant_token_path_segment, REDACTED_GRANT_TOKEN, redact_grant_token, SOCKET_PATCH_SERVER_HOST, hosted_patch_uuid, hosted_patch_url_uuids, artifact_url_present, artifact_url_spellings) into hosted_url.rs, with hosted_patch_uuid_tests.
3. Move the wire types to model.rs and the entry points and group engine to driver.rs.
patch/redirect/mod.rs is under 500 lines and holds only module declarations, re-exports and the shared driver glue that can't move.
No public path changes for callers outside redirect/: crate::patch::redirect::X still resolves for every current importer, the CLI and socket-patch-node included.
cargo test -p socket-patch-core and cargo test -p socket-patch-cli pass unchanged, with the same test count. The equivalence suites and goldens are untouched.
Dependencies
None to start. Steps 4 and 5 should land after the in-flight behavior PRs on the same section (listed above) to avoid conflicts. It blocks E31 (trait HostedRewriter) and E32 (one hosted pipeline), which are easier to review per file.
Consolidated work — backlog review, 2026-10-08
The following standalone issues are now tracked here. Their closure consolidates scheduling; it does not mean their implementation is complete. Original reports and discussion remain linked below.
#1011: Move patch/redirect/mod.rs's inline test modules into sibling test files
Preserved scope and acceptance criteria from #1011
Proposed change
Declare the modules from mod.rs and move each one's body verbatim into its own file: #[cfg(test)] mod tests; → redirect/tests.rs, and likewise python_lock_warning_tests.rs, python_metadata_pairing_tests.rs, hatch_tests.rs, hosted_patch_uuid_tests.rs and superseding_repin_tests.rs.
Inside each file, use super::* keeps the same visibility, so no item changes visibility.
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=zebra shows only moved blocks, plus the six mod declarations.
mod.rs is ≤ ~7.7K lines.
cargo test -p socket-patch-core redirect:: runs the same number of tests before and after (307 in tests and 322 across the six modules), and all of them pass.
cargo clippy -p socket-patch-core --all-targets is clean (no new unused warnings from the move).
[agent] Filed by the scheduled architecture audit routine (ecosystems and formats). Register: register comment.
Kind: tracking. Source: §3.7 #1; Part 3.2. Register E30.
Problem
On main @
db83f01,patch/redirect/mod.rsis 21,936 lines. It was 17,517 lines at the review snapshot and 21,255 on 2026-10-06. It holds about 7.6K production lines (L1–L7622) and about 14.3K lines of inline tests:mod testsL7623–L21402 with 307 tests, plus five smaller test modules at L21403–L21936 (322 tests in all). The production half mixes:db83f01Integrity,DepOverride,FileEdit,RewriteWarning,RewriteResult,full_name,serialize_json)rewriter_groups…merge_group_outputs)toml_editvalidator, config, pins): ~1.9K linesThe hosted-URL grammar lives here, not in
hosted_url.rsbeside it. The module also serves as a utility library for other modes and forformats/:cargo_socket_registry_pin/CargoRegistryPins(vendor/cargo.rs),gem_index_url_pattern(vendor/gem.rs,formats/gem/hosted.rs),NUGET_CONFIG_FILE_NAMES(vendor/nuget_feed.rs) andbare_sha256_hex. The last one is imported by the newformats/sbt/owned_file.rs#L625, which adds anotherformats → redirectedge (see #833).golang_local.rsis local/agent-mode code, called fromapply.rs,rollback.rs,vex.rs,vendor/golang.rsandvendor/redownload.rs.Symptoms / impact
pm:*hosted fixes editmod.rs.pub usere-exports.Target shape
redirect/{model.rs, driver.rs, hosted_url.rs, npm_lock.rs, hatch.rs, cargo/{manifest,config,lock,pins}.rs, yarn_classic.rs, yarn_berry.rs, bun.rs, uv.rs, nuget.rs, gem.rs, maven.rs, golang.rs}, with tests in sibling files andmod.rsreduced to module declarations and re-exports. This is a mechanical split with net ~0 lines. Behavior work, such as theHostedRewritertrait (E31), comes after it and is out of scope here.Ordered checklist (one PR each; every PR is a pure move with
git diff --color-movedclean)redirect/. Child issue: Move patch/redirect/mod.rs's inline test modules into sibling test files #1011.grant_token_path_segment,REDACTED_GRANT_TOKEN,redact_grant_token,SOCKET_PATCH_SERVER_HOST,hosted_patch_uuid,hosted_patch_url_uuids,artifact_url_present,artifact_url_spellings) intohosted_url.rs, withhosted_patch_uuid_tests.model.rsand the entry points and group engine todriver.rs.cargo/. Coordinate with Hosted cargo redirect refuses a dependency whose inline table has a multi-line features array, because it plans Cargo.toml pins with a line scanner #757 and Read Cargo.toml package name and version through one shared toml_edit reader #693, and land after Hosted cargo redirect refuses a dependency whose inline table has a multi-line features array, because it plans Cargo.toml pins with a line scanner #757 if it is in flight.golang_local.rsout ofredirect/into the agent/local patch layer.vendor/andformats/import (cargo_socket_registry_pin,CargoRegistryPins,gem_index_url_pattern,NUGET_CONFIG_FILE_NAMES,bare_sha256_hex) intoformats/<eco>orutils/, so thatvendor/formatsno longer importredirect. This overlaps Tracking: move the pure lock codecs and neutral lock types into formats/ so formats imports nothing from vendor or redirect #833.Acceptance criteria
patch/redirect/mod.rsis under 500 lines and holds only module declarations, re-exports and the shared driver glue that can't move.redirect/:crate::patch::redirect::Xstill resolves for every current importer, the CLI andsocket-patch-nodeincluded.cargo test -p socket-patch-coreandcargo test -p socket-patch-clipass unchanged, with the same test count. The equivalence suites and goldens are untouched.Dependencies
None to start. Steps 4 and 5 should land after the in-flight behavior PRs on the same section (listed above) to avoid conflicts. It blocks E31 (
trait HostedRewriter) and E32 (one hosted pipeline), which are easier to review per file.Consolidated work — backlog review, 2026-10-08
The following standalone issues are now tracked here. Their closure consolidates scheduling; it does not mean their implementation is complete. Original reports and discussion remain linked below.
#1011: Move patch/redirect/mod.rs's inline test modules into sibling test files
Preserved scope and acceptance criteria from #1011
Proposed change
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.use super::*keeps the same visibility, so no item changes visibility.tests.rsper ecosystem once the production split (later steps of Tracking: split patch/redirect/mod.rs into per-ecosystem modules and sibling test files #1010) lands.Deleted from
mod.rs: L7623–L21936.Size and scope
redirect/mod.rsand six new sibling files.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).