Go go.work audit: false NotAMember for a use path through a missing dir on macOS (breaks macOS test job)
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu với same_dir_key trong crates/socket-patch-core/src/vendor/go_consumer_sync.rs và đọc chú thích tài liệu của nó cùng với kiểm thử đang thất bại go_work_that_does_not_use_the_project_makes_the_replace_inert. Chạy các kiểm thử tập trung cho go_consumer_sync với TMPDIR trỏ đến một thư mục được liên kết bằng symlink để tái hiện lỗi. Công việc được xem là hoàn tất khi đường dẫn sử dụng đi qua một thư mục không tồn tại khớp với thư mục gốc của dự án và xung đột NotAMember sai trên macOS được kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
[agent] Found while checking the full-scope CI run for #1407. It breaks the macOS test job, so tonight's nightly on main is expected to go red.
What fails
vendor::go_consumer_sync::tests::go_work_that_does_not_use_the_project_makes_the_replace_inert (added in #1393, merged 2026-10-11 19:48 UTC, after the last nightly) fails on macos-latest: run 38191238691, job 114624594929.
panicked at crates/socket-patch-core/src/vendor/go_consumer_sync.rs:923:13:
assertion `left == right` failed: ./x/../app
left: [Workspace { module: "example.com/upstream", version: "v1.0.0", conflict: NotAMember { work_file: "/private/var/folders/.../go.work" } }]
right: []
The spellings ./app, app, ./app/ and "./app" all pass. Only ./x/../app fails.
Root cause
same_dir_key (go_consumer_sync.rs:468) calls std::fs::canonicalize on the raw joined path <ws>/x/../app. canonicalize needs every component to exist, and x doesn't, so the call errors and the code falls back to the lexical path /var/.../app. The project root does exist and canonicalizes to /private/var/.../app, because /var is a symlink on macOS. The two keys differ, so the use entry doesn't match the project and the audit reports NotAMember.
It isn't only a test problem. Any user whose go.work use path passes through a directory that doesn't exist, and whose project sits under a symlinked path (macOS /var or /tmp, a symlinked home or checkout), gets a false "go.work does not use this project" conflict. Go itself resolves use paths lexically (filepath.Clean), so ./x/../app is a valid member for go.
Repro on Linux
Point TMPDIR at a symlinked directory:
mkdir -p /tmp/real && ln -sfn /tmp/real /tmp/link
TMPDIR=/tmp/link cargo test -p socket-patch-core --lib go_consumer_sync
# 8 passed; 1 failed (same assertion)
Proposed fix (verified locally)
Normalize lexically first, then canonicalize. This matches go's filepath.Clean and still resolves symlinks when the cleaned path exists:
fn same_dir_key(dir: &Path) -> PathBuf {
let abs = std::env::current_dir().unwrap_or_default().join(dir);
- std::fs::canonicalize(&abs)
- .unwrap_or_else(|_| crate::utils::relpath::normalize_lexically_keeping_escapes(&abs))
+ let lexical = crate::utils::relpath::normalize_lexically_keeping_escapes(&abs);
+ std::fs::canonicalize(&lexical).unwrap_or(lexical)
}
With this patch, TMPDIR=/tmp/link cargo test -p socket-patch-core --lib go_consumer_sync gives 9 passed. The rest of vendor:: matches main: the only two failures, pypi_poetry::...wire_write_failure... and pypi_requirements::...wire_failure_rolls_back..., fail on unpatched main too when run as root in the agent sandbox.
This is product code in the Go lane (first issue-fixer instance), so I haven't claimed it. The doc comment above same_dir_key should be updated with the fix.
Generated by Claude Code
- Ngôn ngữ chính
- Rust
- Star
- 8
- Fork
- 1
- Merge trung bình
- 19 giờ 1 phút
- Pull request đã merge (30 ngày)
- 473
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SocketDev/socket-patch
-
agent:triaged bug bughunt pm:npm priority:p3 ux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
SocketDev/socket-patch#1072 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
SocketDev/socket-patch#783 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Vendored cargo warns cargo_multi_version_old_cargo ("declares no rust-version") when the root package inherits rust-version from [workspace.package]Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởagent:triaged bug bughunt pm:cargo priority:p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
SocketDev/socket-patch#651 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bench perf-regression pm:nuget priority:p3
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
SocketDev/socket-patch#1425 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bench perf-regression pm:go priority:p2
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
SocketDev/socket-patch#1424 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SocketDev/socket-patch
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
RustCrypto/SSH#596 ·
-
proxy: SQL-over-HTTP turns empty arrays into [""] or [false], or HTTP 500 for int and float arraysĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
neondatabase/neon#12965 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
goauthentik/authentik#26867 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
api bug macos maintainer-needed p2 triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area::tern difficulty::easy good first issue kind::cleanup triage::ready
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100