Agent-mode PyPI variant selection uses one representative file, not the installed wheel's tags, so wheels that share .py files all match

Đang mở
#2,194 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
30/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, rust
Lĩnh vực
cli

Hướng nghiên cứu

Start in crates/socket-patch-cli/src/commands/apply.rs at representative_file (around line 1199) and its mirror select_installed_variants in socket-patch-core, then compare with crates/socket-patch-core/src/hosted/wheel_record.rs where the WHEEL Tag: lines are already parsed. Reproduce by building a patch that touches a shared .py file and the compiled extension, then check which variant records match. Done means variant selection uses the installed wheel's tags against artifact_id, with the hash probe kept as a secondary check on a differing file.

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

Mô tả

agent:triaged enhancement pm:pip priority:p1

Summary

In agent mode a release variant of a PyPI package (a record keyed ?artifact_id=<wheel filename>) is matched to the installed distribution by the hash state of ONE file: the lexicographically smallest key with a non-empty beforeHash (representative_file, crates/socket-patch-cli/src/commands/apply.rs:1199, mirrored by select_installed_variants in core). The installed wheel's own WHEEL Tag: lines are not consulted; they are read only on the hosted path (crates/socket-patch-core/src/hosted/wheel_record.rs:121).

Why this matters

Platform wheels of one release usually share their .py files byte for byte and differ only in the compiled extension. Measured on pillow 12.3.0: all 97 .py files are identical across the manylinux x86_64, manylinux aarch64, musllinux and macOS arm64 wheels. If a patch changes both a .py file and the extension (or only the extension, with a .py file also listed), the representative file is the shared .py, so every variant record "matches" the install. Each matching variant is then applied; for the variants built for another platform the extension's beforeHash does not match. With the default policy that fails closed, so the user gets a failure for a package that has a correct variant; with --force / --allow-patch-conflicts a library built for another platform can be written.

This is from reading the code; I did not reproduce it end to end.

Suggested direction

Select the variant from what the install says it is: the Tag: lines of *.dist-info/WHEEL (and the gem platform, which agent mode already consults) against the variant's artifact_id. Keep the hash probe as a second check, on a file that actually differs between variants when one exists.

Ngôn ngữ chính
Rust
Star
9
Fork
2
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
309

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.