Move the cargo e2e fixture helpers into cargo_e2e_matrix: cargo(), sparse_index_rel, find_registry_crate, locked_version and package_block are copied in 3-4 suites that already include it

Đang mở
#1,993 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
54/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
testing

Hướng nghiên cứu

Read crates/socket-patch-cli/tests/cargo_e2e_matrix/mod.rs and the four named Cargo e2e suites: e2e_redirect_cargo_build.rs, e2e_redirect_cargo_shapes.rs, e2e_vendor_cargo_build.rs, and mode_migration_cargo.rs. Compare the duplicated helpers with the existing parse_lock API, then consolidate the specified helpers and remove local copies. Run the cargo e2e CI jobs with SOCKET_PATCH_CARGO_E2E_REQUIRED=1; done means the same tests pass and only one find_registry_crate and sparse_index_rel remain.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

arch-audit refactor

[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register.

Kind: refactor. Register ID: T71.

Problem: the four cargo build suites all mod cargo_e2e_matrix;, yet each one re-writes the same fixture helpers. md5 is of the fn body with comments and whitespace stripped:

fn e2e_redirect_cargo_build e2e_redirect_cargo_shapes e2e_vendor_cargo_build mode_migration_cargo md5
cargo L128 L165 L232 L111 f9f7f391 (all identical)
sparse_index_rel L207 L185 — L209 c5573a49
find_registry_crate L182 L176 (drifted) L344 L198 07d0421e / fbb0ccc2
locked_version L153 — L315 L171 b933fd5b
package_block L173 — L335 L190 312981d4
build_patched_crate L220 build_crate L228 — L218 drifted (expect vs unwrap, leaf param)
  • The find_registry_crate drift: on a bad dir entry, the shapes copy (L176-L183)`` skips it, while the others (redirect_cargo_build L182-L191) return None.
  • Lock parsing written twice: locked_version and package_block hand-parse Cargo.lock text (L152-L179,```` mode_migration_cargo L171-L196).````` Yet cargo_e2e_matrix::parse_lock already returns `name`/`version`/`source`/`checksum`, and the same file uses it at L620-L623.
  • Another hand-kept copy: stage_fixture is near-copied between redirect_cargo_build L252-L295 and mode_migration_cargo L242-L279.

Proposed change:

  • Move cargo, sparse_index_rel, find_registry_crate (iterator form), build_patched_crate(leaf, …) and stage_fixture into tests/cargo_e2e_matrix/mod.rs.
  • Replace locked_version/package_block with parse_lock lookups.
  • Delete the local copies.
  • The copy_dir_recursive copies in the same files are left to #1979 (T64).

Size: 4 test files plus cargo_e2e_matrix/mod.rs. About −250/+80 lines.

Acceptance criteria:

  • No product code changes.
  • The four suites list the same tests and pass in the cargo e2e CI jobs with SOCKET_PATCH_CARGO_E2E_REQUIRED=1.
  • Exactly one fn find_registry_crate and one fn sparse_index_rel under crates/socket-patch-cli/tests.
Ngôn ngữ chính
Rust
Star
9
Fork
2
Merge trung bình
20 giờ 47 phút
Pull request đã merge (30 ngày)
681

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của SocketDev/socket-patch

Tất cả issue của SocketDev/socket-patch

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.