Go go.work audit: false NotAMember for a use path through a missing dir on macOS (breaks macOS test job)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 76/100
Direção de pesquisa
Comece por same_dir_key em crates/socket-patch-core/src/vendor/go_consumer_sync.rs e leia o comentário de documentação junto com o teste que está falhando go_work_that_does_not_use_the_project_makes_the_replace_inert. Execute os testes focados de go_consumer_sync com TMPDIR apontando para um diretório vinculado por um symlink para reproduzir a falha. O trabalho estará concluído quando o caminho de uso que passa por um diretório inexistente corresponder à raiz do projeto e o falso conflito NotAMember no macOS estiver coberto.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
[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
- Linguagem predominante
- Rust
- Estrelas
- 8
- Forks
- 1
- Merge médio
- 19h 1min
- PRs com merge (30d)
- 473
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de SocketDev/socket-patch
-
agent:triaged bug bughunt pm:npm priority:p3 ux
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
SocketDev/socket-patch#1072 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 73/100
SocketDev/socket-patch#783 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Vendored cargo warns cargo_multi_version_old_cargo ("declares no rust-version") when the root package inherits rust-version from [workspace.package]Talvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaagent:triaged bug bughunt pm:cargo priority:p2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
SocketDev/socket-patch#651 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
agent:triaged bench perf-regression pm:nuget priority:p3
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
SocketDev/socket-patch#1425 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
agent:triaged bench perf-regression pm:go priority:p2
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
SocketDev/socket-patch#1424 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de SocketDev/socket-patch
Issues semelhantes
-
area::tern difficulty::easy good first issue kind::cleanup triage::ready
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
eclipse-zenoh/zenoh#2842 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
中文字符导致软件崩溃Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Y-ASLant/ElegantClipboard#172 ·
-
bug documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
SaboLabs/soroban-devkit#341 ·
Mantenedores costumam responder em até 1 dia
-
agent:sonnet-high enhancement priority: P2 ready-for-agent
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
shep-pm/shep-kelpie#652 ·
Mantenedores costumam responder em até 1 dia