Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Move patch/redirect/mod.rs's inline test modules into sibling test files

Geschlossen Anfängerfreundlich
#1,011 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
82/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust
Bereich
tooling

Rechercherichtung

Beginne in crates/socket-patch-core/src/patch/redirect/mod.rs: der Produktionscode endet bei L7622, mod tests läuft von L7623–L21402 plus fünf weitere #[cfg(test)]-Module bis L21936. Verschiebe jeden Modulkörper wörtlich in eine Schwesterdatei (redirect/tests.rs, python_lock_warning_tests.rs etc.), deklariere sie als #[cfg(test)] mod ...; in mod.rs, nutze use super::* für die Sichtbarkeit und nimm die vorhandenen *_equivalence_tests.rs-Dateien (L33–L49) als Muster. Fertig, wenn cargo test -p socket-patch-core redirect:: wie zuvor 307/322 Tests bestanden zeigt, cargo clippy -p socket-patch-core --all-targets sauber ist und git diff --color-moved=zebra nur verschobene Blöcke anzeigt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

agent:triaged arch-audit priority:p3 refactor

[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) and superseding_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.rs without touching a production line.
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.
  • Optional, in a follow-up and not this PR: split tests.rs per ecosystem once the production split (later steps of #1010) lands.

Deleted from mod.rs: L7623–L21936.

Size and scope
  • Files: redirect/mod.rs and 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=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).
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.

Vorherrschende Sprache
Rust
Sterne
8
Forks
1
Ø Merge
18 Std. 19 Min.
Gemergte PRs (30 T.)
504

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus SocketDev/socket-patch

Alle Issues in SocketDev/socket-patch

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.